1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Add verbose reporting on failure to withFixtures (#8949)

The e2e test helper function `withFixtures` now includes verbose
reporting on failure. Whenever a test fails, debugging information will
be saved to disk, just as with the other e2e test modules.
This commit is contained in:
Mark Stacey 2020-07-09 12:42:56 -03:00 committed by GitHub
parent 85f884c641
commit 478ed72a21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 15 deletions

View File

@ -8,7 +8,7 @@ const regularDelayMs = tinyDelayMs * 2
const largeDelayMs = regularDelayMs * 2
async function withFixtures (options, callback) {
const { fixtures, ganacheOptions, driverOptions } = options
const { fixtures, ganacheOptions, driverOptions, title } = options
const fixtureServer = new FixtureServer()
const ganacheServer = new Ganache()
@ -32,6 +32,9 @@ async function withFixtures (options, callback) {
throw new Error(errorMessage)
}
}
} catch (error) {
await webDriver.verboseReportOnFailure(title)
throw error
} finally {
await fixtureServer.stop()
await ganacheServer.quit()

View File

@ -11,19 +11,22 @@ describe('MetaMask Browser Extension', function () {
},
],
}
await withFixtures({ fixtures: 'imported-account', ganacheOptions }, async ({ driver }) => {
const passwordField = await driver.findElement(By.css('#password'))
await passwordField.sendKeys('correct horse battery staple')
await passwordField.sendKeys(Key.ENTER)
await driver.clickElement(By.css('[data-testid="eth-overview-send"]'))
const recipientAddressField = await driver.findElement(By.css('[data-testid="ens-input"]'))
await recipientAddressField.sendKeys('0x985c30949c92df7a0bd42e0f3e3d539ece98db24')
const amountField = await driver.findElement(By.css('.unit-input__input'))
await amountField.sendKeys('1')
await driver.clickElement(By.css('[data-testid="page-container-footer-next"]'))
await driver.clickElement(By.css('[data-testid="page-container-footer-next"]'))
await driver.clickElement(By.css('[data-testid="home__activity-tab"]'))
await driver.findElement(By.css('.transaction-list-item'))
})
await withFixtures(
{ fixtures: 'imported-account', ganacheOptions, title: this.test.title },
async ({ driver }) => {
const passwordField = await driver.findElement(By.css('#password'))
await passwordField.sendKeys('correct horse battery staple')
await passwordField.sendKeys(Key.ENTER)
await driver.clickElement(By.css('[data-testid="eth-overview-send"]'))
const recipientAddressField = await driver.findElement(By.css('[data-testid="ens-input"]'))
await recipientAddressField.sendKeys('0x985c30949c92df7a0bd42e0f3e3d539ece98db24')
const amountField = await driver.findElement(By.css('.unit-input__input'))
await amountField.sendKeys('1')
await driver.clickElement(By.css('[data-testid="page-container-footer-next"]'))
await driver.clickElement(By.css('[data-testid="page-container-footer-next"]'))
await driver.clickElement(By.css('[data-testid="home__activity-tab"]'))
await driver.findElement(By.css('.transaction-list-item'))
}
)
})
})