-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frontend: desktop e2e onboarding test
- Loading branch information
Showing
12 changed files
with
1,195 additions
and
1,125 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
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
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,86 @@ | ||
import {Page, test, expect} from '@playwright/test' | ||
import {alias, bio, electronApp} from './test-setup' | ||
|
||
let page: Page | ||
|
||
test('Onboarding', async () => { | ||
page = await electronApp.firstWindow() | ||
|
||
await page.waitForSelector('[role=heading]') | ||
// const text = await page.$eval( | ||
// '[data-testid="step-title"]', | ||
// (el) => el.textContent, | ||
// ) | ||
const welcomeTitles = await page.getByRole('heading').allTextContents() | ||
expect(welcomeTitles).toEqual(['Welcome to', 'Mintter']) | ||
|
||
await page.getByRole('button', {name: 'NEXT'}).click() | ||
|
||
// Mnemonics Step | ||
const mnemonicsTitles = await page.getByRole('heading').allTextContents() | ||
expect(mnemonicsTitles).toEqual(['Your Keys.', 'Your Data.']) | ||
const mnemonics = await page.getByTestId('mnemonics') | ||
expect(mnemonics).toBeVisible() | ||
|
||
// check prev button | ||
expect(await page.getByRole('button', {name: 'PREV'})).toBeVisible() | ||
expect(await page.getByRole('button', {name: 'PREV'})).not.toBeDisabled() | ||
|
||
// check if the mnemonics are the correct amount of words | ||
let text = (await mnemonics.allTextContents())[0] | ||
let words = text?.split(', ') | ||
expect(words).toHaveLength(12) | ||
|
||
// toggle own seed textarea | ||
await page.getByTestId('ownseed-btn').click() | ||
const textarea = await page.getByPlaceholder('food barrel buzz ...') | ||
expect(textarea).toBeVisible() | ||
await page.getByTestId('ownseed-btn').click({force: true}) | ||
|
||
// continue to next step | ||
await page.getByRole('button', {name: 'NEXT'}).click() | ||
|
||
// check Profile step title | ||
const profileTitles = await page.getByRole('heading').allTextContents() | ||
expect(profileTitles).toEqual(['Profile', 'Information']) | ||
|
||
// check profile alias input | ||
let inputAlias = await page.getByPlaceholder( | ||
`Readable alias or username. Doesn't have to be unique.`, | ||
) | ||
expect(inputAlias).toBeVisible() | ||
await inputAlias.type(alias) | ||
|
||
// check profile bio input | ||
let inputBio = await page.getByPlaceholder(`A little bit about yourself...`) | ||
expect(inputBio).toBeVisible() | ||
await inputBio.type(bio) | ||
|
||
// check prev button | ||
expect(await page.getByRole('button', {name: 'PREV'})).toBeVisible() | ||
expect(await page.getByRole('button', {name: 'PREV'})).not.toBeDisabled() | ||
|
||
// continue to next step | ||
await page.getByRole('button', {name: 'NEXT'}).click() | ||
|
||
await page.waitForTimeout(10) | ||
// check Analytics step title | ||
const analyticsTitles = await page.getByRole('heading').allTextContents() | ||
expect(analyticsTitles).toEqual(['Crash', 'Analytics']) | ||
|
||
// check prev button | ||
expect(await page.getByRole('button', {name: 'PREV'})).toBeVisible() | ||
expect(await page.getByRole('button', {name: 'PREV'})).not.toBeDisabled() | ||
|
||
// continue to next step | ||
await page.getByRole('button', {name: 'NEXT'}).click() | ||
// await page.waitForTimeout(10000) | ||
|
||
// check finish step | ||
await page.waitForTimeout(10) | ||
// check Analytics step title | ||
const finishTitles = await page.getByRole('heading').allTextContents() | ||
expect(finishTitles).toEqual(['You are Ready!']) | ||
|
||
await page.getByRole('button', {name: 'Open Mintter App'}).click() | ||
}) |
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,52 @@ | ||
import { | ||
ElectronApplication, | ||
Page, | ||
_electron as electron, | ||
expect, | ||
test, | ||
} from '@playwright/test' | ||
import path from 'path' | ||
import {findLatestBuild, parseElectronApp} from 'electron-playwright-helpers' | ||
|
||
let electronApp: ElectronApplication | ||
|
||
test.beforeAll(async () => { | ||
// remove the app data: | ||
|
||
// find the latest build in the out directory | ||
const latestBuild = findLatestBuild() | ||
|
||
// parse the directory and find paths and other info | ||
const appInfo = parseElectronApp(latestBuild) | ||
|
||
// set the CI environment variable to true | ||
process.env.CI = 'e2e' | ||
|
||
electronApp = await electron.launch({ | ||
args: [appInfo.main], | ||
executablePath: appInfo.executable, | ||
}) | ||
|
||
electronApp.on('window', async (page) => { | ||
const filename = page.url()?.split('/').pop() | ||
|
||
// capture errors | ||
page.on('pageerror', (error) => { | ||
console.error(error) | ||
}) | ||
// capture console messages | ||
page.on('console', (msg) => { | ||
console.log(msg.text()) | ||
}) | ||
}) | ||
}) | ||
|
||
test.afterAll(async () => { | ||
// close app | ||
await electronApp.close() | ||
}) | ||
|
||
export {electronApp} | ||
|
||
export const alias = 'test alias' | ||
export const bio = 'some random test bio' |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
"dev": { | ||
"cache": false, | ||
"persistent": true | ||
} | ||
}, | ||
"test": {} | ||
} | ||
} |
Oops, something went wrong.