@@ -95,100 +95,69 @@ describe('GUI mode', () => {
9595 } ) ;
9696 } ) ;
9797
98- describe ( 'Screenshot accept/undo hotkeys' , ( ) => {
98+ describe ( 'Screenshot accept/undo hotkeys on Suites page ' , ( ) => {
9999 beforeEach ( async ( { browser} ) => {
100- await browser . keys ( 'v ' ) ;
100+ await browser . keys ( 's ' ) ;
101101
102- const visualChecksTitle = await browser . $ ( '[data-qa="sidebar-title"]' ) ;
103- await expect ( visualChecksTitle ) . toHaveText ( 'Visual Checks ' ) ;
102+ const suitesTitle = await browser . $ ( '[data-qa="sidebar-title"]' ) ;
103+ await expect ( suitesTitle ) . toHaveText ( 'Suites ' ) ;
104104 } ) ;
105105
106- it ( 'should accept screenshot with "a" key and auto-advance to next' , async ( { browser} ) => {
107- const failedTab = await browser . $ ( '[title="Failed"]' ) ;
108- await failedTab . click ( ) ;
109-
110- await browser . waitUntil ( async ( ) => {
111- const items = await browser . $$ ( '[data-qa="tree-view-item"]' ) ;
112- return items . length > 0 ;
113- } ) ;
106+ it ( 'should accept all visible with "shift+a" key' , async ( { browser} ) => {
107+ await browser . keys ( [ 'Shift' , 'a' ] ) ;
114108
115- const initialTitle = await browser . $ ( 'h2' ) ;
116- const initialText = await initialTitle . getText ( ) ;
109+ await waitForFsChanges ( screensDir ) ;
117110
118- const acceptButton = await browser . $ ( '[data-qa="accept-button "]' ) ;
119- const isAcceptAvailable = await acceptButton . isExisting ( ) ;
111+ const failedTab = await browser . $ ( '[title="Failed "]' ) ;
112+ await failedTab . click ( ) ;
120113
121- if ( isAcceptAvailable ) {
122- await browser . keys ( 'a' ) ;
114+ const failedItems = await browser . $$ ( '[data-qa="tree-view-item"]' ) ;
115+ expect ( failedItems . length ) . toBe ( 0 ) ;
116+ } ) ;
117+ } ) ;
123118
124- await waitForFsChanges ( screensDir ) ;
119+ describe ( 'Screenshot accept/undo hotkeys on Visual Checks page' , ( ) => {
120+ beforeEach ( async ( { browser} ) => {
121+ await browser . keys ( 'v' ) ;
125122
126- await browser . waitUntil ( async ( ) => {
127- const title = await browser . $ ( 'h2' ) ;
128- const text = await title . getText ( ) ;
129- return text !== initialText ;
130- } , { timeout : 5000 , timeoutMsg : 'Did not auto-advance to next screenshot' } ) ;
131- }
123+ const visualChecksTitle = await browser . $ ( '[data-qa="sidebar-title"]' ) ;
124+ await expect ( visualChecksTitle ) . toHaveText ( 'Visual Checks' ) ;
132125 } ) ;
133126
134- it ( 'should undo accept with "u" key' , async ( { browser} ) => {
135- const failedTab = await browser . $ ( '[title="Failed"]' ) ;
136- await failedTab . click ( ) ;
137-
127+ it ( 'should accept screenshot with "a" key and auto-advance to next' , async ( { browser} ) => {
138128 await browser . waitUntil ( async ( ) => {
139129 const items = await browser . $$ ( '[data-qa="tree-view-item"]' ) ;
140130 return items . length > 0 ;
141131 } ) ;
142132
143- const acceptButton = await browser . $ ( '[data-qa="accept-button"]' ) ;
144- const isAcceptAvailable = await acceptButton . isExisting ( ) ;
145-
146- if ( isAcceptAvailable ) {
147- await acceptButton . click ( ) ;
148- await waitForFsChanges ( screensDir ) ;
149-
150- await browser . keys ( 'ArrowUp' ) ;
151-
152- const undoButton = await browser . $ ( '[data-qa="undo-button"]' ) ;
153- await browser . waitUntil ( async ( ) => await undoButton . isExisting ( ) ) ;
154-
155- await browser . keys ( 'u' ) ;
133+ const initialTitle = await browser . $ ( 'h2' ) ;
134+ const initialText = await initialTitle . getText ( ) ;
156135
157- await waitForFsChanges ( screensDir , ( output ) => output . length === 0 ) ;
136+ await browser . keys ( 'a' ) ;
158137
159- const acceptButtonAfterUndo = await browser . $ ( '[data-qa="accept-button"]' ) ;
160- await expect ( acceptButtonAfterUndo ) . toBeDisplayed ( ) ;
161- }
162- } ) ;
138+ await browser . pause ( 5000 ) ;
163139
164- it ( 'should accept all visible with "shift+a" key' , async ( { browser} ) => {
165- const failedTab = await browser . $ ( '[title="Failed"]' ) ;
166- await failedTab . click ( ) ;
140+ await waitForFsChanges ( screensDir ) ;
167141
168142 await browser . waitUntil ( async ( ) => {
169- const items = await browser . $$ ( '[data-qa="tree-view-item"]' ) ;
170- return items . length > 0 ;
171- } ) ;
172-
173- const failedItems = await browser . $$ ( '[data-qa="tree-view-item"]' ) ;
174- const failedCount = failedItems . length ;
143+ const title = await browser . $ ( 'h2' ) ;
144+ const text = await title . getText ( ) ;
145+ return text !== initialText ;
146+ } , { timeout : 5000 , timeoutMsg : 'Did not auto-advance to next screenshot' } ) ;
147+ } ) ;
175148
176- if ( failedCount > 0 ) {
177- await browser . keys ( [ 'Shift' , 'a' ] ) ;
149+ it ( 'should undo accept with "u" key' , async ( { browser} ) => {
150+ await browser . keys ( 'a' ) ;
151+ await waitForFsChanges ( screensDir ) ;
178152
179- await waitForFsChanges ( screensDir ) ;
153+ await browser . keys ( 'ArrowUp' ) ;
180154
181- const passedTab = await browser . $ ( '[title="Passed "]' ) ;
182- await passedTab . click ( ) ;
155+ const undoButton = await browser . $ ( '[data-qa="undo-button "]' ) ;
156+ await browser . waitUntil ( async ( ) => await undoButton . isExisting ( ) ) ;
183157
184- await browser . waitUntil ( async ( ) => {
185- const items = await browser . $$ ( '[data-qa="tree-view-item"]' ) ;
186- return items . length > 0 ;
187- } ) ;
158+ await browser . keys ( 'u' ) ;
188159
189- const passedItems = await browser . $$ ( '[data-qa="tree-view-item"]' ) ;
190- expect ( passedItems . length ) . toBeGreaterThan ( 0 ) ;
191- }
160+ await waitForFsChanges ( screensDir , ( output ) => output . length === 0 ) ;
192161 } ) ;
193162 } ) ;
194163
0 commit comments