-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] Add Wiki tests and downgrade react-router to avoid latest regre…
…ssion for nested routing (#451)
- Loading branch information
Showing
5 changed files
with
88 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { TestOpenPandora } from './utils/helpers'; | ||
|
||
test.describe('Wiki', () => { | ||
test('Selects default tab', async ({ page }) => { | ||
await TestOpenPandora(page, { path: '/wiki' }); | ||
|
||
await page.waitForURL('/wiki/introduction'); | ||
await expect(page.getByRole('button', { name: 'Introduction' })).toHaveClass('tab active'); | ||
await expect(page.getByRole('heading', { name: 'Introduction to Pandora' })).toBeVisible(); | ||
}); | ||
|
||
test('Loads specific tab directly based on url', async ({ page }) => { | ||
await TestOpenPandora(page, { path: '/wiki/history' }); | ||
|
||
await expect(page.getByRole('button', { name: 'Introduction' })).toHaveClass('tab'); | ||
await expect(page.getByRole('button', { name: 'Pandora History' })).toHaveClass('tab active'); | ||
await expect(page.getByRole('heading', { name: `Pandora's history`, exact: true })).toBeVisible(); | ||
}); | ||
|
||
test('Switches tabs', async ({ page }) => { | ||
await TestOpenPandora(page, { path: '/wiki/introduction' }); | ||
|
||
// Initial tab is introcution | ||
await expect(page.getByRole('button', { name: 'Introduction' })).toHaveClass('tab active'); | ||
await expect(page.getByRole('button', { name: 'Contact' })).toHaveClass('tab'); | ||
await expect(page.getByRole('heading', { name: 'Introduction to Pandora' })).toBeVisible(); | ||
await page.waitForURL('/wiki/introduction'); | ||
|
||
// Nothing changes when clicking already selected tab | ||
await page.getByRole('button', { name: 'Introduction' }).click(); | ||
await expect(page.getByRole('button', { name: 'Introduction' })).toHaveClass('tab active'); | ||
await expect(page.getByRole('button', { name: 'Contact' })).toHaveClass('tab'); | ||
await expect(page.getByRole('heading', { name: 'Introduction to Pandora' })).toBeVisible(); | ||
await page.waitForURL('/wiki/introduction'); | ||
|
||
// Switch to tab "Contact" | ||
await page.getByRole('button', { name: 'Contact' }).click(); | ||
await expect(page.getByRole('button', { name: 'Contact' })).toHaveClass('tab active'); | ||
await expect(page.getByRole('heading', { name: 'Contact Us', exact: true })).toBeVisible(); | ||
await page.waitForURL('/wiki/contact'); | ||
|
||
await expect(page.getByRole('button', { name: 'Introduction' })).toHaveClass('tab'); | ||
await expect(page.getByRole('heading', { name: 'Introduction to Pandora' })).not.toBeVisible(); | ||
}); | ||
|
||
test('Uses back button', async ({ page }) => { | ||
await TestOpenPandora(page, { path: '/wiki/introduction' }); | ||
|
||
// Initial tab is introcution | ||
await expect(page.getByRole('button', { name: 'Introduction' })).toHaveClass('tab active'); | ||
await page.getByRole('button', { name: 'Back' }).click(); | ||
await page.waitForURL('/login'); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.