-
Notifications
You must be signed in to change notification settings - Fork 102
Add E2E tests for cross-component navigation flow #1119
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { expect, test } from 'vitest'; | ||
| import evaluateCode from '@runtime/evaluate'; | ||
|
|
||
| test('set literal with one element', () => { | ||
| expect(evaluateCode('{1}')?.toString()).toBe('{1}'); | ||
| }); | ||
|
|
||
| test('set literal with multiple elements', () => { | ||
| expect(evaluateCode('{1 2 3}')?.toString()).toBe('{1 2 3}'); | ||
| }); | ||
|
|
||
| test('set literal with string elements', () => { | ||
| expect(evaluateCode("{'a' 'b' 'c'}")?.toString()).toBe('{"a" "b" "c"}'); | ||
| }); | ||
|
|
||
| test('set literal removes duplicate elements', () => { | ||
| expect(evaluateCode('{1 1 2}')?.toString()).toBe('{1 2}'); | ||
| }); | ||
|
|
||
| test('set size via .size()', () => { | ||
| expect(evaluateCode('{1 2 3}.size()')?.toString()).toBe('3'); | ||
| }); | ||
|
|
||
| test('set is not equal to empty set', () => { | ||
| expect(evaluateCode('{1 2 3} = ø')?.toString()).toBe('⊥'); | ||
| }); | ||
|
|
||
| test('set is not empty', () => { | ||
| expect(evaluateCode('{1 2 3} ≠ ø')?.toString()).toBe('⊤'); | ||
| }); | ||
|
|
||
| test('set union combines two sets', () => { | ||
| expect(evaluateCode('{1 2}.union({3 4})')?.toString()).toBe('{1 2 3 4}'); | ||
| }); | ||
|
|
||
| test('set intersection finds common elements', () => { | ||
| expect(evaluateCode('{1 2 3}.intersection({2 3 4})')?.toString()).toBe('{2 3}'); | ||
| }); | ||
|
|
||
| test('set difference removes elements', () => { | ||
| expect(evaluateCode('{1 2 3}.difference({2 3})')?.toString()).toBe('{1}'); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { expect, test } from '@playwright/test'; | ||
|
|
||
| test.describe('Editor → Output cross-component flow', () => { | ||
|
|
||
| test('home page loads successfully', async ({ page }) => { | ||
| await page.goto('http://localhost:5173/en-US'); | ||
| await expect(page).toHaveTitle(/Wordplay/, { timeout: 8000 }); | ||
| }); | ||
|
|
||
| test('navigating to Learn page works', async ({ page }) => { | ||
| await page.goto('http://localhost:5173/en-US'); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the domain. |
||
| await page.getByRole('link', { name: 'Learn' }).first().click(); | ||
| await page.waitForURL(/\/learn/, { timeout: 8000 }); | ||
| await expect(page).toHaveURL(/learn/); | ||
| }); | ||
|
|
||
| test('navigating to Guide page works', async ({ page }) => { | ||
| await page.goto('http://localhost:5173/en-US'); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the domain. |
||
| await page.getByRole('link', { name: 'Guide' }).first().click(); | ||
| await page.waitForURL(/\/guide/, { timeout: 8000 }); | ||
| await expect(page).toHaveURL(/guide/); | ||
| }); | ||
|
|
||
| test('language switcher is present on home page', async ({ page }) => { | ||
| await page.goto('http://localhost:5173/en-US'); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the domain. |
||
| const langButton = page.getByText('English').or(page.locator('[aria-label*="language"]')); | ||
| await expect(langButton.first()).toBeVisible({ timeout: 8000 }); | ||
| }); | ||
|
|
||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should not be hard coded with
https://localhost:5173. Just pass the path, not the domain. Not every platform will use this port.