mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Testing timeouts
This commit is contained in:
parent
517be35ab6
commit
77e13640b4
1533
package-lock.json
generated
1533
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,6 @@ const path = require('path')
|
|||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const pify = require('pify')
|
const pify = require('pify')
|
||||||
const webdriver = require('selenium-webdriver')
|
const webdriver = require('selenium-webdriver')
|
||||||
const until = require('selenium-webdriver/lib/until')
|
|
||||||
const By = webdriver.By
|
const By = webdriver.By
|
||||||
const { delay, buildChromeWebDriver, buildFirefoxWebdriver, installWebExt, getExtensionIdChrome, getExtensionIdFirefox } = require('./func')
|
const { delay, buildChromeWebDriver, buildFirefoxWebdriver, installWebExt, getExtensionIdChrome, getExtensionIdFirefox } = require('./func')
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ describe('Metamask popup page', function () {
|
|||||||
const extPath = path.resolve('dist/firefox')
|
const extPath = path.resolve('dist/firefox')
|
||||||
driver = buildFirefoxWebdriver()
|
driver = buildFirefoxWebdriver()
|
||||||
await installWebExt(driver, extPath)
|
await installWebExt(driver, extPath)
|
||||||
await delay(500)
|
await delay(700)
|
||||||
extensionId = await getExtensionIdFirefox(driver)
|
extensionId = await getExtensionIdFirefox(driver)
|
||||||
await driver.get(`moz-extension://${extensionId}/popup.html`)
|
await driver.get(`moz-extension://${extensionId}/popup.html`)
|
||||||
}
|
}
|
||||||
@ -42,19 +41,17 @@ describe('Metamask popup page', function () {
|
|||||||
|
|
||||||
describe('Setup', function () {
|
describe('Setup', function () {
|
||||||
|
|
||||||
it('switches to extension/addon list', async function () {
|
it('switches to Chrome extensions list', async function () {
|
||||||
await driver.wait(async () => {
|
await delay(300)
|
||||||
await until.urlContains('#how-it-works')
|
const windowHandles = await driver.getAllWindowHandles()
|
||||||
const tabs = await driver.getAllWindowHandles()
|
await driver.switchTo().window(windowHandles[0])
|
||||||
await driver.switchTo().window(tabs[0])
|
|
||||||
return true
|
|
||||||
}, 300)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('sets provider type to localhost', async function () {
|
it('sets provider type to localhost', async function () {
|
||||||
await delay(300)
|
await delay(300)
|
||||||
await setProviderType('localhost')
|
await setProviderType('localhost')
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Account Creation', () => {
|
describe('Account Creation', () => {
|
||||||
@ -73,11 +70,9 @@ describe('Metamask popup page', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('show terms of use', async () => {
|
it('show terms of use', async () => {
|
||||||
await driver.wait(async () => {
|
const terms = await driver.findElement(By.css('#app-content > div > div.app-primary.from-right > div > div.flex-column.flex-center.flex-grow > h3')).getText()
|
||||||
const terms = await driver.findElement(By.css('#app-content > div > div.app-primary.from-right > div > div.flex-column.flex-center.flex-grow > h3')).getText()
|
assert.equal(terms, 'TERMS OF USE', 'shows terms of use')
|
||||||
assert.equal(terms, 'TERMS OF USE', 'shows terms of use')
|
delay(300)
|
||||||
return terms === 'TERMS OF USE'
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('checks if the TOU button is disabled', async () => {
|
it('checks if the TOU button is disabled', async () => {
|
||||||
@ -85,13 +80,12 @@ describe('Metamask popup page', function () {
|
|||||||
assert.equal(button, false, 'disabled continue button')
|
assert.equal(button, false, 'disabled continue button')
|
||||||
const element = await driver.findElement(By.linkText('Attributions'))
|
const element = await driver.findElement(By.linkText('Attributions'))
|
||||||
await driver.executeScript('arguments[0].scrollIntoView(true)', element)
|
await driver.executeScript('arguments[0].scrollIntoView(true)', element)
|
||||||
await delay(300)
|
await delay(700)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('allows the button to be clicked when scrolled to the bottom of TOU', async () => {
|
it('allows the button to be clicked when scrolled to the bottom of TOU', async () => {
|
||||||
const button = await driver.findElement(By.css('#app-content > div > div.app-primary.from-right > div > div.flex-column.flex-center.flex-grow > button'))
|
const button = await driver.findElement(By.css('#app-content > div > div.app-primary.from-right > div > div.flex-column.flex-center.flex-grow > button'))
|
||||||
const buttonEnabled = await driver.wait(until.elementIsEnabled(button))
|
await button.click()
|
||||||
await buttonEnabled.click()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('accepts password with length of eight', async () => {
|
it('accepts password with length of eight', async () => {
|
||||||
@ -269,6 +263,7 @@ describe('Metamask popup page', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('Add Token', function () {
|
describe('Add Token', function () {
|
||||||
|
|
||||||
it('switches to the add token screen', async function () {
|
it('switches to the add token screen', async function () {
|
||||||
const tokensTab = await driver.findElement(By.css('#app-content > div > div.app-primary.from-right > div > section > div > div.inactiveForm.pointer'))
|
const tokensTab = await driver.findElement(By.css('#app-content > div > div.app-primary.from-right > div > section > div > div.inactiveForm.pointer'))
|
||||||
assert.equal(await tokensTab.getText(), 'TOKENS')
|
assert.equal(await tokensTab.getText(), 'TOKENS')
|
||||||
@ -306,7 +301,12 @@ describe('Metamask popup page', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function verboseReportOnFailure (test) {
|
async function verboseReportOnFailure (test) {
|
||||||
const artifactDir = `./test-artifacts/chrome/${test.title}`
|
let artifactDir
|
||||||
|
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
||||||
|
artifactDir = `./test-artifacts/chrome/${test.title}`
|
||||||
|
} else if (process.env.SELENIUM_BROWSER === 'firefox') {
|
||||||
|
artifactDir = `./test-artifacts/firefox/${test.title}`
|
||||||
|
}
|
||||||
const filepathBase = `${artifactDir}/test-failure`
|
const filepathBase = `${artifactDir}/test-failure`
|
||||||
await pify(mkdirp)(artifactDir)
|
await pify(mkdirp)(artifactDir)
|
||||||
// capture screenshot
|
// capture screenshot
|
||||||
|
Loading…
x
Reference in New Issue
Block a user