Skip to content

Commit

Permalink
Fixes intermittent error in cypress "Index Text Block" test
Browse files Browse the repository at this point in the history
Waits for the slate editor to be visible before attempting to insert
text. Also checks if text has been inserted.
  • Loading branch information
wesleybl committed Feb 14, 2025
1 parent 2599c72 commit f2199b1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/volto/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,16 @@ Cypress.Commands.add(
},
);

Cypress.Commands.add('getSlateEditorAndType', (type) => {
cy.getSlate().focus().click().type(type);
Cypress.Commands.add('getSlateEditorAndType', (text) => {
cy.getSlate()
.should('be.visible')
.focus()
.click()
.type(text)
.then(($editor) => {
// Checks if text has been rendered in the editor.
cy.wrap($editor).should('contain.text', text);
});
});

Cypress.Commands.add('getSlateEditorSelectorAndType', (selector, type) => {
Expand Down

0 comments on commit f2199b1

Please sign in to comment.