test: improve getOption command
gitea/salix-front/pipeline/pr-test This commit looks good
Details
gitea/salix-front/pipeline/pr-test This commit looks good
Details
This commit is contained in:
parent
a8d5b67529
commit
7f370dc29c
|
@ -18,7 +18,7 @@ describe('Client consignee', () => {
|
|||
const addressName = 'test';
|
||||
cy.dataCy('Consignee_input').type(addressName);
|
||||
cy.dataCy('Location_select').click();
|
||||
cy.get('[role="listbox"] .q-item:nth-child(1)').click();
|
||||
cy.getOption();
|
||||
cy.dataCy('Street address_input').type('TEST ADDRESS');
|
||||
cy.get('.q-btn-group > .q-btn--standard').click();
|
||||
cy.location('href').should('contain', '#/customer/1107/address');
|
||||
|
|
|
@ -7,7 +7,7 @@ describe('TicketFilter', () => {
|
|||
cy.domContentLoad();
|
||||
});
|
||||
|
||||
it.only('use search button', function () {
|
||||
it('use search button', function () {
|
||||
cy.waitForElement('.q-page');
|
||||
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
|
||||
cy.searchBtnFilterPanel();
|
||||
|
|
|
@ -60,7 +60,7 @@ describe('TicketList', () => {
|
|||
cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne');
|
||||
cy.dataCy('Address_select').click();
|
||||
|
||||
cy.selectOptionBeta().click();
|
||||
cy.getOption().click();
|
||||
cy.dataCy('Address_select').should('have.value', 'Bruce Wayne');
|
||||
});
|
||||
it('Client list create new client', () => {
|
||||
|
|
|
@ -18,7 +18,7 @@ describe('UserPanel', () => {
|
|||
cy.get(userWarehouse).should('have.value', 'VNL').click();
|
||||
|
||||
// Actualizo la opción
|
||||
getOption(3);
|
||||
cy.getOption(3);
|
||||
|
||||
//Compruebo la notificación
|
||||
cy.get('.q-notification').should('be.visible');
|
||||
|
@ -26,7 +26,7 @@ describe('UserPanel', () => {
|
|||
|
||||
//Restauro el valor
|
||||
cy.get(userWarehouse).click();
|
||||
getOption(2);
|
||||
cy.getOption(2);
|
||||
});
|
||||
it('should notify when update user company', () => {
|
||||
const userCompany =
|
||||
|
@ -39,7 +39,7 @@ describe('UserPanel', () => {
|
|||
cy.get(userCompany).should('have.value', 'Warehouse One').click();
|
||||
|
||||
//Actualizo la opción
|
||||
getOption(2);
|
||||
cy.getOption(2);
|
||||
|
||||
//Compruebo la notificación
|
||||
cy.get('.q-notification').should('be.visible');
|
||||
|
@ -47,12 +47,6 @@ describe('UserPanel', () => {
|
|||
|
||||
//Restauro el valor
|
||||
cy.get(userCompany).click();
|
||||
getOption(1);
|
||||
cy.getOption(1);
|
||||
});
|
||||
});
|
||||
|
||||
function getOption(index) {
|
||||
cy.waitForElement('[role="listbox"]');
|
||||
const option = `[role="listbox"] .q-item:nth-child(${index})`;
|
||||
cy.get(option).click();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ describe('VnLocation', () => {
|
|||
cy.selectOption(countrySelector, country);
|
||||
cy.dataCy('locationProvince').type(`${province}{enter}`);
|
||||
cy.get(
|
||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) `
|
||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) `,
|
||||
).click();
|
||||
cy.dataCy('locationProvince').should('have.value', province);
|
||||
});
|
||||
|
@ -87,9 +87,9 @@ describe('VnLocation', () => {
|
|||
.get(':nth-child(1)')
|
||||
.should('have.length.at.least', 2);
|
||||
cy.get(
|
||||
firstOption.concat(' > .q-item__section > .q-item__label--caption')
|
||||
firstOption.concat(' > .q-item__section > .q-item__label--caption'),
|
||||
).should('have.text', postCodeLabel);
|
||||
cy.get(firstOption).click();
|
||||
cy.getOption();
|
||||
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content > .q-icon').click();
|
||||
cy.reload();
|
||||
cy.waitForElement('.q-form');
|
||||
|
@ -103,7 +103,7 @@ describe('VnLocation', () => {
|
|||
cy.get('.q-card > h1').should('have.text', 'New postcode');
|
||||
cy.selectOption(
|
||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
|
||||
province
|
||||
province,
|
||||
);
|
||||
cy.get(dialogInputs).eq(0).clear();
|
||||
cy.get(dialogInputs).eq(0).type(postCode);
|
||||
|
@ -156,7 +156,7 @@ describe('VnLocation', () => {
|
|||
cy.get(createLocationButton).click();
|
||||
cy.selectOption(
|
||||
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
|
||||
'España'
|
||||
'España',
|
||||
);
|
||||
cy.dataCy('Province_icon').click();
|
||||
|
||||
|
|
|
@ -362,12 +362,16 @@ Cypress.Commands.add('clickButtonWith', (type, value) => {
|
|||
Cypress.Commands.add('clickButtonWithIcon', (iconClass) => {
|
||||
cy.get(`.q-icon.${iconClass}`).parent().click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('clickButtonWithText', (buttonText) => {
|
||||
cy.get('.q-btn').contains(buttonText).click();
|
||||
});
|
||||
Cypress.Commands.add('selectOptionBeta', (index = 1) => {
|
||||
|
||||
Cypress.Commands.add('getOption', (index = 1) => {
|
||||
cy.waitForElement('[role="listbox"]');
|
||||
cy.get(`[role="listbox"] .q-item:nth-child(${index})`).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('searchBtnFilterPanel', () => {
|
||||
cy.get(
|
||||
'.q-scrollarea__content > .q-btn--standard > .q-btn__content > .q-icon',
|
||||
|
|
Loading…
Reference in New Issue