Skip to content

Commit ff3591b

Browse files
committed
create place test working in firefox and chromium
1 parent e128877 commit ff3591b

2 files changed

Lines changed: 47 additions & 7 deletions

File tree

src/app/pages/add-hub/add-hub.page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</ion-list-header>
3131

3232
<ion-item>
33-
<ion-input readonly type="text" placeholder="Location" [value]="location.value?.label" (click)="toggleMapModal()" ></ion-input>
33+
<ion-input readonly type="text" placeholder="Location" [value]="location.value?.label" (click)="toggleMapModal()" data-testid="location-input"></ion-input>
3434
</ion-item>
3535

3636
<ion-list-header class="ion-padding-bottom">

tests/basic-user-flow.spec.ts

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1-
import { test, expect } from '@playwright/test';
1+
import { test, expect, Page, BrowserContext } from '@playwright/test';
22

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-
3+
test.describe.serial('basic user flow', () => {
4+
let context: BrowserContext;
5+
let page: Page;
6+
7+
test.beforeAll(async ({ browser }) => {
8+
context = await browser.newContext({
9+
permissions: ['geolocation'],
10+
geolocation: { latitude: 48.8566, longitude: 2.3522 }
11+
});
12+
page = await context.newPage();
13+
});
14+
15+
test.afterAll(async () => {
16+
await page.close();
17+
await context.close();
18+
});
19+
20+
test('create-profile', async () => {
821
// Generate unique email using Unix timestamp in milliseconds
922
const timestamp = Date.now();
1023
const uniqueEmail = `playwright_test_${timestamp}@email.com`;
@@ -23,6 +36,10 @@ test('create-profile-and-create-event', async ({ page, context }) => {
2336
await page.locator('#ion-input-7').fill('playwright_test');
2437
await page.getByRole('button', { name: 'Save' }).click();
2538
await expect(page.locator('ion-tabs')).toContainText('playwright_test test');
39+
});
40+
41+
test('create-event', async () => {
42+
2643
await page.locator('#tab-button-home > .ios > .icon-inner > .ionicon').click();
2744
await page.locator('ion-fab-button > .ios > .icon-inner > .ionicon').first().click();
2845
await page.locator('circle').first().click();
@@ -47,4 +64,27 @@ test('create-profile-and-create-event', async ({ page, context }) => {
4764
await expect(page.locator('ion-card-title')).toContainText('playwright_test_event');
4865
await page.waitForSelector('app-event-card img', { state: 'visible', timeout: 10000 });
4966
await expect(page.locator('app-event-card img')).toBeVisible();
67+
68+
});
69+
70+
test('create-place', async () => {
71+
await page.locator('#tab-button-home').getByRole('tab').click();
72+
await page.locator('#main').getByRole('button').click();
73+
await page.getByRole('button').nth(2).click();
74+
await page.getByRole('textbox', { name: '*' }).click();
75+
await page.getByRole('textbox', { name: '*' }).fill('playwright_test_place');
76+
await page.keyboard.press('Tab');
77+
await page.keyboard.type('Place Description');
78+
await page.getByTestId('location-input').click();
79+
await page.getByRole('searchbox', { name: 'search text' }).click();
80+
await page.getByRole('searchbox', { name: 'search text' }).fill('london');
81+
await page.waitForTimeout(500);
82+
await page.getByText(/england/i).first().click({ force: true });
83+
await page.getByRole('button', { name: 'Select Location' }).click();
84+
await page.getByRole('button', { name: 'Upload Image' }).click();
85+
await page.getByRole('button', { name: 'Select Picture' }).click();
86+
await page.setInputFiles('input[type="file"]', 'resources/icon.png');
87+
await page.getByRole('button', { name: 'Create' }).click();
88+
await expect(page.locator('app-hub-card')).toContainText('playwright_test_place');
89+
});
5090
});

0 commit comments

Comments
 (0)