|
| 1 | +import { test, expect } from "@playwright/test" |
| 2 | + |
| 3 | +const currentTime = Date.now() |
| 4 | + |
| 5 | +const url1 = "chrome://gpu/" |
| 6 | +const url2 = "https://www.soft8soft.com/webglreport" |
| 7 | +const url3 = "https://webglsamples.org/aquarium/aquarium.html" |
| 8 | + |
| 9 | +function waitFor(delay: number) { |
| 10 | + return new Promise(resolve => setTimeout(resolve, delay)) |
| 11 | +} |
| 12 | + |
| 13 | +test.beforeEach(async (_, testInfo) => { |
| 14 | + testInfo.setTimeout(testInfo.timeout + 160000) |
| 15 | +}) |
| 16 | + |
| 17 | +test.describe("Testing 123", () => { |
| 18 | + // Check if hardware acceleration is enabled. Without it, our tests will be much slower. |
| 19 | + test("1. GPU hardware acceleration", async ({ page }) => { |
| 20 | + await page.goto(url1) |
| 21 | + const featureStatusList = page.locator(".feature-status-list") |
| 22 | + |
| 23 | + await waitFor(2000) |
| 24 | + await page.screenshot({ |
| 25 | + path: "screens/screenshot" + currentTime + "_1.png", |
| 26 | + fullPage: true, |
| 27 | + }) |
| 28 | + |
| 29 | + await expect(featureStatusList).toContainText("Hardware accelerated") |
| 30 | + }) |
| 31 | + |
| 32 | + test("2. webgl report", async ({ page }) => { |
| 33 | + await page.goto(url2) |
| 34 | + |
| 35 | + await waitFor(2000) |
| 36 | + await page.screenshot({ |
| 37 | + path: "screens/screenshot" + currentTime + "_2.png", |
| 38 | + fullPage: true, |
| 39 | + }) |
| 40 | + }) |
| 41 | + |
| 42 | + test("3. aquarium", async ({ page }) => { |
| 43 | + await page.goto(url3) |
| 44 | + |
| 45 | + await waitFor(5000) |
| 46 | + await page.screenshot({ |
| 47 | + path: "screens/screenshot" + currentTime + "_3.png", |
| 48 | + fullPage: true, |
| 49 | + }) |
| 50 | + }) |
| 51 | +}) |
0 commit comments