feat(e2e): WIP e2e onboarding process

This commit is contained in:
Ahmed Bouhuolia
2023-06-23 02:45:30 +02:00
parent ca4d543482
commit 44fce6f33e
4 changed files with 92 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
import { test, expect, Page } from '@playwright/test';
import { faker } from '@faker-js/faker';
let authPage: Page;
@@ -30,6 +31,7 @@ test.describe('authentication', () => {
await authPage.getByRole('link', { name: 'Sign up' }).click();
await expect(authPage.url()).toContain('/auth/register');
});
test('should the email or password is not correct.', async () => {});
});
test.describe('register', () => {
@@ -52,6 +54,24 @@ test.describe('authentication', () => {
'Password is a required field'
);
});
test('should signup successfully.', async () => {
const form = authPage.locator('form');
await form
.locator('input[name="first_name"]')
.fill(faker.person.firstName());
await form
.locator('input[name="last_name"]')
.fill(faker.person.lastName());
await form.locator('input[name="email"]').fill(faker.internet.email());
await form
.locator('input[name="password"]')
.fill(faker.internet.password());
await authPage.getByRole('button', { name: 'Register' }).click();
await expect(authPage.locator('h1')).toContainText(
'Register a New Organization now!'
);
});
});
test.describe('reset password', () => {

55
e2e/onboarding.spec.ts Normal file
View File

@@ -0,0 +1,55 @@
import { test, expect, Page } from '@playwright/test';
import { faker } from '@faker-js/faker';
let authPage: Page;
test.describe('onboarding', () => {
test.beforeAll(async ({ browser }) => {
authPage = await browser.newPage();
await authPage.goto('/auth/register');
const form = authPage.locator('form');
await form
.locator('input[name="first_name"]')
.fill(faker.person.firstName());
await form.locator('input[name="last_name"]').fill(faker.person.lastName());
await form.locator('input[name="email"]').fill(faker.internet.email());
await form
.locator('input[name="password"]')
.fill(faker.internet.password());
await authPage.getByRole('button', { name: 'Register' }).click();
});
test.only('should validation catch all required fields', async () => {
const form = authPage.locator('form');
await authPage.getByRole('button', { name: 'Save & Continue' }).click();
await expect(form).toContainText('Organization name is a required field');
await expect(form).toContainText('Location is a required field');
await expect(form).toContainText('Base currency is a required field');
await expect(form).toContainText('Fiscal year is a required field');
await expect(form).toContainText('Time zone is a required field');
});
test('should sign-out when click on Signout link', () => {});
test('should onboarding process success', () => {
// await page.getByRole('textbox').click();
// await page.getByRole('textbox').fill('sdafasdf');
// await page.getByRole('button', { name: 'Select Business Location...' }).click();
// await page.locator('a').filter({ hasText: 'Armenia' }).click();
// await page.getByRole('button', { name: 'Select Base Currency...' }).click();
// await page.locator('a').filter({ hasText: 'USD - US Dollar' }).click();
// await page.getByRole('button', { name: 'Select Fiscal Year...' }).click();
// await page.locator('a').filter({ hasText: 'May - April' }).click();
// await page.getByRole('button', { name: 'Select Time Zone...' }).click();
// await page.getByText('Pacific/Midway (SST)-11:00').click();
// await page.getByRole('button', { name: 'Save & Continue' }).click();
// await page.getByRole('heading', { name: 'Congrats! You are ready to go' }).click();
// await page.getByRole('button', { name: 'Go to dashboard' }).click();
});
test('should go to the dashboard after clicking on "Go to dashboard" button.', () => {});
});

14
package-lock.json generated
View File

@@ -333,6 +333,12 @@
"@jridgewell/trace-mapping": "0.3.9"
}
},
"@faker-js/faker": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.0.2.tgz",
"integrity": "sha512-Uo3pGspElQW91PCvKSIAXoEgAUlRnH29sX2/p89kg7sP1m2PzCufHINd0FhTXQf6DYGiUlVncdSPa2F9wxed2A==",
"dev": true
},
"@gar/promisify": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz",
@@ -945,6 +951,7 @@
"version": "1.32.3",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.32.3.tgz",
"integrity": "sha512-BvWNvK0RfBriindxhLVabi8BRe3X0J9EVjKlcmhxjg4giWBD/xleLcg2dz7Tx0agu28rczjNIPQWznwzDwVsZQ==",
"dev": true,
"requires": {
"@types/node": "*",
"fsevents": "2.3.2",
@@ -954,7 +961,8 @@
"playwright-core": {
"version": "1.32.3",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.32.3.tgz",
"integrity": "sha512-SB+cdrnu74ZIn5Ogh/8278ngEh9NEEV0vR4sJFmK04h2iZpybfbqBY0bX6+BLYWVdV12JLLI+JEFtSnYgR+mWg=="
"integrity": "sha512-SB+cdrnu74ZIn5Ogh/8278ngEh9NEEV0vR4sJFmK04h2iZpybfbqBY0bX6+BLYWVdV12JLLI+JEFtSnYgR+mWg==",
"dev": true
}
}
},
@@ -1003,7 +1011,8 @@
"@types/node": {
"version": "18.14.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.6.tgz",
"integrity": "sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA=="
"integrity": "sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==",
"dev": true
},
"@types/normalize-package-data": {
"version": "2.4.1",
@@ -2324,6 +2333,7 @@
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"optional": true
},
"function-bind": {

View File

@@ -10,7 +10,7 @@
"dev:server": "lerna run dev --scope \"@bigcapital/server\"",
"build:server": "lerna run build --scope \"@bigcapital/server\"",
"serve:server": "lerna run serve --scope \"@bigcapital/server\"",
"test:e2e": "playwright test",
"test:e2e": "playwright test --debug",
"prepare": "husky install"
},
"workspaces": [
@@ -18,12 +18,13 @@
"shared/*"
],
"devDependencies": {
"@commitlint/cli": "^17.4.2",
"@commitlint/config-conventional": "^17.4.2",
"@commitlint/config-lerna-scopes": "^17.4.2",
"@faker-js/faker": "^8.0.2",
"@playwright/test": "^1.32.3",
"husky": "^8.0.3",
"lerna": "^6.4.1",
"@commitlint/cli": "^17.4.2",
"@playwright/test": "^1.32.3"
"lerna": "^6.4.1"
},
"engines": {
"node": "14.x"