-
Notifications
You must be signed in to change notification settings - Fork 4.2k
[Meta: Move pages to NextJS] add E2E /educational/
test
#4943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zoobestik
wants to merge
4
commits into
master
Choose a base branch
from
e2e-educational-test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d86abd1
chore(e2e): some small typing improvements
zoobestik 2092ae7
chore(teach): react keys improve
zoobestik f83714d
test(teach): add desktop tests for all `/education/` pages
zoobestik 1fb0c76
test(teach): fix misspell for Join Educators Community
zoobestik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -50,3 +50,4 @@ generated | |
|
||
/reports* | ||
/data/page_views_map.json | ||
test-results |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,24 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
const MAX_DIFF_PIXEL_RATIO = 0.025 as const; | ||
|
||
export default defineConfig({ | ||
forbidOnly: !!process.env.CI, | ||
retries: process.env.CI ? 2 : 0, | ||
reporter: process.env.CI ? 'dot' : 'list', | ||
snapshotDir: 'test/snapshots', | ||
expect: { | ||
toMatchSnapshot: { maxDiffPixelRatio: MAX_DIFF_PIXEL_RATIO }, | ||
toHaveScreenshot: { maxDiffPixelRatio: MAX_DIFF_PIXEL_RATIO } | ||
}, | ||
use: { | ||
baseURL: process.env.BASE_URL || 'http://localhost:9000', | ||
trace: 'off' | ||
}, | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] } | ||
} | ||
] | ||
}); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,106 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { CoursesPage } from '../../page/teach/courses-page'; | ||
import { closeExternalBanners } from '../utils'; | ||
import { testSelector } from '../../utils'; | ||
import { checkTeachCta, checkTeachMap, checkTeachNav } from './utils'; | ||
|
||
test.describe('Courses page appearance and functionality', async () => { | ||
test.beforeEach(async ({ page, context, baseURL }) => { | ||
const coursesPage = new CoursesPage(page); | ||
await coursesPage.init(); | ||
await closeExternalBanners(context, page, baseURL); | ||
}); | ||
|
||
test('Should load the courses page correctly', async ({ page }) => { | ||
// Check if the page title is correct | ||
expect(await page.title()).toBe('List of Courses'); | ||
|
||
// Check if the main content is visible | ||
const mainContent = page.locator(testSelector('teach-courses')); | ||
await expect(mainContent).toBeVisible(); | ||
|
||
// Check if the page heading is correct | ||
const title = mainContent.locator('h1'); | ||
await expect(title).toBeVisible(); | ||
|
||
expect(await title.textContent()).toBe('Universities That Teach Kotlin'); | ||
}); | ||
|
||
test('Should have working navigation buttons', async ({ page }) => { | ||
await checkTeachNav(page, 'List of Courses'); | ||
}); | ||
|
||
test('Should have working tab navigation', async ({ page }) => { | ||
// Check if the tab list is visible | ||
const tabList = page.locator(testSelector('tab-list')); | ||
await expect(tabList).toBeVisible(); | ||
|
||
// Check if both tabs are present | ||
const tableViewTab = tabList.getByRole('tab', { name: 'Table view', exact: true }); | ||
await expect(tableViewTab).toBeVisible(); | ||
|
||
const mapViewTab = tabList.getByRole('tab', { name: 'Map view', exact: true }); | ||
await expect(mapViewTab).toBeVisible(); | ||
|
||
await expect(tableViewTab).toHaveAttribute('data-test', 'tab tab-selected'); | ||
await expect(mapViewTab).toHaveAttribute('data-test', 'tab'); | ||
|
||
// CoursesList should be visible in the table view | ||
await expect(page.locator('.ktl-courses-list')).toBeVisible(); | ||
|
||
// Switch to the map view | ||
await mapViewTab.click(); | ||
|
||
// Map view should now be active | ||
await expect(tableViewTab).toHaveAttribute('data-test', 'tab'); | ||
await expect(mapViewTab).toHaveAttribute('data-test', 'tab tab-selected'); | ||
|
||
// TeachMap should be visible in the map view | ||
await expect(page.locator('.teach-map .gm-style')).toBeVisible(); | ||
|
||
// Switch back to the table view | ||
await tableViewTab.click(); | ||
|
||
// Table view should be active again | ||
await expect(tableViewTab).toHaveAttribute('data-test', 'tab tab-selected'); | ||
await expect(mapViewTab).toHaveAttribute('data-test', 'tab'); | ||
|
||
// CoursesList should be visible again | ||
await expect(page.locator('.ktl-courses-list')).toBeVisible(); | ||
}); | ||
|
||
test('Should display university list in table view', async ({ page }) => { | ||
// Make sure we're in a table view | ||
const tableViewTab = page.getByRole('tab', { name: 'Table view' }); | ||
await tableViewTab.click(); | ||
|
||
// Check if the course list is visible | ||
const coursesList = page.locator('.ktl-courses-list'); | ||
await expect(coursesList).toBeVisible(); | ||
|
||
// Check and verify the headers of the course list | ||
const headers = coursesList.locator('.ktl-courses-list-header .ktl-courses-list-cell'); | ||
expect(await headers.count()).toBe(3); | ||
expect(await headers.nth(0).textContent()).toBe('University title'); | ||
expect(await headers.nth(1).textContent()).toBe('Location'); | ||
expect(await headers.nth(2).textContent()).toBe('Teaching Kotlin'); | ||
|
||
// Check if there are universities in the list | ||
const universities = coursesList.locator('.ktl-courses-list__item'); | ||
expect(await universities.count()).toBeGreaterThan(0); | ||
expect(await universities.first().locator('.ktl-courses-list-cell').count()) | ||
.toBe(3); | ||
}); | ||
|
||
test('Should display map with markers in map view', async ({ page }) => { | ||
// Switch to the map view | ||
const mapViewTab = page.getByRole('tab', { name: 'Map view' }); | ||
await mapViewTab.click(); | ||
|
||
// Check if the map is visible | ||
const map = page.locator('.teach-map'); | ||
await checkTeachMap(page, map); | ||
}); | ||
|
||
test('Should have action buttons for educators', checkTeachCta); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.