Skip to content

Commit 6fe94fc

Browse files
peterbitflymarcel-bitfly
authored andcommitted
test: add basic e2e tests
1 parent 4819608 commit 6fe94fc

File tree

9 files changed

+397
-1
lines changed

9 files changed

+397
-1
lines changed

frontend/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ pnpm-lock.yaml
3232

3333
server.crt
3434
server.key
35+
36+
/test-results
37+
/tests/results

frontend/package-lock.json

Lines changed: 223 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@
2626
},
2727
"devDependencies": {
2828
"@nuxt/eslint": "^0.7.2",
29+
"@nuxt/test-utils": "^3.15.1",
2930
"@nuxtjs/color-mode": "^3.5.2",
3031
"@nuxtjs/i18n": "^9.1.0",
3132
"@nuxtjs/style-resources": "^1.2.2",
33+
"@playwright/test": "^1.49.1",
3234
"@primevue/nuxt-module": "~4.0.4",
3335
"@rollup/plugin-babel": "^6.0.4",
3436
"@types/lodash-es": "^4.17.12",
@@ -63,6 +65,8 @@
6365
"lint:fix": "npm run lint -- --fix",
6466
"postinstall": "nuxt prepare",
6567
"preview": "nuxt preview",
68+
"test:e2e": "npx playwright test --config=tests/playwright.config.ts",
69+
"test:e2e:ui": "npm run test:e2e -- --ui",
6670
"typecheck": "npx nuxi typecheck",
6771
"validate": "npm run lint:fix && npm run typecheck"
6872
},
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { Page } from '../utils/helpers'
2+
3+
export const DashboardPage = {
4+
accountsButton: (page: Page) => page.getByRole('button', { name: 'Accounts Coming soon' }),
5+
addDashboardTitle: (page: Page) => page.getByText('Add a new dashboard'),
6+
backButton: (page: Page) => page.locator('text=Back'),
7+
continueButton: (page: Page) => page.getByRole('button', { name: 'Continue' }),
8+
continueNetworkButton: (page: Page) => page.getByRole('button', { name: 'Continue' }),
9+
dashboard: (page: Page) => page.getByText('Online Validators'),
10+
ethereumOption: (page: Page) => page.getByRole('button', { name: 'Ethereum' }),
11+
gnosisOption: (page: Page) => page.getByRole('button', { name: 'Gnosis' }),
12+
manageValidatorsButton: (page: Page) => page.locator('text=Manage Validators'),
13+
onlineValidators: (page: Page) => page.locator('text=Online Validators'),
14+
validatorsButton: (page: Page) => page.getByRole('button', { name: 'Validators' }),
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { Page } from '../utils/helpers'
2+
3+
export const LoginPage = {
4+
email: (page: Page) => page.getByLabel('Email address'),
5+
errorEmail: (page: Page) => page.locator('text=Please provide a valid email address.'),
6+
errorInvalidPassword: (page: Page) => page.locator('text=Please enter your password.'),
7+
errorPasswordMaxLength: (page: Page) => page.locator('text=Please provide at least 5 characters.'),
8+
loginBtn: (page: Page) => page.getByRole('button', { name: 'Log in' }),
9+
password: (page: Page) => page.getByLabel('Password'),
10+
toastMessageCannotLogin: (page: Page) => page.locator('text=Cannot log in: your email or your password is unknown.'),
11+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import path from 'path'
2+
import { fileURLToPath } from 'node:url'
3+
import dotenv from 'dotenv'
4+
import {
5+
defineConfig, devices,
6+
} from '@playwright/test'
7+
import type { ConfigOptions } from '@nuxt/test-utils/playwright'
8+
9+
dotenv.config({ path: path.resolve(process.cwd(), '.env') })
10+
11+
export default defineConfig<ConfigOptions>({
12+
outputDir: './results',
13+
projects: [ {
14+
name: 'chromium',
15+
use: {
16+
...devices['Desktop Chrome'], channel: 'chromium',
17+
},
18+
} ],
19+
testMatch: '**/*.spec.ts',
20+
timeout: 300000,
21+
use: {
22+
baseURL: process.env.NUXT_PUBLIC_DOMAIN,
23+
ignoreHTTPSErrors: true,
24+
nuxt: {
25+
rootDir: fileURLToPath(new URL('.', import.meta.url)),
26+
},
27+
},
28+
})

0 commit comments

Comments
 (0)