File tree Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ class TargetHighlight extends React.Component {
3232 vm
3333 } = this . props ;
3434
35- if ( ! ( highlightedTargetId && vm && vm . renderer ) ) return null ;
35+ if ( ! ( highlightedTargetId && vm && vm . renderer &&
36+ vm . runtime . getTargetById ( highlightedTargetId ) ) ) return null ;
3637
3738 const target = vm . runtime . getTargetById ( highlightedTargetId ) ;
3839 const bounds = vm . renderer . getBounds ( target . drawableID ) ;
Original file line number Diff line number Diff line change 1+ import path from 'path' ;
2+ import SeleniumHelper from '../helpers/selenium-helper' ;
3+
4+ const {
5+ clickText,
6+ clickXpath,
7+ rightClickText,
8+ getDriver,
9+ getLogs,
10+ loadUri,
11+ scope
12+ } = new SeleniumHelper ( ) ;
13+
14+ const uri = path . resolve ( __dirname , '../../build/index.html' ) ;
15+
16+ let driver ;
17+
18+ describe ( 'Loading scratch gui' , ( ) => {
19+ beforeAll ( ( ) => {
20+ driver = getDriver ( ) ;
21+ } ) ;
22+
23+ afterAll ( async ( ) => {
24+ await driver . quit ( ) ;
25+ } ) ;
26+
27+ test ( 'Switching small/large stage after highlighting and deleting sprite' , async ( ) => {
28+ await loadUri ( uri ) ;
29+ await clickXpath ( '//button[@title="Try It"]' ) ;
30+
31+ // Highlight the sprite
32+ await clickText ( 'Sprite1' , scope . spriteTile ) ;
33+
34+ // Delete it
35+ await rightClickText ( 'Sprite1' , scope . spriteTile ) ;
36+ await clickText ( 'delete' , scope . spriteTile ) ;
37+
38+ // Go to small stage mode
39+ await clickXpath ( '//img[@alt="Switch to small stage"]' ) ;
40+
41+ // Confirm app still working
42+ await clickXpath ( '//img[@alt="Switch to large stage"]' ) ;
43+
44+ const logs = await getLogs ( ) ;
45+ await expect ( logs ) . toEqual ( [ ] ) ;
46+ } ) ;
47+ } ) ;
You can’t perform that action at this time.
0 commit comments