-
Notifications
You must be signed in to change notification settings - Fork 17
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
1 parent
3cfeaa6
commit 21a8a4b
Showing
23 changed files
with
177 additions
and
167 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.astro | ||
dist | ||
node_modules | ||
playwright-report | ||
test-results |
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,110 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test.describe('instance methods with nightly retroarch', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/tests/e2e/test-page/nightly.html') | ||
}) | ||
|
||
test('save state', async ({ page }) => { | ||
const canvas = page.locator('#canvas') | ||
await expect(canvas).not.toBeAttached() | ||
|
||
await page.getByText('nes', { exact: true }).click() | ||
await page.waitForLoadState('networkidle') | ||
await page.waitForTimeout(500) | ||
|
||
await page.getByText('saveState', { exact: true }).click() | ||
const event = await page.waitForEvent('console', (consoleMessage) => consoleMessage.type() === 'info') | ||
const [message] = event.args() | ||
expect(message.toString()).toBe('{state: Blob, thumbnail: Blob}') | ||
}) | ||
|
||
test('load state', async ({ page }) => { | ||
const canvas = page.locator('#canvas') | ||
await expect(canvas).not.toBeAttached() | ||
|
||
await page.getByText('gbc', { exact: true }).click() | ||
await page.waitForLoadState('networkidle') | ||
await page.waitForTimeout(500) | ||
|
||
await expect(canvas).toHaveScreenshot('load-state-pristine.png') | ||
|
||
await canvas.press('Enter', { delay: 500 }) | ||
await expect(canvas).toHaveScreenshot('load-state-touched.png') | ||
|
||
await page.getByText('saveState', { exact: true }).click() | ||
await page.waitForEvent('console', (consoleMessage) => consoleMessage.type() === 'info') | ||
|
||
await page.getByText('restart', { exact: true }).click() | ||
await expect(canvas).toHaveScreenshot('load-state-pristine.png') | ||
|
||
await page.getByText('loadState', { exact: true }).click() | ||
await page.waitForTimeout(1000) // loading state can be slow | ||
await expect(canvas).toHaveScreenshot('load-state-touched.png') | ||
}) | ||
|
||
test('restart', async ({ page }) => { | ||
const canvas = page.locator('#canvas') | ||
await expect(canvas).not.toBeAttached() | ||
|
||
await page.getByText('nes', { exact: true }).click() | ||
await page.waitForLoadState('networkidle') | ||
await page.waitForTimeout(500) | ||
|
||
await expect(canvas).toHaveScreenshot('restart-pristine.png') | ||
|
||
await canvas.press('Enter', { delay: 500 }) | ||
await expect(canvas).not.toHaveScreenshot('restart-pristine.png') | ||
|
||
await page.getByText('restart', { exact: true }).click() | ||
|
||
await page.waitForTimeout(500) | ||
await expect(canvas).toHaveScreenshot('restart-pristine.png') | ||
}) | ||
|
||
test('pause and resume', async ({ page }) => { | ||
const canvas = page.locator('#canvas') | ||
await expect(canvas).not.toBeAttached() | ||
|
||
await page.getByText('megadrive', { exact: true }).click() | ||
await page.waitForLoadState('networkidle') | ||
await page.waitForTimeout(500) | ||
|
||
await canvas.press('Enter', { delay: 800 }) | ||
|
||
await page.getByText('pause', { exact: true }).click() | ||
await expect(canvas).toHaveScreenshot('pause-and-resume.png') | ||
await page.waitForTimeout(500) | ||
await expect(canvas).toHaveScreenshot('pause-and-resume.png') | ||
|
||
await page.getByText('resume', { exact: true }).click() | ||
await page.waitForTimeout(1000) | ||
await expect(canvas).not.toHaveScreenshot('pause-and-resume.png') | ||
}) | ||
|
||
test('press', async ({ page }) => { | ||
const canvas = page.locator('#canvas') | ||
await expect(canvas).not.toBeAttached() | ||
|
||
await page.getByText('megadrive', { exact: true }).click() | ||
await page.waitForLoadState('networkidle') | ||
await page.waitForTimeout(500) | ||
|
||
await expect(canvas).toHaveScreenshot('press-pristine.png') | ||
|
||
// show the game info | ||
await page.getByText('pressA', { exact: true }).click() | ||
await page.waitForTimeout(300) | ||
await expect(canvas).toHaveScreenshot('press-a.png') | ||
|
||
// hide the game info | ||
await page.getByText('pressA', { exact: true }).click() | ||
await page.waitForTimeout(300) | ||
await expect(canvas).toHaveScreenshot('press-pristine.png') | ||
|
||
// enter the game | ||
await page.getByText('pressStart', { exact: true }).click() | ||
await page.waitForTimeout(300) | ||
await expect(canvas).toHaveScreenshot('press-start.png') | ||
}) | ||
}) |
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
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file modified
BIN
+103 Bytes
(100%)
tests/e2e/snapshots/instance.spec.ts/instance-methods-press/press-a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+45 Bytes
(100%)
tests/e2e/snapshots/instance.spec.ts/instance-methods-press/press-pristine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+242 Bytes
(100%)
tests/e2e/snapshots/instance.spec.ts/instance-methods-press/press-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
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,57 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test.describe('static methods with nightly retroarch', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/tests/e2e/test-page/nightly.html') | ||
}) | ||
|
||
test('launch nes', async ({ page }) => { | ||
const canvas = page.locator('#canvas') | ||
await expect(canvas).not.toBeAttached() | ||
|
||
await page.getByText('nes', { exact: true }).click() | ||
await page.waitForLoadState('networkidle') | ||
await page.waitForTimeout(500) | ||
await expect(canvas).toHaveScreenshot('launch-nes.png') | ||
}) | ||
|
||
test('launch megadrive', async ({ page }) => { | ||
const canvas = page.locator('#canvas') | ||
await expect(canvas).not.toBeAttached() | ||
|
||
await page.getByText('megadrive', { exact: true }).click() | ||
await page.waitForLoadState('networkidle') | ||
await page.waitForTimeout(500) | ||
await expect(canvas).toHaveScreenshot('launch-megadrive.png') | ||
}) | ||
|
||
test('launch gbc', async ({ page }) => { | ||
const canvas = page.locator('#canvas') | ||
await expect(canvas).not.toBeAttached() | ||
|
||
await page.getByText('gbc', { exact: true }).click() | ||
await page.waitForLoadState('networkidle') | ||
await page.waitForTimeout(500) | ||
await expect(canvas).toHaveScreenshot('launch-gbc.png') | ||
}) | ||
|
||
test('launch nestopia', async ({ page }) => { | ||
const canvas = page.locator('#canvas') | ||
await expect(canvas).not.toBeAttached() | ||
|
||
await page.getByText('launchNestopia', { exact: true }).click() | ||
await page.waitForLoadState('networkidle') | ||
await page.waitForTimeout(2000) | ||
await expect(canvas).toHaveScreenshot('launch-nestopia.png') | ||
}) | ||
|
||
test('launch size', async ({ page }) => { | ||
const canvas = page.locator('#canvas') | ||
await expect(canvas).not.toBeAttached() | ||
|
||
await page.getByText('launchSize', { exact: true }).click() | ||
await page.waitForLoadState('networkidle') | ||
await page.waitForTimeout(2000) | ||
await expect(canvas).toHaveScreenshot('launch-size.png') | ||
}) | ||
}) |
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