Skip to content

Commit 5541ea6

Browse files
committed
basic user flow passing in chromium
1 parent 06aee68 commit 5541ea6

2 files changed

Lines changed: 60 additions & 7 deletions

File tree

playwright.config.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { defineConfig, devices } from '@playwright/test';
1313
*/
1414
export default defineConfig({
1515
testDir: './tests',
16+
timeout: 60000,
1617
/* Run tests in files in parallel */
1718
fullyParallel: true,
1819
/* Fail the build on CI if you accidentally left test.only in the source code. */
@@ -26,7 +27,7 @@ export default defineConfig({
2627
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2728
use: {
2829
/* Base URL to use in actions like `await page.goto('')`. */
29-
// baseURL: 'http://localhost:3000',
30+
baseURL: 'http://localhost:4200',
3031

3132
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3233
trace: 'on-first-retry',
@@ -36,7 +37,12 @@ export default defineConfig({
3637
projects: [
3738
{
3839
name: 'chromium',
39-
use: { ...devices['Desktop Chrome'] },
40+
use: {
41+
...devices['Desktop Chrome'],
42+
launchOptions: {
43+
args: ['--enable-features=SharedArrayBuffer', '--use-gl=angle', '--use-angle=gl'],
44+
},
45+
},
4046
},
4147

4248
{
@@ -71,9 +77,11 @@ export default defineConfig({
7177
],
7278

7379
/* Run your local dev server before starting the tests */
74-
// webServer: {
75-
// command: 'npm run start',
76-
// url: 'http://localhost:3000',
77-
// reuseExistingServer: !process.env.CI,
78-
// },
80+
webServer: {
81+
command: 'npm run start',
82+
url: 'http://localhost:4200',
83+
reuseExistingServer: !process.env.CI,
84+
stderr: "pipe",
85+
stdout: "pipe"
86+
},
7987
});

tests/basic-user-flow.spec.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test('create-profile-and-create-event', async ({ page, context }) => {
4+
// Grant geolocation permission and set a default location
5+
await context.grantPermissions(['geolocation']);
6+
await context.setGeolocation({ latitude: 48.8566, longitude: 2.3522 }); // Paris coordinates
7+
8+
// Generate unique email using Unix timestamp in milliseconds
9+
const timestamp = Date.now();
10+
const uniqueEmail = `playwright_test_${timestamp}@email.com`;
11+
12+
await page.goto('http://localhost:4200/landing?returnUrl=%2Ftabs%2Fhome');
13+
await page.getByRole('button', { name: 'Continue As Guest' }).click();
14+
await expect(page.locator('app-home')).toContainText('Set your name and claim your account! This ensures you\'re able to recover your account if signed out.');
15+
await page.getByText('Set your name and claim your').click();
16+
await page.locator('#ion-input-2').click();
17+
await page.locator('#ion-input-2').fill('playwright_test');
18+
await page.locator('#ion-input-3').click();
19+
await page.locator('#ion-input-3').fill('test');
20+
await page.locator('#ion-input-4').click();
21+
await page.locator('#ion-input-4').fill(uniqueEmail);
22+
await page.locator('#ion-input-7').click();
23+
await page.locator('#ion-input-7').fill('playwright_test');
24+
await page.getByRole('button', { name: 'Save' }).click();
25+
await expect(page.locator('ion-tabs')).toContainText('playwright_test test');
26+
await page.locator('#tab-button-home > .ios > .icon-inner > .ionicon').click();
27+
await page.locator('ion-fab-button > .ios > .icon-inner > .ionicon').first().click();
28+
await page.locator('circle').first().click();
29+
await page.getByRole('textbox', { name: '*' }).click();
30+
await page.getByRole('textbox', { name: '*' }).fill('playwright_test_event');
31+
await page.locator('input[name="ion-input-11"]').click();
32+
await page.locator('input[name="ion-input-11"]').fill('0');
33+
await page.locator('input[name="ion-input-12"]').click();
34+
await page.locator('input[name="ion-input-12"]').fill('2');
35+
await page.locator('#ion-textarea-0').click();
36+
await page.locator('#ion-textarea-0').fill('description of event');
37+
await page.locator('#ion-input-13').click();
38+
await page.getByRole('searchbox', { name: 'search text' }).click();
39+
await page.getByRole('searchbox', { name: 'search text' }).fill('paris');
40+
await page.waitForTimeout(500);
41+
await page.getByText(/france/i).first().click({ force: true });
42+
await page.getByRole('button', { name: 'Select Location' }).click();
43+
await page.getByRole('button', { name: 'Create' }).click();
44+
await expect(page.locator('ion-card-title')).toContainText('playwright_test_event');
45+
});

0 commit comments

Comments
 (0)