@@ -13,6 +13,7 @@ describe('Test Snap manageState', function () {
1313 } ,
1414 ] ,
1515 } ;
16+
1617 await withFixtures (
1718 {
1819 fixtures : 'imported-account' ,
@@ -29,13 +30,18 @@ describe('Test Snap manageState', function () {
2930 await driver . fill ( '#password' , 'correct horse battery staple' ) ;
3031 await driver . press ( '#password' , driver . Key . ENTER ) ;
3132
32- // navigate to test snaps page and connect
33+ // navigate to test snaps page, then fill in the snapId
3334 await driver . driver . get ( TEST_SNAPS_WEBSITE_URL ) ;
34- await driver . fill ( '.snapId3' , 'npm:@metamask/test-snap-managestate' ) ;
35- await driver . clickElement ( {
36- text : 'Connect manageState Snap' ,
37- tag : 'button' ,
38- } ) ;
35+ await driver . delay ( 1000 ) ;
36+ await driver . fill ( '#snapId4' , 'npm:@metamask/test-snap-managestate' ) ;
37+
38+ // find and scroll to the rest of the card
39+ const snapButton = await driver . findElement ( '#snapId4' ) ;
40+ await driver . scrollToElement ( snapButton ) ;
41+ await driver . delay ( 500 ) ;
42+
43+ // connect the snap
44+ await driver . clickElement ( '#connectManageState' ) ;
3945
4046 // switch to metamask extension and click connect
4147 await driver . waitUntilXWindowHandles ( 2 , 5000 , 10000 ) ;
@@ -51,7 +57,6 @@ describe('Test Snap manageState', function () {
5157 } ,
5258 10000 ,
5359 ) ;
54-
5560 await driver . delay ( 2000 ) ;
5661
5762 // approve install of snap
@@ -70,67 +75,46 @@ describe('Test Snap manageState', function () {
7075 await driver . waitUntilXWindowHandles ( 1 , 5000 , 10000 ) ;
7176 windowHandles = await driver . getAllWindowHandles ( ) ;
7277 await driver . switchToWindowWithTitle ( 'Test Snaps' , windowHandles ) ;
73- await driver . fill ( '.dataManageState' , '23' ) ;
74- await driver . clickElement ( {
75- text : 'Send data to manageState Snap' ,
76- tag : 'button' ,
77- } ) ;
78+ await driver . fill ( '#dataManageState' , '23' ) ;
79+ await driver . clickElement ( '#sendManageState' ) ;
7880
7981 // check the results of the public key test
80- await driver . delay ( 2000 ) ;
82+ await driver . delay ( 500 ) ;
8183 const manageStateResult = await driver . findElement (
82- '. sendManageStateResult' ,
84+ '# sendManageStateResult' ,
8385 ) ;
8486 assert . equal ( await manageStateResult . getText ( ) , 'true' ) ;
8587
8688 // click get results
87- await driver . waitUntilXWindowHandles ( 1 , 5000 , 10000 ) ;
88- windowHandles = await driver . getAllWindowHandles ( ) ;
89- await driver . switchToWindowWithTitle ( 'Test Snaps' , windowHandles ) ;
90- await driver . clickElement ( {
91- text : 'Get data from manageState Snap' ,
92- tag : 'button' ,
93- } ) ;
89+ await driver . clickElement ( '#retrieveManageState' ) ;
9490
9591 // check the results
96- await driver . delay ( 2000 ) ;
92+ await driver . delay ( 500 ) ;
9793 const retrieveManageStateResult = await driver . findElement (
98- '. retrieveManageStateResult' ,
94+ '# retrieveManageStateResult' ,
9995 ) ;
10096 assert . equal (
10197 await retrieveManageStateResult . getText ( ) ,
10298 '{"testState":["23"]}' ,
10399 ) ;
104100
105101 // click clear results
106- await driver . waitUntilXWindowHandles ( 1 , 5000 , 10000 ) ;
107- windowHandles = await driver . getAllWindowHandles ( ) ;
108- await driver . switchToWindowWithTitle ( 'Test Snaps' , windowHandles ) ;
109- await driver . clickElement ( {
110- text : 'Clear data of manageState Snap' ,
111- tag : 'button' ,
112- } ) ;
102+ await driver . clickElement ( '#clearManageState' ) ;
113103
114104 // check if true
115- await driver . delay ( 2000 ) ;
105+ await driver . delay ( 500 ) ;
116106 const clearManageStateResult = await driver . findElement (
117- '. clearManageStateResult' ,
107+ '# clearManageStateResult' ,
118108 ) ;
119109 assert . equal ( await clearManageStateResult . getText ( ) , 'true' ) ;
120110
121111 // click get results again
122- await driver . waitUntilXWindowHandles ( 1 , 5000 , 10000 ) ;
123- windowHandles = await driver . getAllWindowHandles ( ) ;
124- await driver . switchToWindowWithTitle ( 'Test Snaps' , windowHandles ) ;
125- await driver . clickElement ( {
126- text : 'Get data from manageState Snap' ,
127- tag : 'button' ,
128- } ) ;
112+ await driver . clickElement ( '#retrieveManageState' ) ;
129113
130114 // check result array is empty
131- await driver . delay ( 2000 ) ;
115+ await driver . delay ( 500 ) ;
132116 const retrieveManageStateResult2 = await driver . findElement (
133- '. retrieveManageStateResult' ,
117+ '# retrieveManageStateResult' ,
134118 ) ;
135119 assert . equal (
136120 await retrieveManageStateResult2 . getText ( ) ,
0 commit comments