diff --git a/e2e/01_new_user/02_creation.spec.ts b/e2e/01_new_user/02_creation.spec.ts new file mode 100644 index 0000000000..a1c7afe702 --- /dev/null +++ b/e2e/01_new_user/02_creation.spec.ts @@ -0,0 +1,38 @@ +import { expect } from 'detox' +import jestExpect from 'expect' +import { readVisibleText } from 'e2e/utils' + +describe('Identity Creation', () => { + describe('Entropy Screen', () => { + let entropyMsg: Detox.DetoxAny + let progressRegexp = /(\d+) %/ + + beforeAll(async () => { + const getStarted = element(by.id('getStarted')) + await getStarted.tap() + entropyMsg = element(by.id('entropyMsg')) + }) + + it('should show an entropyMsg help text at first', async () => { + await expect(entropyMsg).toBeVisible() + const text = await readVisibleText('entropyMsg') + jestExpect(text).not.toMatch(progressRegexp) + }) + + it('should show a percentage of entropy collected on swipe in scratchArea', async () => { + const scratchArea = element(by.id('scratchArea')) + await scratchArea.swipe('right', 'slow') + const text = await readVisibleText('entropyMsg') + jestExpect(text).toMatch(progressRegexp) + + const swipeDirs: Detox.Direction[] = ['up', 'down', 'left', 'right'] + for (let progress = 0; progress < 100; ) { + const text = await readVisibleText('entropyMsg') + const match = progressRegexp.exec(text) + jestExpect(match).toHaveLength(2) + progress = parseInt((match as Array)[1]) + await scratchArea.swipe(swipeDirs[progress % 4], 'fast') + } + }) + }) +}) diff --git a/src/ui/registration/components/entropy.tsx b/src/ui/registration/components/entropy.tsx index 70ce7c7768..1e13709aa6 100644 --- a/src/ui/registration/components/entropy.tsx +++ b/src/ui/registration/components/entropy.tsx @@ -47,8 +47,8 @@ export const EntropyComponent: React.SFC = props => { return ( - {msg} - + {msg} + diff --git a/src/ui/registration/containers/progress.tsx b/src/ui/registration/containers/progress.tsx index f29c724f02..ca7af93acc 100644 --- a/src/ui/registration/containers/progress.tsx +++ b/src/ui/registration/containers/progress.tsx @@ -60,7 +60,7 @@ export const RegistrationProgressContainer: React.FunctionComponent< {I18n.t(strings.GIVE_US_A_FEW_MOMENTS)} {I18n.t(strings.TO_SET_UP_YOUR_IDENTITY)} - + - + {props.loadingMsg}