From f7aea9597bdd27e5cc91a12807ede50f4f88fa84 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Tue, 14 Jan 2020 15:21:02 -0400 Subject: [PATCH] `await` all clicks during e2e tests (#7815) The `.click()` function returns a Promise, as it needs to communicate with the browser and ensure the click was successfully sent. --- test/e2e/address-book.spec.js | 8 ++++---- test/e2e/ethereum-on.spec.js | 6 +++--- test/e2e/from-import-ui.spec.js | 6 +++--- test/e2e/incremental-security.spec.js | 6 +++--- test/e2e/metamask-responsive-ui.spec.js | 6 +++--- test/e2e/metamask-ui.spec.js | 12 ++++++------ test/e2e/permissions.spec.js | 6 +++--- test/e2e/send-edit.spec.js | 6 +++--- test/e2e/threebox.spec.js | 16 ++++++++-------- test/e2e/web3.spec.js | 6 +++--- 10 files changed, 39 insertions(+), 39 deletions(-) diff --git a/test/e2e/address-book.spec.js b/test/e2e/address-book.spec.js index d3cadf169..1ce1635f8 100644 --- a/test/e2e/address-book.spec.js +++ b/test/e2e/address-book.spec.js @@ -56,19 +56,19 @@ describe('MetaMask', function () { it('clicks the continue button on the welcome screen', async () => { await driver.findElement(By.css('.welcome-page__header')) const welcomeScreenBtn = await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`)) - welcomeScreenBtn.click() + await welcomeScreenBtn.click() await driver.delay(largeDelayMs) }) it('clicks the "Create New Wallet" option', async () => { const customRpcButton = await driver.findElement(By.xpath(`//button[contains(text(), 'Create a Wallet')]`)) - customRpcButton.click() + await customRpcButton.click() await driver.delay(largeDelayMs) }) it('clicks the "No thanks" option on the metametrics opt-in screen', async () => { const optOutButton = await driver.findElement(By.css('.btn-default')) - optOutButton.click() + await optOutButton.click() await driver.delay(largeDelayMs) }) @@ -161,7 +161,7 @@ describe('MetaMask', function () { await passwordInputs[0].sendKeys('correct horse battery staple') await passwordInputs[1].sendKeys('correct horse battery staple') const restoreButton = await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.restore.message}')]`)) - restoreButton.click() + await restoreButton.click() await driver.delay(regularDelayMs) }) diff --git a/test/e2e/ethereum-on.spec.js b/test/e2e/ethereum-on.spec.js index 41a5f5c22..0347bee9e 100644 --- a/test/e2e/ethereum-on.spec.js +++ b/test/e2e/ethereum-on.spec.js @@ -55,19 +55,19 @@ describe('MetaMask', function () { it('clicks the continue button on the welcome screen', async () => { await driver.findElement(By.css('.welcome-page__header')) const welcomeScreenBtn = await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`)) - welcomeScreenBtn.click() + await welcomeScreenBtn.click() await driver.delay(largeDelayMs) }) it('clicks the "Create New Wallet" option', async () => { const customRpcButton = await driver.findElement(By.xpath(`//button[contains(text(), 'Create a Wallet')]`)) - customRpcButton.click() + await customRpcButton.click() await driver.delay(largeDelayMs) }) it('clicks the "No thanks" option on the metametrics opt-in screen', async () => { const optOutButton = await driver.findElement(By.css('.btn-default')) - optOutButton.click() + await optOutButton.click() await driver.delay(largeDelayMs) }) diff --git a/test/e2e/from-import-ui.spec.js b/test/e2e/from-import-ui.spec.js index 3f1b68e73..d5fa0684c 100644 --- a/test/e2e/from-import-ui.spec.js +++ b/test/e2e/from-import-ui.spec.js @@ -60,19 +60,19 @@ describe('Using MetaMask with an existing account', function () { it('clicks the continue button on the welcome screen', async () => { await driver.findElement(By.css('.welcome-page__header')) const welcomeScreenBtn = await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`)) - welcomeScreenBtn.click() + await welcomeScreenBtn.click() await driver.delay(largeDelayMs) }) it('clicks the "Import Wallet" option', async () => { const customRpcButton = await driver.findElement(By.xpath(`//button[contains(text(), 'Import Wallet')]`)) - customRpcButton.click() + await customRpcButton.click() await driver.delay(largeDelayMs) }) it('clicks the "No thanks" option on the metametrics opt-in screen', async () => { const optOutButton = await driver.findElement(By.css('.btn-default')) - optOutButton.click() + await optOutButton.click() await driver.delay(largeDelayMs) }) diff --git a/test/e2e/incremental-security.spec.js b/test/e2e/incremental-security.spec.js index 0b75653c2..f3708c1e1 100644 --- a/test/e2e/incremental-security.spec.js +++ b/test/e2e/incremental-security.spec.js @@ -60,19 +60,19 @@ describe('MetaMask', function () { it('clicks the continue button on the welcome screen', async () => { await driver.findElement(By.css('.welcome-page__header')) const welcomeScreenBtn = await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`)) - welcomeScreenBtn.click() + await welcomeScreenBtn.click() await driver.delay(largeDelayMs) }) it('clicks the "Create New Wallet" option', async () => { const customRpcButton = await driver.findElement(By.xpath(`//button[contains(text(), 'Create a Wallet')]`)) - customRpcButton.click() + await customRpcButton.click() await driver.delay(largeDelayMs) }) it('clicks the "No thanks" option on the metametrics opt-in screen', async () => { const optOutButton = await driver.findElement(By.css('.btn-default')) - optOutButton.click() + await optOutButton.click() await driver.delay(largeDelayMs) }) diff --git a/test/e2e/metamask-responsive-ui.spec.js b/test/e2e/metamask-responsive-ui.spec.js index d014011a2..8f991579c 100644 --- a/test/e2e/metamask-responsive-ui.spec.js +++ b/test/e2e/metamask-responsive-ui.spec.js @@ -50,19 +50,19 @@ describe('MetaMask', function () { it('clicks the continue button on the welcome screen', async () => { await driver.findElement(By.css('.welcome-page__header')) const welcomeScreenBtn = await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`)) - welcomeScreenBtn.click() + await welcomeScreenBtn.click() await driver.delay(largeDelayMs) }) it('clicks the "Create New Wallet" option', async () => { const customRpcButton = await driver.findElement(By.xpath(`//button[contains(text(), 'Create a Wallet')]`)) - customRpcButton.click() + await customRpcButton.click() await driver.delay(largeDelayMs) }) it('clicks the "I agree" option on the metametrics opt-in screen', async () => { const optOutButton = await driver.findElement(By.css('.btn-primary')) - optOutButton.click() + await optOutButton.click() await driver.delay(largeDelayMs) }) diff --git a/test/e2e/metamask-ui.spec.js b/test/e2e/metamask-ui.spec.js index 047865e8a..b0eea8703 100644 --- a/test/e2e/metamask-ui.spec.js +++ b/test/e2e/metamask-ui.spec.js @@ -51,19 +51,19 @@ describe('MetaMask', function () { it('clicks the continue button on the welcome screen', async () => { await driver.findElement(By.css('.welcome-page__header')) const welcomeScreenBtn = await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`)) - welcomeScreenBtn.click() + await welcomeScreenBtn.click() await driver.delay(largeDelayMs) }) it('clicks the "Create New Wallet" option', async () => { const customRpcButton = await driver.findElement(By.xpath(`//button[contains(text(), 'Create a Wallet')]`)) - customRpcButton.click() + await customRpcButton.click() await driver.delay(largeDelayMs) }) it('clicks the "No thanks" option on the metametrics opt-in screen', async () => { const optOutButton = await driver.findElement(By.css('.btn-default')) - optOutButton.click() + await optOutButton.click() await driver.delay(largeDelayMs) }) @@ -196,7 +196,7 @@ describe('MetaMask', function () { describe('Import seed phrase', () => { it('logs out of the vault', async () => { const accountMenuButton = await driver.findElement(By.css('.account-menu__icon')) - accountMenuButton.click() + await accountMenuButton.click() await driver.delay(regularDelayMs) const logoutButton = await driver.findElement(By.css('.account-menu__logout-button')) @@ -406,7 +406,7 @@ describe('MetaMask', function () { await driver.delay(regularDelayMs) const settingsButton = await driver.findElement(By.xpath(`//div[contains(text(), 'Settings')]`)) - settingsButton.click() + await settingsButton.click() // await driver.findElement(By.css('.tab-bar')) @@ -989,7 +989,7 @@ describe('MetaMask', function () { assert(confirmDataText.match(/0xa9059cbb0000000000000000000000002f318c334780961fb129d2a6c30d0763d9a5c97/)) const detailsTab = await driver.findElement(By.xpath(`//li[contains(text(), 'Details')]`)) - detailsTab.click() + await detailsTab.click() await driver.delay(regularDelayMs) }) diff --git a/test/e2e/permissions.spec.js b/test/e2e/permissions.spec.js index bb15dfab6..780a8f5d7 100644 --- a/test/e2e/permissions.spec.js +++ b/test/e2e/permissions.spec.js @@ -55,19 +55,19 @@ describe('MetaMask', function () { it('clicks the continue button on the welcome screen', async () => { await driver.findElement(By.css('.welcome-page__header')) const welcomeScreenBtn = await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`)) - welcomeScreenBtn.click() + await welcomeScreenBtn.click() await driver.delay(largeDelayMs) }) it('clicks the "Create New Wallet" option', async () => { const customRpcButton = await driver.findElement(By.xpath(`//button[contains(text(), 'Create a Wallet')]`)) - customRpcButton.click() + await customRpcButton.click() await driver.delay(largeDelayMs) }) it('clicks the "No thanks" option on the metametrics opt-in screen', async () => { const optOutButton = await driver.findElement(By.css('.btn-default')) - optOutButton.click() + await optOutButton.click() await driver.delay(largeDelayMs) }) diff --git a/test/e2e/send-edit.spec.js b/test/e2e/send-edit.spec.js index 6bad4494d..1f8ed96bb 100644 --- a/test/e2e/send-edit.spec.js +++ b/test/e2e/send-edit.spec.js @@ -57,19 +57,19 @@ describe('Using MetaMask with an existing account', function () { it('clicks the continue button on the welcome screen', async () => { await driver.findElement(By.css('.welcome-page__header')) const welcomeScreenBtn = await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`)) - welcomeScreenBtn.click() + await welcomeScreenBtn.click() await driver.delay(largeDelayMs) }) it('clicks the "Import Wallet" option', async () => { const customRpcButton = await driver.findElement(By.xpath(`//button[contains(text(), 'Import Wallet')]`)) - customRpcButton.click() + await customRpcButton.click() await driver.delay(largeDelayMs) }) it('clicks the "No thanks" option on the metametrics opt-in screen', async () => { const optOutButton = await driver.findElement(By.css('.btn-default')) - optOutButton.click() + await optOutButton.click() await driver.delay(largeDelayMs) }) diff --git a/test/e2e/threebox.spec.js b/test/e2e/threebox.spec.js index a9599f887..a7c8c18fe 100644 --- a/test/e2e/threebox.spec.js +++ b/test/e2e/threebox.spec.js @@ -60,19 +60,19 @@ describe('MetaMask', function () { it('clicks the continue button on the welcome screen', async () => { await driver.findElement(By.css('.welcome-page__header')) const welcomeScreenBtn = await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`)) - welcomeScreenBtn.click() + await welcomeScreenBtn.click() await driver.delay(largeDelayMs) }) it('clicks the "Import Wallet" option', async () => { const customRpcButton = await driver.findElement(By.xpath(`//button[contains(text(), 'Import Wallet')]`)) - customRpcButton.click() + await customRpcButton.click() await driver.delay(largeDelayMs) }) it('clicks the "No thanks" option on the metametrics opt-in screen', async () => { const optOutButton = await driver.findElement(By.css('.btn-default')) - optOutButton.click() + await optOutButton.click() await driver.delay(largeDelayMs) }) @@ -115,7 +115,7 @@ describe('MetaMask', function () { await driver.delay(regularDelayMs) const settingsButton = await driver.findElement(By.xpath(`//div[contains(text(), 'Settings')]`)) - settingsButton.click() + await settingsButton.click() }) it('turns on threebox syncing', async () => { @@ -183,19 +183,19 @@ describe('MetaMask', function () { it('clicks the continue button on the welcome screen', async () => { await driver2.findElement(By.css('.welcome-page__header')) const welcomeScreenBtn = await driver2.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`)) - welcomeScreenBtn.click() + await welcomeScreenBtn.click() await driver2.delay(largeDelayMs) }) it('clicks the "Import Wallet" option', async () => { const customRpcButton = await driver2.findElement(By.xpath(`//button[contains(text(), 'Import Wallet')]`)) - customRpcButton.click() + await customRpcButton.click() await driver2.delay(largeDelayMs) }) it('clicks the "No thanks" option on the metametrics opt-in screen', async () => { const optOutButton = await driver2.findElement(By.css('.btn-default')) - optOutButton.click() + await optOutButton.click() await driver2.delay(largeDelayMs) }) @@ -244,7 +244,7 @@ describe('MetaMask', function () { await driver.delay(regularDelayMs) const settingsButton = await driver.findElement(By.xpath(`//div[contains(text(), 'Settings')]`)) - settingsButton.click() + await settingsButton.click() }) it('finds the blockies toggle turned on', async () => { diff --git a/test/e2e/web3.spec.js b/test/e2e/web3.spec.js index b7704e463..0f2c25262 100644 --- a/test/e2e/web3.spec.js +++ b/test/e2e/web3.spec.js @@ -56,19 +56,19 @@ describe('Using MetaMask with an existing account', function () { it('clicks the continue button on the welcome screen', async () => { await driver.findElement(By.css('.welcome-page__header')) const welcomeScreenBtn = await driver.findElement(By.xpath(`//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`)) - welcomeScreenBtn.click() + await welcomeScreenBtn.click() await driver.delay(largeDelayMs) }) it('clicks the "Import Wallet" option', async () => { const customRpcButton = await driver.findElement(By.xpath(`//button[contains(text(), 'Import Wallet')]`)) - customRpcButton.click() + await customRpcButton.click() await driver.delay(largeDelayMs) }) it('clicks the "No thanks" option on the metametrics opt-in screen', async () => { const optOutButton = await driver.findElement(By.css('.btn-default')) - optOutButton.click() + await optOutButton.click() await driver.delay(largeDelayMs) })