Skip to content

Commit eef07b6

Browse files
committed
Reuse menu automation helpers across all test cases
No more nth-child() selectors!
1 parent 98bc205 commit eef07b6

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

cypress/integration/visual-tests.spec.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,33 +116,29 @@ context('visual tests', () => {
116116
});
117117

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

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

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

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

0 commit comments

Comments
 (0)