Skip to content

Commit

Permalink
e2e and main page testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Greedent82 committed Sep 26, 2024
1 parent 968db5c commit 4af41a2
Showing 1 changed file with 37 additions and 14 deletions.
51 changes: 37 additions & 14 deletions baggit-app/e2e/fixedmapyay^v^.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
import { test, expect } from '@playwright/test';

test('e2e', async ({ page }) => {
await page.goto('https://baggit-app.vercel.app/home')
await page.getByRole('link', { name: 'account Account' }).click();
await page.getByRole('link', { name: 'booking Booking' }).click();
await page.getByRole('link', { name: 'home Home' }).click();
await page.getByPlaceholder('Enter location to search').click();
await page.getByPlaceholder('Enter location to search').fill('birmingham');
await page.getByRole('button', { name: 'Search' }).click();
await page.locator('div:nth-child(3) > div:nth-child(3)').first().click();
await page.getByRole('button', { name: '×' }).click();
await page.locator('div:nth-child(3) > div:nth-child(4)').first().click();
await page.getByRole('link', { name: 'Details' }).click();
await page.getByRole('link', { name: 'Terms and Conditions' }).click();
})
test('frontpage presentation', async ({ page }) => {
await page.goto('https://baggit-app.vercel.app/home');

const homepageElements = [
page.locator('div').filter({ hasText: 'Search' }).nth(1),
page.getByPlaceholder('Enter location to search'),
page.getByRole('button', { name: 'Search' }),
page.getByRole('button', { name: 'Current Location' }),
page.getByText('Home Booking Account'),
page.getByRole('link', { name: 'home Home' }),
page.getByRole('link', { name: 'booking Booking' }),
page.getByRole('link', { name: 'account Account' })
];

for (const element of homepageElements) {
await expect(element).toBeVisible();
}
});

test('User Journey', async ({ page }) => {
await page.goto('https://baggit-app.vercel.app/home');
await page.getByPlaceholder('Enter location to search').click();
await page.getByPlaceholder('Enter location to search').fill('birmingham');
await page.getByPlaceholder('Enter location to search').press('Enter');
await page.getByRole('button', { name: 'Search' }).click();
await page.locator('div:nth-child(3) > div:nth-child(3)').first().click();
await page.getByRole('button', { name: 'Details' }).click();
await page.getByRole('link', { name: 'Terms and Conditions' }).click();
await page.getByRole('link', { name: 'Privacy Policy' }).click();
})

test('store info presentation', async ({ page }) => {
await page.goto('https://baggit-app.vercel.app/storeinfo');
await expect(page.getByText('Opening times: Mon-Fri 9:00 - 20:00')).toBeVisible();
await expect(page.getByRole('heading', { name: 'About Bag Storage App' })).toBeVisible()
await expect(page.getByText('Pay Now')).toBeVisible()
});

0 comments on commit 4af41a2

Please sign in to comment.