From bf7b9612226a7e8eaa594a02edc3f2bb483d6712 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Mon, 6 Feb 2023 09:57:32 -0600 Subject: [PATCH] More e2e tests (create account) (#150) --- e2e/tests/happyPath.test.js | 55 +++++++++++++++++++---- src/view/com/onboard/FeatureExplainer.tsx | 8 +++- src/view/com/onboard/Follows.tsx | 4 +- 3 files changed, 55 insertions(+), 12 deletions(-) diff --git a/e2e/tests/happyPath.test.js b/e2e/tests/happyPath.test.js index 6835fb6ca4..b63a284c55 100644 --- a/e2e/tests/happyPath.test.js +++ b/e2e/tests/happyPath.test.js @@ -1,12 +1,27 @@ /* eslint-env detox/detox */ describe('Example', () => { - async function grantAccessToUserWithValidCredentials(username) { + async function grantAccessToUserWithValidCredentials( + username, + {takeScreenshots} = {takeScreenshots: false}, + ) { await element(by.id('signInButton')).tap() + if (takeScreenshots) { + await device.takeScreenshot('1- opened sign-in screen') + } await element(by.id('loginSelectServiceButton')).tap() + if (takeScreenshots) { + await device.takeScreenshot('2- opened service selector') + } await element(by.id('localDevServerButton')).tap() + if (takeScreenshots) { + await device.takeScreenshot('3- selected local dev server') + } await element(by.id('loginUsernameInput')).typeText(username) await element(by.id('loginPasswordInput')).typeText('hunter2') + if (takeScreenshots) { + await device.takeScreenshot('4- entered username and password') + } await element(by.id('loginNextButton')).tap() } @@ -16,23 +31,47 @@ describe('Example', () => { await device.launchApp({permissions: {notifications: 'YES'}}) }) - it('As a user, I can see the login screen', async () => { - await expect(element(by.id('signInButton'))).toBeVisible() - }) - it('As Alice, I can login', async () => { - await grantAccessToUserWithValidCredentials('alice') - await device.takeScreenshot('opened general section') + await expect(element(by.id('signInButton'))).toBeVisible() + await grantAccessToUserWithValidCredentials('alice', { + takeScreenshots: true, + }) + await device.takeScreenshot('5- opened home screen') }) it('As Alice, I can login, and post a text', async () => { await grantAccessToUserWithValidCredentials('alice') await element(by.id('composePromptButton')).tap() + await device.takeScreenshot('1- opened composer') await element(by.id('composerTextInput')).typeText( 'Greetings earthlings, I come in peace... and to run some tests.', ) + await device.takeScreenshot('2- entered text') await element(by.id('composerPublishButton')).tap() - await device.takeScreenshot('opened general section') + await device.takeScreenshot('3- opened general section') await expect(element(by.id('composePromptButton'))).toBeVisible() }) + + it('I can create a new account', async () => { + await element(by.id('createAccountButton')).tap() + await device.takeScreenshot('1- opened create account screen') + await element(by.id('registerSelectServiceButton')).tap() + await device.takeScreenshot('2- opened service selector') + await element(by.id('localDevServerButton')).tap() + await device.takeScreenshot('3- selected local dev server') + await element(by.id('registerEmailInput')).typeText('example@test.com') + await element(by.id('registerPasswordInput')).typeText('hunter2') + await element(by.id('registerHandleInput')).typeText('e2e-test') + await element(by.id('registerIs13Input')).tap() + await device.takeScreenshot('4- entered account details') + await element(by.id('createAccountButton')).tap() + await expect(element(by.id('onboardFeatureExplainerSkipBtn'))).toBeVisible() + await expect(element(by.id('onboardFeatureExplainerNextBtn'))).toBeVisible() + await device.takeScreenshot('5- onboard feature explainer') + await element(by.id('onboardFeatureExplainerSkipBtn')).tap() + await expect(element(by.id('onboardFollowsSkipBtn'))).toBeVisible() + await expect(element(by.id('onboardFollowsNextBtn'))).toBeVisible() + await device.takeScreenshot('6- onboard follows recommender') + await element(by.id('onboardFollowsSkipBtn')).tap() + }) }) diff --git a/src/view/com/onboard/FeatureExplainer.tsx b/src/view/com/onboard/FeatureExplainer.tsx index 03e050883e..24152396cd 100644 --- a/src/view/com/onboard/FeatureExplainer.tsx +++ b/src/view/com/onboard/FeatureExplainer.tsx @@ -121,11 +121,15 @@ export const FeatureExplainer = () => { )} - + Skip - + Next diff --git a/src/view/com/onboard/Follows.tsx b/src/view/com/onboard/Follows.tsx index ae3e1f8c8a..cb6c746a1f 100644 --- a/src/view/com/onboard/Follows.tsx +++ b/src/view/com/onboard/Follows.tsx @@ -22,11 +22,11 @@ export const Follows = observer(() => { - + Skip - + Next