From 4b8a4fd5fe5816dc5d748436b5b1cd9fe7d5bdea Mon Sep 17 00:00:00 2001 From: kumavis Date: Wed, 13 Jun 2018 23:52:51 -0700 Subject: test - e2e - check for phishing warning --- test/e2e/beta/metamask-beta-ui.spec.js | 16 +++++++++++----- test/e2e/metamask.spec.js | 24 ++++++++++++++++-------- 2 files changed, 27 insertions(+), 13 deletions(-) (limited to 'test/e2e') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index ceeea31a5..0d304cf14 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -129,19 +129,25 @@ describe('MetaMask', function () { }) it('clicks through the privacy notice', async () => { - const nextScreen = await findElement(driver, By.css('.tou button')) - await nextScreen.click() - await delay(regularDelayMs) - + // terms of use const canClickThrough = await driver.findElement(By.css('.tou button')).isEnabled() assert.equal(canClickThrough, false, 'disabled continue button') const bottomOfTos = await findElement(driver, By.linkText('Attributions')) await driver.executeScript('arguments[0].scrollIntoView(true)', bottomOfTos) await delay(regularDelayMs) - const acceptTos = await findElement(driver, By.css('.tou button')) await acceptTos.click() 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 diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index a08a34d96..fb7e083c3 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -73,14 +73,6 @@ describe('Metamask popup page', function () { 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 () => { const terms = await driver.findElement(By.css('.terms-header')).getText() assert.equal(terms, 'TERMS OF USE', 'shows terms of use') @@ -100,6 +92,22 @@ describe('Metamask popup page', function () { 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 () => { const passwordBox = await driver.findElement(By.id('password-box')) const passwordBoxConfirm = await driver.findElement(By.id('password-box-confirm')) -- cgit v1.2.3 From 564bb9f6529b08ffd43c354edf640d64617a7493 Mon Sep 17 00:00:00 2001 From: kumavis Date: Thu, 14 Jun 2018 00:23:38 -0700 Subject: test - e2e - clear phishing warning --- test/e2e/beta/metamask-beta-ui.spec.js | 3 +++ test/e2e/metamask.spec.js | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'test/e2e') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index 0d304cf14..cf081e696 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -145,6 +145,9 @@ describe('MetaMask', function () { await delay(regularDelayMs) // phishing notice + const noticeElement = await driver.findElement(By.css('.markdown')) + await driver.executeScript('arguments[0].scrollTop = arguments[0].scrollHeight', noticeElement) + await delay(regularDelayMs) const nextScreen = await findElement(driver, By.css('.tou button')) await nextScreen.click() await delay(regularDelayMs) diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index fb7e083c3..b0a8fe411 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -71,6 +71,7 @@ describe('Metamask popup page', function () { it('matches MetaMask title', async () => { const title = await driver.getTitle() assert.equal(title, 'MetaMask', 'title matches MetaMask') + await delay(300) }) it('show terms of use', async () => { @@ -93,7 +94,6 @@ describe('Metamask popup page', function () { }) 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() @@ -104,6 +104,9 @@ describe('Metamask popup page', function () { await delay(300) const noticeHeader = await driver.findElement(By.css('.terms-header')).getText() assert.equal(noticeHeader, 'PHISHING WARNING', 'shows phishing warning') + const element = await driver.findElement(By.css('.markdown')) + await driver.executeScript('arguments[0].scrollTop = arguments[0].scrollHeight', element) + await delay(300) await driver.findElement(By.css('button')).click() await delay(300) }) -- cgit v1.2.3 From e95fed06b7162f380317e2a5dedfae5bc8a58e26 Mon Sep 17 00:00:00 2001 From: kumavis Date: Thu, 14 Jun 2018 00:36:14 -0700 Subject: test - e2e-beta - separate notice tests into individual tests --- test/e2e/beta/metamask-beta-ui.spec.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test/e2e') diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index cf081e696..d911b91ed 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -128,7 +128,7 @@ describe('MetaMask', function () { await delay(regularDelayMs) }) - it('clicks through the privacy notice', async () => { + it('clicks through the ToS', async () => { // terms of use const canClickThrough = await driver.findElement(By.css('.tou button')).isEnabled() assert.equal(canClickThrough, false, 'disabled continue button') @@ -138,12 +138,16 @@ describe('MetaMask', function () { const acceptTos = await findElement(driver, By.css('.tou button')) await acceptTos.click() await delay(regularDelayMs) + }) + it('clicks through the privacy notice', async () => { // privacy notice const nextScreen = await findElement(driver, By.css('.tou button')) await nextScreen.click() await delay(regularDelayMs) + }) + it('clicks through the phishing notice', async () => { // phishing notice const noticeElement = await driver.findElement(By.css('.markdown')) await driver.executeScript('arguments[0].scrollTop = arguments[0].scrollHeight', noticeElement) -- cgit v1.2.3 From c2afb7903522d87345f4a39f7ca3df8fa8889d53 Mon Sep 17 00:00:00 2001 From: kumavis Date: Thu, 14 Jun 2018 00:52:46 -0700 Subject: test - e2e-beta - from import - handle phishing warning --- test/e2e/beta/from-import-beta-ui.spec.js | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'test/e2e') diff --git a/test/e2e/beta/from-import-beta-ui.spec.js b/test/e2e/beta/from-import-beta-ui.spec.js index efae948f9..823c72a3a 100644 --- a/test/e2e/beta/from-import-beta-ui.spec.js +++ b/test/e2e/beta/from-import-beta-ui.spec.js @@ -134,19 +134,32 @@ describe('Using MetaMask with an existing account', function () { await delay(regularDelayMs) }) + it('clicks through the ToS', async () => { + // terms of use + const canClickThrough = await driver.findElement(By.css('.tou button')).isEnabled() + assert.equal(canClickThrough, false, 'disabled continue button') + const bottomOfTos = await findElement(driver, By.linkText('Attributions')) + await driver.executeScript('arguments[0].scrollIntoView(true)', bottomOfTos) + await delay(regularDelayMs) + const acceptTos = await findElement(driver, By.css('.tou button')) + await acceptTos.click() + await delay(regularDelayMs) + }) + it('clicks through the privacy notice', async () => { - const [nextScreen] = await findElements(driver, By.css('.tou button')) + // privacy notice + const nextScreen = await findElement(driver, By.css('.tou button')) await nextScreen.click() await delay(regularDelayMs) + }) - const canClickThrough = await driver.findElement(By.css('.tou button')).isEnabled() - assert.equal(canClickThrough, false, 'disabled continue button') - const element = await findElement(driver, By.linkText('Attributions')) - await driver.executeScript('arguments[0].scrollIntoView(true)', element) + it('clicks through the phishing notice', async () => { + // phishing notice + const noticeElement = await driver.findElement(By.css('.markdown')) + await driver.executeScript('arguments[0].scrollTop = arguments[0].scrollHeight', noticeElement) await delay(regularDelayMs) - - const acceptTos = await findElement(driver, By.xpath(`//button[contains(text(), 'Accept')]`)) - await acceptTos.click() + const nextScreen = await findElement(driver, By.css('.tou button')) + await nextScreen.click() await delay(regularDelayMs) }) }) -- cgit v1.2.3