From e0ce593102ed6bc206aab0b603ba0711cbdaf3d7 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 31 Oct 2022 17:49:16 -0700 Subject: [PATCH] Add label on button --- .../editor/cypress/e2e/relationship.cy.js | 10 +++++----- .../editor/cypress/e2e/topicFontChange.cy.js | 20 +++++++++---------- packages/editor/cypress/e2e/topicShape.cy.js | 16 +++++++-------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/editor/cypress/e2e/relationship.cy.js b/packages/editor/cypress/e2e/relationship.cy.js index 4f9e4daa..ec25e895 100644 --- a/packages/editor/cypress/e2e/relationship.cy.js +++ b/packages/editor/cypress/e2e/relationship.cy.js @@ -2,15 +2,15 @@ context('Relationship Topics', () => { beforeEach(() => { cy.visit('/editor.html'); cy.reload(); - cy.get('[test-id="30-11-relationship"]').click({ force: true }); + cy.get('[test-id="30-11-relationship"]').first().click({ force: true }); }); it('Add Relationship', () => { - cy.contains('Features').click(); - cy.get(`[aria-label="Add Relationship"]`).click(); - cy.contains('Try it Now!').click(); + cy.contains('Features').first().click(); + cy.get(`[aria-label="Add Relationship"]`).first().click(); + cy.contains('Try it Now!').first().click(); - cy.get('[test-id="11-15-relationship"]').click({ force: true }); + cy.get('[test-id="11-15-relationship"]').first().click({ force: true }); cy.matchImageSnapshot('addRelationship'); }); diff --git a/packages/editor/cypress/e2e/topicFontChange.cy.js b/packages/editor/cypress/e2e/topicFontChange.cy.js index 67fd6551..a79996d1 100644 --- a/packages/editor/cypress/e2e/topicFontChange.cy.js +++ b/packages/editor/cypress/e2e/topicFontChange.cy.js @@ -16,32 +16,32 @@ context('Edit Topic', () => { it('Change Font Size', () => { // Go to the minimal size. - cy.get(`[aria-label="Font Style"]`).trigger('mouseover'); - cy.get(`[aria-label="Smaller"]`).click(); - cy.get(`[aria-label="Smaller"]`).click(); + cy.get(`[aria-label="Font Style"]`).first().trigger('mouseover'); + cy.get(`[aria-label="Smaller"]`).first().click(); + cy.get(`[aria-label="Smaller"]`).first().click(); // cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '8.1'); cy.matchImageSnapshot('changeFontSizeSmall'); - cy.get(`[aria-label="Font Style"]`).trigger('mouseover'); - cy.get(`[aria-label="Bigger"]`).click(); + cy.get(`[aria-label="Font Style"]`).first().trigger('mouseover'); + cy.get(`[aria-label="Bigger"]`).first().click(); // cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '10.8'); cy.matchImageSnapshot('changeFontSizeNormal'); - cy.get(`[aria-label="Font Style"]`).trigger('mouseover'); - cy.get(`[aria-label="Bigger"]`).click(); + cy.get(`[aria-label="Font Style"]`).first().trigger('mouseover'); + cy.get(`[aria-label="Bigger"]`).first().click(); // cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '13.4'); cy.matchImageSnapshot('changeFontSizeLarge'); - cy.get(`[aria-label="Font Style"]`).trigger('mouseover'); - cy.get(`[aria-label="Bigger"]`).click(); + cy.get(`[aria-label="Font Style"]`).first().trigger('mouseover'); + cy.get(`[aria-label="Bigger"]`).first().click(); // cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '20.2'); cy.matchImageSnapshot('changeFontSizeHuge'); // Can not scale it more. - cy.get(`[aria-label="Bigger"]`).click(); + cy.get(`[aria-label="Bigger"]`).first().click(); // cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '20.2'); cy.matchImageSnapshot('changeFontSizeHuge'); diff --git a/packages/editor/cypress/e2e/topicShape.cy.js b/packages/editor/cypress/e2e/topicShape.cy.js index d24f89ca..12c6ab97 100644 --- a/packages/editor/cypress/e2e/topicShape.cy.js +++ b/packages/editor/cypress/e2e/topicShape.cy.js @@ -6,8 +6,8 @@ context('Change Topic shape', () => { }); it('change to square shape', () => { - cy.get(`[aria-label="Topic Style"]`).trigger('mouseover'); - cy.get(`[aria-label="Rectangle shape"]`).click(); + cy.get(`[aria-label="Topic Style"]`).first().trigger('mouseover'); + cy.get(`[aria-label="Rectangle shape"]`).first().click(); cy.get('[test-id=11] > rect').eq(1).invoke('attr', 'rx').then(parseInt).should('be.a', 'number').should('eq', 0); @@ -17,8 +17,8 @@ context('Change Topic shape', () => { it('change to rounded rectangle', () => { cy.contains('Mind Mapping').click(); - cy.get(`[aria-label="Topic Style"]`).trigger('mouseover'); - cy.get(`[aria-label="Rounded shape"]`).click(); + cy.get(`[aria-label="Topic Style"]`).first().trigger('mouseover'); + cy.get(`[aria-label="Rounded shape"]`).first().click(); // Todo: Check how to validate this. Difference when it run in docker vs test:integration cy.get('[test-id=6] > rect').eq(1).invoke('attr', 'rx').then(parseInt).should('be.a', 'number').should('be.gte', 4); @@ -30,8 +30,8 @@ context('Change Topic shape', () => { it('change to line', () => { cy.contains('Try it Now!').click(); - cy.get(`[aria-label="Topic Style"]`).trigger('mouseover'); - cy.get(`[aria-label="Line shape"]`).click(); + cy.get(`[aria-label="Topic Style"]`).first().trigger('mouseover'); + cy.get(`[aria-label="Line shape"]`).first().click(); cy.matchImageSnapshot('changeToLine'); }); @@ -39,8 +39,8 @@ context('Change Topic shape', () => { it('change to ellipse shape', () => { cy.contains('Productivity').click(); - cy.get(`[aria-label="Topic Style"]`).trigger('mouseover'); - cy.get(`[aria-label="Ellipse shape"]`).click(); + cy.get(`[aria-label="Topic Style"]`).first().trigger('mouseover'); + cy.get(`[aria-label="Ellipse shape"]`).first().click(); // Todo: Check how to validate this. Difference when it run in docker vs test:integration cy.get('[test-id=2] > rect').eq(1).invoke('attr', 'rx').then(parseInt).should('be.a', 'number').should('be.gte', 12);