-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
208 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { test, expect } from '@playwright/test' | ||
|
||
test.beforeEach(async ({ context }) => { | ||
await context.clearPermissions() | ||
}) | ||
|
||
test('Deny geolocation use selector to find stop.', async ({ page }) => { | ||
await page.goto('/') | ||
await expect( | ||
page.getByText('Location permission denied. Check your OS or browser settings.') | ||
).toBeVisible() | ||
await page.getByRole('listitem', { name: 'Selector' }).getByRole('button').click() | ||
await expect(page.getByRole('heading', { name: 'Bus Selector' })).toBeVisible() | ||
await page.getByText('Agency').click() | ||
await page.getByPlaceholder('Agencies ... (64)').fill('toronto') | ||
await page.getByRole('option', { name: 'Toronto Transit Commission' }).click() | ||
await page.getByText('Stop', { exact: true }).click() | ||
await page.getByRole('option', { name: 'Bathurst St At Neptune Dr' }).click() | ||
await expect(page.getByRole('heading', { name: 'Next Arrivals' })).toBeVisible() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { test, expect } from '@playwright/test' | ||
|
||
test.use({ | ||
geolocation: { | ||
latitude: 34.10865, | ||
longitude: -117.325531 | ||
}, | ||
permissions: ['geolocation'] | ||
}) | ||
|
||
test('test', async ({ page, context }) => { | ||
await context.grantPermissions(['geolocation']) | ||
// Navigate to the homepage and select the Nearby stops tab, check for OmniTrans | ||
await page.goto('/') | ||
await page.getByRole('listitem', { name: 'Nearby' }).getByRole('button').click() | ||
await expect(page.getByRole('heading', { name: 'Nearby Stops' })).toBeVisible() | ||
await expect(page.getByRole('heading', { name: 'Omnitrans' })).toBeVisible({ | ||
timeout: 10_000 | ||
}) | ||
|
||
// Check that route headings are visible | ||
await expect(page.getByRole('heading', { level: 4 }).first()).toBeVisible() | ||
|
||
// Get the stop title link and save the innerText | ||
const link = page.getByRole('heading', { level: 5 }).first().getByRole('link') | ||
const linkText = await link.innerText() | ||
|
||
// Click the stop link and check that predictions are rendered with users distance from stop | ||
await link.click() | ||
await expect(page.getByRole('heading', { name: 'Next Arrivals' })).toBeVisible({ | ||
timeout: 7_000 | ||
}) | ||
await expect(page.getByText(/You are .+ miles away/)).toBeVisible() | ||
|
||
// Close the flyout menu and check the map for user and stop markers | ||
await page.locator('button').filter({ hasText: 'Close' }).click() | ||
await page.getByRole('button', { name: 'Marker' }).click() | ||
await expect(page.locator('.leaflet-marker-icon').first()).toBeVisible() | ||
await expect(page.locator('#map').getByText(linkText)).toBeVisible() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { test, expect } from '@playwright/test' | ||
|
||
test.use({ | ||
geolocation: { | ||
latitude: 43.69786, | ||
longitude: -79.39712 | ||
}, | ||
permissions: ['geolocation'] | ||
}) | ||
|
||
test('Nearby stops for Toronto Transit Commission.', async ({ page }) => { | ||
await page.goto('/') | ||
await page.getByRole('listitem', { name: 'Nearby' }).getByRole('button').click() | ||
await expect(page.getByRole('heading', { name: 'Nearby Stops' })).toBeVisible() | ||
await expect(page.getByText('Monitoring your location.')).toBeVisible() | ||
await expect(page.getByRole('heading', { name: 'Toronto TTC' })).toBeVisible({ | ||
timeout: 10_000 | ||
}) | ||
|
||
// Check that route headings are visible | ||
await expect(page.getByRole('heading', { level: 4 }).first()).toBeVisible() | ||
|
||
// Get the stop title link and save the innerText | ||
const link = page.getByRole('heading', { level: 5 }).first().getByRole('link') | ||
const linkText = await link.innerText() | ||
|
||
// Click the stop link and check that predictions are rendered with users distance from stop | ||
await link.click() | ||
await expect(page.getByRole('heading', { name: 'Next Departures' })).toBeVisible({ | ||
timeout: 7_000 | ||
}) | ||
await expect(page.getByText(/You are .+ miles away/)).toBeVisible() | ||
|
||
// Close the flyout menu and check the map for user and stop markers | ||
await page.locator('button').filter({ hasText: 'Close' }).click() | ||
await page.getByRole('button', { name: 'Marker' }).click() | ||
await expect(page.locator('.leaflet-marker-icon').first()).toBeVisible() | ||
await expect(page.locator('#map').getByText(linkText)).toBeVisible() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { test, expect } from '@playwright/test' | ||
|
||
test('Select an agency and stop to see arrivals.', async ({ page }) => { | ||
await page.goto('/') | ||
await page.getByRole('listitem', { name: 'Selector' }).getByRole('button').click() | ||
await expect(page.getByRole('heading', { name: 'Bus Selector' })).toBeVisible() | ||
await page.getByText('Agency').click() | ||
await page.getByRole('option', { name: 'Toronto Transit Commission' }).click() | ||
await page.getByText('Stop', { exact: true }).click() | ||
await page.getByRole('option', { name: 'Bathurst St At Neptune Dr' }).click() | ||
await expect(page.getByRole('heading', { name: 'Next Arrivals' })).toBeVisible() | ||
await page.locator('button').filter({ hasText: 'Close' }).click() | ||
await page.getByRole('button', { name: 'Marker' }).click() | ||
await page.locator('#map').getByText('Bathurst St At Neptune Dr').click() | ||
}) |