From 0e51fb233c9a10368a589b9af6dbde05cbfee675 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Thu, 9 Jul 2020 12:01:14 -0300 Subject: [PATCH] Refactor webdriver method `verboseReportOnFailure` (#8948) The webdriver method `verboseReportOnFailure` had previously taken a single parameter, `test`, which was an object representing the current Mocha test. However, only one property was used (`title`). Instead the `title` is now passed through directly. This was done to make this function easier to use outside of a Mocha context. --- test/e2e/address-book.spec.js | 2 +- test/e2e/ethereum-on.spec.js | 2 +- test/e2e/from-import-ui.spec.js | 2 +- test/e2e/incremental-security.spec.js | 2 +- test/e2e/metamask-responsive-ui.spec.js | 2 +- test/e2e/metamask-ui.spec.js | 2 +- test/e2e/permissions.spec.js | 2 +- test/e2e/send-edit.spec.js | 2 +- test/e2e/signature-request.spec.js | 2 +- test/e2e/threebox.spec.js | 2 +- test/e2e/web3.spec.js | 2 +- test/e2e/webdriver/driver.js | 4 ++-- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/e2e/address-book.spec.js b/test/e2e/address-book.spec.js index 04ea4a14c..f9fc7d5be 100644 --- a/test/e2e/address-book.spec.js +++ b/test/e2e/address-book.spec.js @@ -43,7 +43,7 @@ describe('MetaMask', function () { } } if (this.currentTest.state === 'failed') { - await driver.verboseReportOnFailure(this.currentTest) + await driver.verboseReportOnFailure(this.currentTest.title) } }) diff --git a/test/e2e/ethereum-on.spec.js b/test/e2e/ethereum-on.spec.js index 19bcb9e5d..e7412ac68 100644 --- a/test/e2e/ethereum-on.spec.js +++ b/test/e2e/ethereum-on.spec.js @@ -42,7 +42,7 @@ describe('MetaMask', function () { } } if (this.currentTest.state === 'failed') { - await driver.verboseReportOnFailure(this.currentTest) + await driver.verboseReportOnFailure(this.currentTest.title) } }) diff --git a/test/e2e/from-import-ui.spec.js b/test/e2e/from-import-ui.spec.js index cb8da4a45..7a112c722 100644 --- a/test/e2e/from-import-ui.spec.js +++ b/test/e2e/from-import-ui.spec.js @@ -46,7 +46,7 @@ describe('Using MetaMask with an existing account', function () { } } if (this.currentTest.state === 'failed') { - await driver.verboseReportOnFailure(this.currentTest) + await driver.verboseReportOnFailure(this.currentTest.title) } }) diff --git a/test/e2e/incremental-security.spec.js b/test/e2e/incremental-security.spec.js index 7a3848925..82e3fc0e0 100644 --- a/test/e2e/incremental-security.spec.js +++ b/test/e2e/incremental-security.spec.js @@ -47,7 +47,7 @@ describe('MetaMask', function () { } } if (this.currentTest.state === 'failed') { - await driver.verboseReportOnFailure(this.currentTest) + await driver.verboseReportOnFailure(this.currentTest.title) } }) diff --git a/test/e2e/metamask-responsive-ui.spec.js b/test/e2e/metamask-responsive-ui.spec.js index 7e98e4227..c0c8fd35d 100644 --- a/test/e2e/metamask-responsive-ui.spec.js +++ b/test/e2e/metamask-responsive-ui.spec.js @@ -37,7 +37,7 @@ describe('MetaMask', function () { } } if (this.currentTest.state === 'failed') { - await driver.verboseReportOnFailure(this.currentTest) + await driver.verboseReportOnFailure(this.currentTest.title) } }) diff --git a/test/e2e/metamask-ui.spec.js b/test/e2e/metamask-ui.spec.js index 2e230e731..2b626d4c6 100644 --- a/test/e2e/metamask-ui.spec.js +++ b/test/e2e/metamask-ui.spec.js @@ -38,7 +38,7 @@ describe('MetaMask', function () { } } if (this.currentTest.state === 'failed') { - await driver.verboseReportOnFailure(this.currentTest) + await driver.verboseReportOnFailure(this.currentTest.title) } }) diff --git a/test/e2e/permissions.spec.js b/test/e2e/permissions.spec.js index 4785b4fe8..8ec86b3cb 100644 --- a/test/e2e/permissions.spec.js +++ b/test/e2e/permissions.spec.js @@ -42,7 +42,7 @@ describe('MetaMask', function () { } } if (this.currentTest.state === 'failed') { - await driver.verboseReportOnFailure(this.currentTest) + await driver.verboseReportOnFailure(this.currentTest.title) } }) diff --git a/test/e2e/send-edit.spec.js b/test/e2e/send-edit.spec.js index 48ee97cb0..c3e60f1c2 100644 --- a/test/e2e/send-edit.spec.js +++ b/test/e2e/send-edit.spec.js @@ -44,7 +44,7 @@ describe('Using MetaMask with an existing account', function () { } } if (this.currentTest.state === 'failed') { - await driver.verboseReportOnFailure(this.currentTest) + await driver.verboseReportOnFailure(this.currentTest.title) } }) diff --git a/test/e2e/signature-request.spec.js b/test/e2e/signature-request.spec.js index 76c0ec6a4..705c35778 100644 --- a/test/e2e/signature-request.spec.js +++ b/test/e2e/signature-request.spec.js @@ -41,7 +41,7 @@ describe('MetaMask', function () { } } if (this.currentTest.state === 'failed') { - await driver.verboseReportOnFailure(this.currentTest) + await driver.verboseReportOnFailure(this.currentTest.title) } }) diff --git a/test/e2e/threebox.spec.js b/test/e2e/threebox.spec.js index 46669f1df..e7affbfeb 100644 --- a/test/e2e/threebox.spec.js +++ b/test/e2e/threebox.spec.js @@ -45,7 +45,7 @@ describe('MetaMask', function () { } } if (this.currentTest.state === 'failed') { - await driver.verboseReportOnFailure(this.currentTest) + await driver.verboseReportOnFailure(this.currentTest.title) } }) diff --git a/test/e2e/web3.spec.js b/test/e2e/web3.spec.js index 7c2c4c5e5..4bcca74dd 100644 --- a/test/e2e/web3.spec.js +++ b/test/e2e/web3.spec.js @@ -44,7 +44,7 @@ describe('Using MetaMask with an existing account', function () { } } if (this.currentTest.state === 'failed') { - await driver.verboseReportOnFailure(this.currentTest) + await driver.verboseReportOnFailure(this.currentTest.title) } }) diff --git a/test/e2e/webdriver/driver.js b/test/e2e/webdriver/driver.js index c5cd917d4..8137093ba 100644 --- a/test/e2e/webdriver/driver.js +++ b/test/e2e/webdriver/driver.js @@ -172,8 +172,8 @@ class Driver { // Error handling - async verboseReportOnFailure (test) { - const artifactDir = `./test-artifacts/${this.browser}/${test.title}` + async verboseReportOnFailure (title) { + const artifactDir = `./test-artifacts/${this.browser}/${title}` const filepathBase = `${artifactDir}/test-failure` await fs.mkdir(artifactDir, { recursive: true }) const screenshot = await this.driver.takeScreenshot()