-
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.
fix: issue with caching when selecting transport filter (#229)
* chore: adds test case for filter * chore: adds tests for non-transit * chore: adds tests for boat and Correspondance * fix: cache when transportmode is active
- Loading branch information
Showing
9 changed files
with
189 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test.use({ | ||
geolocation: { longitude: 62.4722, latitude: 6.1495 }, | ||
permissions: ['geolocation'], | ||
}); | ||
|
||
test('Should fetch Kristiansund - Molde and loading more after first result', async ({ | ||
page, | ||
}) => { | ||
await page.goto(process.env.E2E_URL ?? 'http://localhost:3000'); | ||
|
||
await page.getByRole('textbox', { name: 'From' }).click(); | ||
await page.getByRole('textbox', { name: 'From' }).fill('Kristiansund'); | ||
await page | ||
.getByRole('option', { name: 'Kristiansund Kristiansund', exact: true }) | ||
.click(); | ||
|
||
await page.getByRole('textbox', { name: 'To' }).click(); | ||
await page.getByRole('textbox', { name: 'To' }).fill('Molde'); | ||
|
||
const initialRequest = page.waitForResponse((request) => { | ||
return request.url().includes('trip') && request.url().includes('cursor'); | ||
}); | ||
|
||
await page.getByRole('option', { name: 'Molde Molde', exact: true }).click(); | ||
|
||
await initialRequest; | ||
|
||
await page.getByRole('button', { name: 'More choices' }).click(); | ||
await page.getByText('Bus', { exact: true }).click(); | ||
await page.getByRole('button', { name: 'Find departures' }).click(); | ||
|
||
const tripPatternItem = page.getByTestId('tripPattern-0-0'); | ||
await tripPatternItem.waitFor(); | ||
|
||
const additionalRequest = page.waitForRequest((request) => { | ||
return request.url().includes('trip') && request.url().includes('cursor'); | ||
}); | ||
await page.getByRole('button', { name: 'Load more results' }).click(); | ||
|
||
await additionalRequest; | ||
}); | ||
|
||
test('should show non transit trips on walkable distance', async ({ page }) => { | ||
await page.goto(process.env.E2E_URL ?? 'http://localhost:3000'); | ||
await page.getByRole('textbox', { name: 'From' }).click(); | ||
await page.getByRole('textbox', { name: 'From' }).fill('Fylkeshuset i Møre'); | ||
await page | ||
.getByRole('option', { name: 'Fylkeshuset i Møre og Romsdal' }) | ||
.click(); | ||
await page.getByRole('textbox', { name: 'To' }).click(); | ||
await page.getByRole('textbox', { name: 'To' }).fill('Roseby'); | ||
await page.getByRole('option', { name: 'Roseby Molde', exact: true }).click(); | ||
|
||
await page.getByTestId('non-transit-pill-foot').click(); | ||
|
||
await expect( | ||
page.getByRole('heading', { name: 'Fylkeshuset i Møre og Romsdal' }), | ||
).toBeVisible(); | ||
}); | ||
|
||
test('should show non transit trips on cyclable distance', async ({ page }) => { | ||
await page.goto(process.env.E2E_URL ?? 'http://localhost:3000'); | ||
await page.getByRole('textbox', { name: 'From' }).click(); | ||
await page.getByRole('textbox', { name: 'From' }).fill('Fylkeshuset i Møre'); | ||
await page | ||
.getByRole('option', { name: 'Fylkeshuset i Møre og Romsdal' }) | ||
.click(); | ||
await page.getByRole('textbox', { name: 'To' }).click(); | ||
await page.getByRole('textbox', { name: 'To' }).fill('Roseby'); | ||
await page.getByRole('option', { name: 'Roseby Molde', exact: true }).click(); | ||
|
||
await page.getByTestId('non-transit-pill-bicycle').click(); | ||
|
||
await expect( | ||
page.getByRole('heading', { name: 'Fylkeshuset i Møre og Romsdal' }), | ||
).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,88 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test.use({ | ||
geolocation: { longitude: 62.4722, latitude: 6.1495 }, | ||
permissions: ['geolocation'], | ||
}); | ||
|
||
test.describe('fram only', () => { | ||
test.skip( | ||
() => process.env.NEXT_PUBLIC_PLANNER_ORG_ID !== 'fram', | ||
'Only FRAM!', | ||
); | ||
|
||
test('Should filter on line 701', async ({ page }) => { | ||
await page.goto(process.env.E2E_URL ?? 'http://localhost:3000'); | ||
|
||
await page.getByRole('textbox', { name: 'From' }).click(); | ||
await page.getByRole('textbox', { name: 'From' }).fill('Kvam'); | ||
await page.getByRole('option', { name: 'Kvam skole Molde' }).click(); | ||
|
||
await page.getByRole('textbox', { name: 'To' }).click(); | ||
await page.getByRole('textbox', { name: 'To' }).fill('Fylkeshusa'); | ||
|
||
const tripResponse = page.waitForResponse((request) => { | ||
return request.url().includes('assistant/trip'); | ||
}); | ||
await page.getByRole('option', { name: 'Fylkeshusa Molde' }).click(); | ||
|
||
await page.getByRole('button', { name: 'More choices' }).click(); | ||
|
||
await tripResponse; | ||
|
||
await page.getByPlaceholder('line number').click(); | ||
await page.getByPlaceholder('line number').fill('701'); | ||
|
||
const tripResponse2 = page.waitForResponse((request) => { | ||
return request.url().includes('assistant/trip'); | ||
}); | ||
await page.getByRole('button', { name: 'Find departures' }).click(); | ||
await tripResponse2; | ||
|
||
const tripPatternItem2 = page.getByTestId('tripPattern-0-0'); | ||
await tripPatternItem2.waitFor(); | ||
|
||
await expect(tripPatternItem2).toBeVisible(); | ||
expect(await tripPatternItem2.getAttribute('aria-label')).toContain('701'); | ||
}); | ||
|
||
test('should show boats and message on Correspondance', async ({ page }) => { | ||
await page.goto(process.env.E2E_URL ?? 'http://localhost:3000'); | ||
|
||
await page.getByRole('textbox', { name: 'From' }).click(); | ||
await page.getByRole('textbox', { name: 'From' }).fill('Moa trafikktermin'); | ||
await page.getByRole('option', { name: 'Moa trafikkterminal' }).click(); | ||
|
||
await page.getByRole('textbox', { name: 'To' }).click(); | ||
await page.getByRole('textbox', { name: 'To' }).fill('Ulsteinvik'); | ||
|
||
const additionalRequest = page.waitForResponse((request) => { | ||
return request.url().includes('trip'); | ||
}); | ||
|
||
await page | ||
.getByRole('option', { name: 'Ulsteinvik Ulstein', exact: true }) | ||
.click(); | ||
|
||
await additionalRequest; | ||
|
||
await page.getByTestId('tripPattern-0-0').waitFor(); | ||
|
||
await page.getByRole('button', { name: 'More choices' }).click(); | ||
|
||
const additionalRequest2 = page.waitForResponse((request) => { | ||
return ( | ||
request.url().includes('trip') && request.url().includes('expressboat') | ||
); | ||
}); | ||
await page.locator('label').filter({ hasText: 'Express boat' }).click(); | ||
await page.getByText('Bus', { exact: true }).click(); | ||
|
||
await page.getByText('Loading travel suggestions...').waitFor(); | ||
|
||
await additionalRequest2; | ||
|
||
await page.getByText('1145').first().click(); | ||
await expect(page.getByText('Correspondance between 1145')).toBeVisible(); | ||
}); | ||
}); |
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
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