File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change 11import path from 'path' ;
22import SeleniumHelper from '../helpers/selenium-helper' ;
3+ import { StaleElementReferenceError } from 'selenium-webdriver/lib/error' ;
4+ import until from 'selenium-webdriver/lib/until' ;
35
46const {
57 clickText,
@@ -152,20 +154,16 @@ describe('Working with sprites', () => {
152154 } ) ;
153155
154156 test ( 'Use browser back button to close library' , async ( ) => {
155- await driver . get ( 'https://www.google.com' ) ;
156157 await loadUri ( uri ) ;
157158 await clickText ( 'Costumes' ) ;
158159 await clickXpath ( '//button[@aria-label="Choose a Sprite"]' ) ;
159160 const abbyElement = await findByText ( 'Abby' ) ; // Should show editor for new costume
160161 await elementIsVisible ( abbyElement ) ;
161162 await driver . navigate ( ) . back ( ) ;
162- try {
163- // should throw error because library is no longer visible
164- await elementIsVisible ( abbyElement ) ;
165- throw 'ShouldNotGetHere' ; // eslint-disable-line no-throw-literal
166- } catch ( e ) {
167- expect ( e . constructor . name ) . toEqual ( 'StaleElementReferenceError' ) ;
168- }
163+ // should throw error because library is no longer present
164+ await expect ( driver . wait ( until . elementIsVisible ( abbyElement ) ) )
165+ . rejects
166+ . toBeInstanceOf ( StaleElementReferenceError ) ;
169167 const costumesElement = await findByText ( 'Costumes' ) ; // Should show editor for new costume
170168 await elementIsVisible ( costumesElement ) ;
171169 const logs = await getLogs ( ) ;
You can’t perform that action at this time.
0 commit comments