@@ -289,13 +289,13 @@ describe('MetaMask', function () {
289289 } )
290290
291291 it ( 'finds the transaction in the transactions list' , async function ( ) {
292- const transactions = await findElements ( driver , By . css ( '.transaction-list-item' ) )
293- assert . equal ( transactions . length , 1 )
292+ await driver . wait ( async ( ) => {
293+ const confirmedTxes = await findElements ( driver , By . css ( '.transaction-list__completed-transactions .transaction-list-item' ) )
294+ return confirmedTxes . length === 1
295+ } , 10000 )
294296
295- if ( process . env . SELENIUM_BROWSER !== 'firefox' ) {
296- const txValues = await findElement ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
297- await driver . wait ( until . elementTextMatches ( txValues , / - 1 \s * E T H / ) , 10000 )
298- }
297+ const txValues = await findElement ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
298+ await driver . wait ( until . elementTextMatches ( txValues , / - 1 \s * E T H / ) , 10000 )
299299 } )
300300 } )
301301
@@ -332,13 +332,13 @@ describe('MetaMask', function () {
332332 } )
333333
334334 it ( 'finds the transaction in the transactions list' , async function ( ) {
335- const transactions = await findElements ( driver , By . css ( '.transaction-list-item' ) )
336- assert . equal ( transactions . length , 2 )
335+ await driver . wait ( async ( ) => {
336+ const confirmedTxes = await findElements ( driver , By . css ( '.transaction-list__completed-transactions .transaction-list-item' ) )
337+ return confirmedTxes . length === 2
338+ } , 10000 )
337339
338- if ( process . env . SELENIUM_BROWSER !== 'firefox' ) {
339- const txValues = await findElement ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
340- await driver . wait ( until . elementTextMatches ( txValues , / - 1 \s * E T H / ) , 10000 )
341- }
340+ const txValues = await findElement ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
341+ await driver . wait ( until . elementTextMatches ( txValues , / - 1 \s * E T H / ) , 10000 )
342342 } )
343343 } )
344344
@@ -385,13 +385,13 @@ describe('MetaMask', function () {
385385 } )
386386
387387 it ( 'finds the transaction in the transactions list' , async function ( ) {
388- const transactions = await findElements ( driver , By . css ( '.transaction-list-item' ) )
389- assert . equal ( transactions . length , 3 )
388+ await driver . wait ( async ( ) => {
389+ const confirmedTxes = await findElements ( driver , By . css ( '.transaction-list__completed-transactions .transaction-list-item' ) )
390+ return confirmedTxes . length === 3
391+ } , 10000 )
390392
391- if ( process . env . SELENIUM_BROWSER !== 'firefox' ) {
392- const txValues = await findElement ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
393- await driver . wait ( until . elementTextMatches ( txValues , / - 1 \s * E T H / ) , 10000 )
394- }
393+ const txValues = await findElement ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
394+ await driver . wait ( until . elementTextMatches ( txValues , / - 1 \s * E T H / ) , 10000 )
395395 } )
396396 } )
397397
@@ -838,12 +838,10 @@ describe('MetaMask', function () {
838838 it ( 'renders the correct ETH balance' , async ( ) => {
839839 const balance = await findElement ( driver , By . css ( '.transaction-view-balance__primary-balance' ) )
840840 await delay ( regularDelayMs )
841- if ( process . env . SELENIUM_BROWSER !== 'firefox' ) {
842- await driver . wait ( until . elementTextMatches ( balance , / ^ 8 7 .* \s * E T H .* $ / ) , 10000 )
843- const tokenAmount = await balance . getText ( )
844- assert . ok ( / ^ 8 7 .* \s * E T H .* $ / . test ( tokenAmount ) )
845- await delay ( regularDelayMs )
846- }
841+ await driver . wait ( until . elementTextMatches ( balance , / ^ 8 7 .* \s * E T H .* $ / ) , 10000 )
842+ const tokenAmount = await balance . getText ( )
843+ assert . ok ( / ^ 8 7 .* \s * E T H .* $ / . test ( tokenAmount ) )
844+ await delay ( regularDelayMs )
847845 } )
848846 } )
849847
@@ -1002,22 +1000,15 @@ describe('MetaMask', function () {
10021000 } )
10031001
10041002 it ( 'finds the transaction in the transactions list' , async function ( ) {
1005- const transactions = await findElements ( driver , By . css ( '.transaction-list-item' ) )
1006- assert . equal ( transactions . length , 1 )
1007-
1008- const txValues = await findElements ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
1009- assert . equal ( txValues . length , 1 )
1010-
1011- // test cancelled on firefox until https://github.com/mozilla/geckodriver/issues/906 is resolved,
1012- // or possibly until we use latest version of firefox in the tests
1013- if ( process . env . SELENIUM_BROWSER !== 'firefox' ) {
1014- await driver . wait ( until . elementTextMatches ( txValues [ 0 ] , / - 1 \s * T S T / ) , 10000 )
1015- }
1016-
10171003 await driver . wait ( async ( ) => {
10181004 const confirmedTxes = await findElements ( driver , By . css ( '.transaction-list__completed-transactions .transaction-list-item' ) )
10191005 return confirmedTxes . length === 1
10201006 } , 10000 )
1007+
1008+ const txValues = await findElements ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
1009+ assert . equal ( txValues . length , 1 )
1010+ await driver . wait ( until . elementTextMatches ( txValues [ 0 ] , / - 1 \s * T S T / ) , 10000 )
1011+
10211012 const txStatuses = await findElements ( driver , By . css ( '.transaction-list-item__action' ) )
10221013 await driver . wait ( until . elementTextMatches ( txStatuses [ 0 ] , / S e n t \s T o k e n / i) , 10000 )
10231014 } )
@@ -1104,7 +1095,6 @@ describe('MetaMask', function () {
11041095 return confirmedTxes . length === 2
11051096 } , 10000 )
11061097
1107- await delay ( regularDelayMs )
11081098 const txValues = await findElements ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
11091099 await driver . wait ( until . elementTextMatches ( txValues [ 0 ] , / - 1 .5 \s * T S T / ) )
11101100 const txStatuses = await findElements ( driver , By . css ( '.transaction-list-item__action' ) )
@@ -1115,14 +1105,10 @@ describe('MetaMask', function () {
11151105
11161106 const tokenListItems = await findElements ( driver , By . css ( '.token-list-item' ) )
11171107 await tokenListItems [ 0 ] . click ( )
1118- await delay ( regularDelayMs )
1108+ await delay ( 1000 )
11191109
1120- // test cancelled on firefox until https://github.com/mozilla/geckodriver/issues/906 is resolved,
1121- // or possibly until we use latest version of firefox in the tests
1122- if ( process . env . SELENIUM_BROWSER !== 'firefox' ) {
1123- const tokenBalanceAmount = await findElements ( driver , By . css ( '.transaction-view-balance__primary-balance' ) )
1124- await driver . wait ( until . elementTextMatches ( tokenBalanceAmount [ 0 ] , / 7 .5 0 0 \s * T S T / ) , 10000 )
1125- }
1110+ const tokenBalanceAmount = await findElements ( driver , By . css ( '.transaction-view-balance__primary-balance' ) )
1111+ await driver . wait ( until . elementTextMatches ( tokenBalanceAmount [ 0 ] , / 7 .5 0 0 \s * T S T / ) , 10000 )
11261112 } )
11271113 } )
11281114
@@ -1141,9 +1127,6 @@ describe('MetaMask', function () {
11411127 const transferTokens = await findElement ( driver , By . xpath ( `//button[contains(text(), 'Approve Tokens')]` ) )
11421128 await transferTokens . click ( )
11431129
1144- if ( process . env . SELENIUM_BROWSER !== 'firefox' ) {
1145- await closeAllWindowHandlesExcept ( driver , [ extension , dapp ] )
1146- }
11471130 await driver . switchTo ( ) . window ( extension )
11481131 await delay ( regularDelayMs )
11491132
@@ -1232,10 +1215,6 @@ describe('MetaMask', function () {
12321215 } )
12331216
12341217 it ( 'finds the transaction in the transactions list' , async function ( ) {
1235- if ( process . env . SELENIUM_BROWSER === 'firefox' ) {
1236- this . skip ( )
1237- }
1238-
12391218 await driver . wait ( async ( ) => {
12401219 const confirmedTxes = await findElements ( driver , By . css ( '.transaction-list__completed-transactions .transaction-list-item' ) )
12411220 return confirmedTxes . length === 3
@@ -1249,12 +1228,6 @@ describe('MetaMask', function () {
12491228 } )
12501229
12511230 describe ( 'Tranfers a custom token from dapp when no gas value is specified' , ( ) => {
1252- before ( function ( ) {
1253- if ( process . env . SELENIUM_BROWSER === 'firefox' ) {
1254- this . skip ( )
1255- }
1256- } )
1257-
12581231 it ( 'transfers an already created token, without specifying gas' , async ( ) => {
12591232 const windowHandles = await driver . getAllWindowHandles ( )
12601233 const extension = windowHandles [ 0 ]
@@ -1267,7 +1240,6 @@ describe('MetaMask', function () {
12671240 const transferTokens = await findElement ( driver , By . xpath ( `//button[contains(text(), 'Transfer Tokens Without Gas')]` ) )
12681241 await transferTokens . click ( )
12691242
1270- await closeAllWindowHandlesExcept ( driver , [ extension , dapp ] )
12711243 await driver . switchTo ( ) . window ( extension )
12721244 await delay ( regularDelayMs )
12731245
@@ -1304,12 +1276,6 @@ describe('MetaMask', function () {
13041276 } )
13051277
13061278 describe ( 'Approves a custom token from dapp when no gas value is specified' , ( ) => {
1307- before ( function ( ) {
1308- if ( process . env . SELENIUM_BROWSER === 'firefox' ) {
1309- this . skip ( )
1310- }
1311- } )
1312-
13131279 it ( 'approves an already created token' , async ( ) => {
13141280 const windowHandles = await driver . getAllWindowHandles ( )
13151281 const extension = windowHandles [ 0 ]
@@ -1323,7 +1289,6 @@ describe('MetaMask', function () {
13231289 const transferTokens = await findElement ( driver , By . xpath ( `//button[contains(text(), 'Approve Tokens Without Gas')]` ) )
13241290 await transferTokens . click ( )
13251291
1326- await closeAllWindowHandlesExcept ( driver , extension )
13271292 await driver . switchTo ( ) . window ( extension )
13281293 await delay ( regularDelayMs )
13291294
@@ -1346,7 +1311,7 @@ describe('MetaMask', function () {
13461311 } )
13471312
13481313 it ( 'submits the transaction' , async function ( ) {
1349- await delay ( regularDelayMs )
1314+ await delay ( 1000 )
13501315 const confirmButton = await findElement ( driver , By . xpath ( `//button[contains(text(), 'Confirm')]` ) )
13511316 await confirmButton . click ( )
13521317 await delay ( regularDelayMs )
0 commit comments