Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/pages/add-hub/add-hub.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</ion-list-header>

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

<ion-list-header class="ion-padding-bottom">
Expand Down
52 changes: 46 additions & 6 deletions tests/basic-user-flow.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import { test, expect } from '@playwright/test';
import { test, expect, Page, BrowserContext } from '@playwright/test';

test('create-profile-and-create-event', async ({ page, context }) => {
// Grant geolocation permission and set a default location
await context.grantPermissions(['geolocation']);
await context.setGeolocation({ latitude: 48.8566, longitude: 2.3522 }); // Paris coordinates

test.describe.serial('basic user flow', () => {
let context: BrowserContext;
let page: Page;

test.beforeAll(async ({ browser }) => {
context = await browser.newContext({
permissions: ['geolocation'],
geolocation: { latitude: 48.8566, longitude: 2.3522 }
});
page = await context.newPage();
});

test.afterAll(async () => {
await page.close();
await context.close();
});

test('create-profile', async () => {
// Generate unique email using Unix timestamp in milliseconds
const timestamp = Date.now();
const uniqueEmail = `playwright_test_${timestamp}@email.com`;
Expand All @@ -23,6 +36,10 @@ test('create-profile-and-create-event', async ({ page, context }) => {
await page.locator('#ion-input-7').fill('playwright_test');
await page.getByRole('button', { name: 'Save' }).click();
await expect(page.locator('ion-tabs')).toContainText('playwright_test test');
});

test('create-event', async () => {

await page.locator('#tab-button-home > .ios > .icon-inner > .ionicon').click();
await page.locator('ion-fab-button > .ios > .icon-inner > .ionicon').first().click();
await page.locator('circle').first().click();
Expand All @@ -47,4 +64,27 @@ test('create-profile-and-create-event', async ({ page, context }) => {
await expect(page.locator('ion-card-title')).toContainText('playwright_test_event');
await page.waitForSelector('app-event-card img', { state: 'visible', timeout: 10000 });
await expect(page.locator('app-event-card img')).toBeVisible();

});

test('create-place', async () => {
await page.locator('#tab-button-home').getByRole('tab').click();
await page.locator('#main').getByRole('button').first().click();
await page.getByRole('button').nth(2).click();
await page.getByRole('textbox', { name: '*' }).click();
await page.getByRole('textbox', { name: '*' }).fill('playwright_test_place');
await page.keyboard.press('Tab');
await page.keyboard.type('Place Description');
await page.getByTestId('location-input').click();
await page.getByRole('searchbox', { name: 'search text' }).click();
await page.getByRole('searchbox', { name: 'search text' }).fill('london');
await page.waitForTimeout(500);
await page.getByText(/england/i).first().click({ force: true });
await page.getByRole('button', { name: 'Select Location' }).click();
await page.getByRole('button', { name: 'Upload Image' }).click();
await page.getByRole('button', { name: 'Select Picture' }).click();
await page.setInputFiles('input[type="file"]', 'resources/icon.png');
await page.getByRole('button', { name: 'Create' }).click();
await expect(page.locator('app-hub-card')).toContainText('playwright_test_place');
});
});