mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Move initial e2e navitation into individual tests (#9979)
The e2e test driver used to perform the initial navigation automatically within the `buildWebDriver` function, so that that step wouldn't need to be repeated at the beginning of each test. However this prevented you from doing any setup in the test before the first navigation. The navigation has now been moved into each individual test. It should be functionally equivalent, except now it's possible to control exactly when the first navigation occurs. A 1 second delay was also removed, as it didn't seem to be necessary when testing this. It was initially added as an attempted fix to an intermittent failure. It did not fix that failure.
This commit is contained in:
parent
52d25f0df8
commit
7a2b3b908a
@ -29,6 +29,7 @@ describe('MetaMask', function () {
|
||||
})
|
||||
const result = await buildWebDriver()
|
||||
driver = result.driver
|
||||
await driver.navigate()
|
||||
})
|
||||
|
||||
afterEach(async function () {
|
||||
|
@ -13,6 +13,7 @@ const ALL_PAGES = Object.values(PAGES)
|
||||
async function measurePage(pageName) {
|
||||
let metrics
|
||||
await withFixtures({ fixtures: 'imported-account' }, async ({ driver }) => {
|
||||
await driver.navigate()
|
||||
const passwordField = await driver.findElement(By.css('#password'))
|
||||
await passwordField.sendKeys('correct horse battery staple')
|
||||
await passwordField.sendKeys(Key.ENTER)
|
||||
|
@ -28,6 +28,7 @@ describe('MetaMask', function () {
|
||||
})
|
||||
const result = await buildWebDriver()
|
||||
driver = result.driver
|
||||
await driver.navigate()
|
||||
})
|
||||
|
||||
afterEach(async function () {
|
||||
|
@ -35,6 +35,7 @@ describe('Using MetaMask with an existing account', function () {
|
||||
})
|
||||
const result = await buildWebDriver()
|
||||
driver = result.driver
|
||||
await driver.navigate()
|
||||
})
|
||||
|
||||
afterEach(async function () {
|
||||
|
@ -33,6 +33,7 @@ describe('MetaMask', function () {
|
||||
})
|
||||
const result = await buildWebDriver()
|
||||
driver = result.driver
|
||||
await driver.navigate()
|
||||
})
|
||||
|
||||
afterEach(async function () {
|
||||
|
@ -22,6 +22,7 @@ describe('MetaMask', function () {
|
||||
await ganacheServer.start()
|
||||
const result = await buildWebDriver({ responsive: true })
|
||||
driver = result.driver
|
||||
await driver.navigate()
|
||||
})
|
||||
|
||||
afterEach(async function () {
|
||||
|
@ -23,6 +23,7 @@ describe('MetaMask', function () {
|
||||
await ganacheServer.start()
|
||||
const result = await buildWebDriver()
|
||||
driver = result.driver
|
||||
await driver.navigate()
|
||||
})
|
||||
|
||||
afterEach(async function () {
|
||||
|
@ -27,6 +27,7 @@ describe('Segment metrics', function () {
|
||||
mockSegment: true,
|
||||
},
|
||||
async ({ driver, segmentSpy }) => {
|
||||
await driver.navigate()
|
||||
const passwordField = await driver.findElement(By.css('#password'))
|
||||
await passwordField.sendKeys('correct horse battery staple')
|
||||
await passwordField.sendKeys(Key.ENTER)
|
||||
|
@ -28,6 +28,7 @@ describe('MetaMask', function () {
|
||||
})
|
||||
const result = await buildWebDriver()
|
||||
driver = result.driver
|
||||
await driver.navigate()
|
||||
})
|
||||
|
||||
afterEach(async function () {
|
||||
|
@ -30,6 +30,7 @@ describe('Using MetaMask with an existing account', function () {
|
||||
})
|
||||
const result = await buildWebDriver()
|
||||
driver = result.driver
|
||||
await driver.navigate()
|
||||
})
|
||||
|
||||
afterEach(async function () {
|
||||
|
@ -28,6 +28,7 @@ describe('MetaMask', function () {
|
||||
publicAddress = '0x5cfe73b6021e818b776b421b1c4db2474086a7e1'
|
||||
const result = await buildWebDriver()
|
||||
driver = result.driver
|
||||
await driver.navigate()
|
||||
})
|
||||
|
||||
afterEach(async function () {
|
||||
|
@ -16,6 +16,7 @@ describe('Localization', function () {
|
||||
await withFixtures(
|
||||
{ fixtures: 'localization', ganacheOptions, title: this.test.title },
|
||||
async ({ driver }) => {
|
||||
await driver.navigate()
|
||||
const passwordField = await driver.findElement(By.css('#password'))
|
||||
await passwordField.sendKeys('correct horse battery staple')
|
||||
await passwordField.sendKeys(Key.ENTER)
|
||||
|
@ -21,6 +21,7 @@ describe('Personal sign', function () {
|
||||
title: this.test.title,
|
||||
},
|
||||
async ({ driver }) => {
|
||||
await driver.navigate()
|
||||
const passwordField = await driver.findElement(By.css('#password'))
|
||||
await passwordField.sendKeys('correct horse battery staple')
|
||||
await passwordField.sendKeys(Key.ENTER)
|
||||
|
@ -15,6 +15,7 @@ describe('Simple send', function () {
|
||||
await withFixtures(
|
||||
{ fixtures: 'imported-account', ganacheOptions, title: this.test.title },
|
||||
async ({ driver }) => {
|
||||
await driver.navigate()
|
||||
const passwordField = await driver.findElement(By.css('#password'))
|
||||
await passwordField.sendKeys('correct horse battery staple')
|
||||
await passwordField.sendKeys(Key.ENTER)
|
||||
|
@ -31,6 +31,7 @@ describe('MetaMask', function () {
|
||||
})
|
||||
const result = await buildWebDriver({ port: await getPort() })
|
||||
driver = result.driver
|
||||
await driver.navigate()
|
||||
})
|
||||
|
||||
afterEach(async function () {
|
||||
@ -189,6 +190,7 @@ describe('MetaMask', function () {
|
||||
before(async function () {
|
||||
const result = await buildWebDriver({ port: await getPort() })
|
||||
driver2 = result.driver
|
||||
await driver2.navigate()
|
||||
})
|
||||
|
||||
after(async function () {
|
||||
|
@ -15,9 +15,6 @@ async function buildWebDriver({ responsive, port } = {}) {
|
||||
} = await buildBrowserWebDriver(browser, { extensionPath, responsive, port })
|
||||
await setupFetchMocking(seleniumDriver)
|
||||
const driver = new Driver(seleniumDriver, browser, extensionUrl)
|
||||
await driver.navigate()
|
||||
|
||||
await driver.delay(1000)
|
||||
|
||||
return {
|
||||
driver,
|
||||
|
Loading…
Reference in New Issue
Block a user