From dca8e1c5beb6b68a642a5220890a2447dc0b96f8 Mon Sep 17 00:00:00 2001 From: Silviu Bogan Date: Thu, 9 Dec 2021 10:48:34 +0200 Subject: [PATCH] Correct Cypress tests to work with the new Slate-based Title blocks --- cypress/integration/block-basics.js | 19 ++++++++++--------- cypress/support/index.js | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cypress/integration/block-basics.js b/cypress/integration/block-basics.js index 454084c..4daed6d 100644 --- a/cypress/integration/block-basics.js +++ b/cypress/integration/block-basics.js @@ -5,16 +5,17 @@ describe('Blocks Tests', () => { afterEach(tearDownAfterEach); it('Add Block: Empty', () => { + // without this the clear command below does nothing sometimes + cy.wait(500); + // Change page title - cy.get('.documentFirstHeading > .public-DraftStyleDefault-block') - .clear() - .type('My Add-on Page') - .get('.documentFirstHeading span[data-text]') - .contains('My Add-on Page'); - - cy.get('.documentFirstHeading > .public-DraftStyleDefault-block').type( - '{enter}', - ); + cy.get('[contenteditable=true]').first().clear(); + + cy.get('[contenteditable=true]').first().type('My Add-on Page'); + + cy.get('.documentFirstHeading').contains('My Add-on Page'); + + cy.get('[contenteditable=true]').first().type('{enter}'); // Add block cy.get('.ui.basic.icon.button.block-add-button').first().click(); diff --git a/cypress/support/index.js b/cypress/support/index.js index a3fd935..89aab00 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -44,7 +44,7 @@ export const setupBeforeEach = () => { cy.waitForResourceToLoad('@types'); cy.waitForResourceToLoad('my-page'); cy.navigate('/cypress/my-page/edit'); - cy.get(`.block.title [data-contents]`); + cy.get(`.block.title h1`); }; export const tearDownAfterEach = () => {