From eed3267a11a746e52e55b67a8d37a77af0bff43f Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 15 Dec 2023 08:16:54 +0100 Subject: [PATCH] refs #6062 test: fixed e2e due to change of style in the indexes --- .../integration/wagon/wagonCreate.spec.js | 19 ++++++++----------- .../wagonType/wagonTypeCreate.spec.js | 17 ++++++++--------- .../integration/worker/workerList.spec.js | 2 +- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/test/cypress/integration/wagon/wagonCreate.spec.js b/test/cypress/integration/wagon/wagonCreate.spec.js index 62eadc5fd..9aff3a819 100644 --- a/test/cypress/integration/wagon/wagonCreate.spec.js +++ b/test/cypress/integration/wagon/wagonCreate.spec.js @@ -6,6 +6,7 @@ describe('WagonCreate', () => { }); it('should create and delete a new wagon', () => { + cy.waitForElement('.q-card'); cy.get('input').eq(0).type('1234'); cy.get('input').eq(1).type('1234ABCD'); cy.get('input').eq(2).type('100'); @@ -16,18 +17,14 @@ describe('WagonCreate', () => { cy.get('button[type="submit"]').click(); // Check data has been saved successfully - cy.get('div.text-h6').contains('1234').click(); - cy.get('input').eq(0).should('have.value', '1234'); - cy.get('input').eq(1).should('have.value', '1234ABCD'); - cy.get('input').eq(2).should('have.value', '100'); - cy.get('input').eq(3).should('have.value', 'Wagon Type #1'); + cy.waitForElement('.q-card'); + + cy.get('.title').should('have.text', '1234'); + cy.get('[title-label="Plate"] > .value > span').should('have.text', '1234ABCD'); + cy.get(':nth-child(2) > .value > span').should('have.text', '100'); + cy.get(':nth-child(3) > .value > span').should('have.text', 'Wagon Type #1'); // Delete wagon type created - cy.go('back'); - cy.get('div.text-h6') - .contains('1234') - .parentsUntil('div.q-card') - .find('div.q-card__actions') - .find('button').last().click(); + cy.get('.actions > .q-btn--standard').click(); }); }); diff --git a/test/cypress/integration/wagonType/wagonTypeCreate.spec.js b/test/cypress/integration/wagonType/wagonTypeCreate.spec.js index ae74dff16..bcf7fe841 100644 --- a/test/cypress/integration/wagonType/wagonTypeCreate.spec.js +++ b/test/cypress/integration/wagonType/wagonTypeCreate.spec.js @@ -5,13 +5,13 @@ describe('WagonTypeCreate', () => { cy.visit('/#/wagon/type/create'); }); - function chooseColor(color){ + function chooseColor(color) { cy.get('div.shelving-down').eq(1).click(); cy.get('div.q-color-picker__cube').eq(color).click(); cy.get('div.q-card__section').find('button').click(); } - function addTray(position){ + function addTray(position) { cy.get('div.action-button').last().find('button').click(); cy.focused().type(position); cy.focused().blur(); @@ -38,7 +38,9 @@ describe('WagonTypeCreate', () => { cy.get('button[type="submit"]').click(); // Check data has been saved successfully - cy.get('div.text-h6').contains('Example for testing').click(); + cy.get(':nth-child(1) > :nth-child(1) > .justify-between > .flex > .title') + .contains('Example for testing') + .click(); cy.get('input').first().should('have.value', 'Example for testing'); cy.get('div.wagon-tray').should('have.length', 4); cy.get('div.position').eq(0).find('input').should('have.value', '150'); @@ -47,11 +49,8 @@ describe('WagonTypeCreate', () => { // Delete wagon type created cy.go('back'); - cy.get('div.text-h6') - .contains('Example for testing') - .parentsUntil('div.q-card') - .find('div.q-card__actions') - .find('button').last().click(); - + cy.get( + ':nth-child(2) > :nth-child(1) > .card-list-body > .actions > .q-btn--standard' + ).click(); }); }); diff --git a/test/cypress/integration/worker/workerList.spec.js b/test/cypress/integration/worker/workerList.spec.js index 2ab84c623..b5c57f920 100644 --- a/test/cypress/integration/worker/workerList.spec.js +++ b/test/cypress/integration/worker/workerList.spec.js @@ -1,6 +1,6 @@ describe('WorkerList', () => { const workerFieldNames = - '.card-list-body > .list-items > :nth-child(2) > .value > span'; + '.card-list-body > .list-items > :nth-child(1) > .value > span'; beforeEach(() => { cy.viewport(1280, 720); cy.login('developer');