0
0
Fork 0

chore: refs #6900 fix e2e tests

This commit is contained in:
Jorge Penadés 2024-08-09 10:47:15 +02:00
parent f1047328c7
commit a9e8621903
3 changed files with 13 additions and 13 deletions

View File

@ -1,8 +1,9 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('InvoiceInIntrastat', () => { describe('InvoiceInIntrastat', () => {
const inputBtns = 'label button'; const firstRow = 'tbody > :nth-child(1)';
const thirdRow = 'tbody > :nth-child(3)'; const thirdRow = 'tbody > :nth-child(3)';
const firstLineCode = 'tbody > :nth-child(1) > :nth-child(2)'; const firstRowCode = `${firstRow} > :nth-child(2)`;
const firstRowAmount = `${firstRow} > :nth-child(3)`;
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
@ -10,10 +11,10 @@ describe('InvoiceInIntrastat', () => {
}); });
it('should edit the first line', () => { it('should edit the first line', () => {
cy.selectOption(firstLineCode, 'Plantas vivas: Esqueje/injerto, Vid'); cy.selectOption(firstRowCode, 'Plantas vivas: Esqueje/injerto, Vid');
cy.get(inputBtns).eq(1).click(); cy.get(firstRowAmount).clear();
cy.saveCard(); cy.saveCard();
cy.get(`${firstLineCode} span`).should( cy.get(`${firstRowCode} span`).should(
'have.text', 'have.text',
'6021010:Plantas vivas: Esqueje/injerto, Vid' '6021010:Plantas vivas: Esqueje/injerto, Vid'
); );

View File

@ -1,23 +1,23 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('InvoiceInList', () => { describe('InvoiceInList', () => {
const firstCard = '.q-card:nth-child(1)'; const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
const firstChipId = const firstId = `${firstRow} > td:nth-child(1) span`;
':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content'; const firstDetailBtn = `${firstRow} .q-btn:nth-child(1)`;
const firstDetailBtn = '.q-card:nth-child(1) .q-btn:nth-child(2)';
const summaryHeaders = '.summaryBody .header-link'; const summaryHeaders = '.summaryBody .header-link';
beforeEach(() => { beforeEach(() => {
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/invoice-in/list`); cy.visit(`/#/invoice-in/list`);
cy.get('#searchbar input').type('{enter}');
}); });
it('should redirect on clicking a invoice', () => { it('should redirect on clicking a invoice', () => {
cy.get(firstChipId) cy.get(firstId)
.invoke('text') .invoke('text')
.then((content) => { .then((content) => {
const id = content.replace(/\D/g, ''); const id = content.replace(/\D/g, '');
cy.get(firstCard).click(); cy.get(firstRow).click();
cy.url().should('include', `/invoice-in/${id}/summary`); cy.url().should('include', `/invoice-in/${id}/summary`);
}); });
}); });

View File

@ -4,8 +4,7 @@ describe('InvoiceInVat', () => {
const firstLineVat = 'tbody > :nth-child(1) > :nth-child(4)'; const firstLineVat = 'tbody > :nth-child(1) > :nth-child(4)';
const dialogInputs = '.q-dialog label input'; const dialogInputs = '.q-dialog label input';
const dialogBtns = '.q-dialog button'; const dialogBtns = '.q-dialog button';
const acrossInput = const acrossInput = 'tbody tr:nth-child(1) td:nth-child(2) .default-icon';
':nth-child(1) > .q-td.q-table--col-auto-width > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .default-icon';
const randomInt = Math.floor(Math.random() * 100); const randomInt = Math.floor(Math.random() * 100);
beforeEach(() => { beforeEach(() => {