-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(creation): e2e tests for identity creation
- Loading branch information
Showing
3 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<string>)[1]) | ||
await scratchArea.swipe(swipeDirs[progress % 4], 'fast') | ||
} | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters