1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

test - e2e - check for phishing warning

This commit is contained in:
kumavis 2018-06-13 23:52:51 -07:00
parent 44a8e48a04
commit 4b8a4fd5fe
4 changed files with 29 additions and 15 deletions

View File

@ -13,7 +13,7 @@ module.exports = class NoticeController extends EventEmitter {
this.firstVersion = opts.firstVersion this.firstVersion = opts.firstVersion
this.version = opts.version this.version = opts.version
const initState = extend({ const initState = extend({
noticesList: hardCodedNotices, noticesList: this._filterNotices(hardCodedNotices),
}, opts.initState) }, opts.initState)
this.store = new ObservableStore(initState) this.store = new ObservableStore(initState)
this.memStore = new ObservableStore({}) this.memStore = new ObservableStore({})

View File

@ -28,7 +28,7 @@ module.exports = [
id: 4, id: 4,
read: false, read: false,
date: 'Wed Jun 13 2018', date: 'Wed Jun 13 2018',
title: 'Concerning Recent Phishing Incidents', title: 'Phishing Warning',
body: fs.readFileSync(__dirname + '/archive/notice_4.md', 'utf8'), body: fs.readFileSync(__dirname + '/archive/notice_4.md', 'utf8'),
} }
] ]

View File

@ -129,19 +129,25 @@ describe('MetaMask', function () {
}) })
it('clicks through the privacy notice', async () => { it('clicks through the privacy notice', async () => {
const nextScreen = await findElement(driver, By.css('.tou button')) // terms of use
await nextScreen.click()
await delay(regularDelayMs)
const canClickThrough = await driver.findElement(By.css('.tou button')).isEnabled() const canClickThrough = await driver.findElement(By.css('.tou button')).isEnabled()
assert.equal(canClickThrough, false, 'disabled continue button') assert.equal(canClickThrough, false, 'disabled continue button')
const bottomOfTos = await findElement(driver, By.linkText('Attributions')) const bottomOfTos = await findElement(driver, By.linkText('Attributions'))
await driver.executeScript('arguments[0].scrollIntoView(true)', bottomOfTos) await driver.executeScript('arguments[0].scrollIntoView(true)', bottomOfTos)
await delay(regularDelayMs) await delay(regularDelayMs)
const acceptTos = await findElement(driver, By.css('.tou button')) const acceptTos = await findElement(driver, By.css('.tou button'))
await acceptTos.click() await acceptTos.click()
await delay(regularDelayMs) await delay(regularDelayMs)
// privacy notice
const nextScreen = await findElement(driver, By.css('.tou button'))
await nextScreen.click()
await delay(regularDelayMs)
// phishing notice
const nextScreen = await findElement(driver, By.css('.tou button'))
await nextScreen.click()
await delay(regularDelayMs)
}) })
let seedPhrase let seedPhrase

View File

@ -73,14 +73,6 @@ describe('Metamask popup page', function () {
assert.equal(title, 'MetaMask', 'title matches MetaMask') assert.equal(title, 'MetaMask', 'title matches MetaMask')
}) })
it('shows privacy notice', async () => {
await delay(300)
const privacy = await driver.findElement(By.css('.terms-header')).getText()
assert.equal(privacy, 'PRIVACY NOTICE', 'shows privacy notice')
await driver.findElement(By.css('button')).click()
await delay(300)
})
it('show terms of use', async () => { it('show terms of use', async () => {
const terms = await driver.findElement(By.css('.terms-header')).getText() const terms = await driver.findElement(By.css('.terms-header')).getText()
assert.equal(terms, 'TERMS OF USE', 'shows terms of use') assert.equal(terms, 'TERMS OF USE', 'shows terms of use')
@ -100,6 +92,22 @@ describe('Metamask popup page', function () {
await button.click() await button.click()
}) })
it('shows privacy notice', async () => {
await delay(300)
const privacy = await driver.findElement(By.css('.terms-header')).getText()
assert.equal(privacy, 'PRIVACY NOTICE', 'shows privacy notice')
await driver.findElement(By.css('button')).click()
await delay(300)
})
it('shows phishing notice', async () => {
await delay(300)
const noticeHeader = await driver.findElement(By.css('.terms-header')).getText()
assert.equal(noticeHeader, 'PHISHING WARNING', 'shows phishing warning')
await driver.findElement(By.css('button')).click()
await delay(300)
})
it('accepts password with length of eight', async () => { it('accepts password with length of eight', async () => {
const passwordBox = await driver.findElement(By.id('password-box')) const passwordBox = await driver.findElement(By.id('password-box'))
const passwordBoxConfirm = await driver.findElement(By.id('password-box-confirm')) const passwordBoxConfirm = await driver.findElement(By.id('password-box-confirm'))