Skip to content

Commit

Permalink
Fix table Cypress tests against Wagtail 4.2
Browse files Browse the repository at this point in the history
The Wagtail 4.2 release made changes to how the StreamField block UI
is rendered, which broke our table-related Cypress tests that relied on
a particular DOM structure.

This commit fixes those tests. To verify, run a local server and run:

`yarn cypress run --spec=test/cypress/integration/admin/admin.cy.js`
  • Loading branch information
chosak committed Nov 29, 2023
1 parent fd0209c commit 3389c6a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/cypress/integration/admin/admin-helpers.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,15 @@ export class AdminPage {
}

clickBlock(name) {
const block = `.action-add-block-${name}`;
cy.get(block).scrollIntoView();
cy.get(block).should('be.visible');
return cy.get(block).click();
const addBlockButton = cy.get(
'div[data-contentpath="content"] .c-sf-add-button',
);
addBlockButton.should('be.visible');
addBlockButton.click();

const addTableOption = cy.contains('div.w-combobox__option', 'Table');
addTableOption.should('be.visible');
return addTableOption.click();
}

addTable() {
Expand Down

0 comments on commit 3389c6a

Please sign in to comment.