Skip to content

Commit

Permalink
Reuse menu automation helpers across all test cases
Browse files Browse the repository at this point in the history
No more nth-child() selectors!
  • Loading branch information
1j01 committed Mar 1, 2024
1 parent 98bc205 commit eef07b6
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions cypress/integration/visual-tests.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,33 +116,29 @@ context('visual tests', () => {
});

it('flip and rotate window', () => {
// @TODO: make menus more testable, with IDs
cy.get('.menu-button[id^="menu-button-&Image"]').click();
cy.get('.menu-popup[aria-labelledby^="menu-button-&Image"] tr:nth-child(1)').click();
clickMenuButton('Image');
clickMenuItem('Flip/Rotate');
cy.get('.window:visible').matchImageSnapshot(withMuchTextCompareOptions);
});

it('stretch and skew window', () => {
// @TODO: make menus more testable, with IDs
cy.get('.menu-button[id^="menu-button-&Image"]').click();
cy.get('.menu-popup[aria-labelledby^="menu-button-&Image"] tr:nth-child(2)').click();
clickMenuButton('Image');
clickMenuItem('Stretch/Skew');
// @TODO: wait for images to load and include images?
cy.get('.window:visible').matchImageSnapshot(Object.assign({}, withTextCompareOptions, { blackout: ["img"] }));
});

it('help window', () => {
// @TODO: make menus more testable, with IDs
cy.get('.menu-button[id^="menu-button-&Help"]').click();
cy.get('.menu-popup[aria-labelledby^="menu-button-&Help"] tr:nth-child(1)').click();
clickMenuButton('Help');
clickMenuItem('Help Topics');
cy.get('.window:visible .folder', { timeout: 10000 }); // wait for sidebar contents to load
// @TODO: wait for iframe to load
cy.get('.window:visible').matchImageSnapshot(Object.assign({}, withTextCompareOptions, { blackout: ["iframe"] }));
});

it('about window', () => {
// @TODO: make menus more testable, with IDs
cy.get('.menu-button[id^="menu-button-&Help"]').click();
cy.get('.menu-popup[aria-labelledby^="menu-button-&Help"] tr:nth-child(3)').click();
clickMenuButton('Help');
clickMenuItem('About Paint');
cy.get('.window:visible').matchImageSnapshot(Object.assign({}, withMuchTextCompareOptions, { blackout: ["img", "#maybe-outdated-line"] }));
});

Expand Down

0 comments on commit eef07b6

Please sign in to comment.