-
Notifications
You must be signed in to change notification settings - Fork 614
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI: visuail tests by playwright (#950)
* UI: visuail tests initial * addes screenshots * Update visual.spec.ts * remove home screen * details view * better * change timeout * add Dashboards screenshots * added more screenshots for visual testing * remove adults * skip test * check tests * added `--ignore-scripts` * cool, return it back * update readme's img
- Loading branch information
Showing
10 changed files
with
104 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,7 +98,7 @@ jobs: | |
run: pnpm dlx [email protected] install --with-deps | ||
|
||
- name: Run UI | ||
run: evidently ui --port 8000 --demo-projects all --workspace test-workspace & | ||
run: evidently ui --port 8000 --demo-projects bikes,reviews --workspace test-workspace & | ||
|
||
- name: Wait UI to be ready to test | ||
working-directory: ui/service | ||
|
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,91 @@ | ||
import { test, expect, Page } from '@playwright/test' | ||
|
||
const goToFirstSnapshotAndExpanSomeWidgets = async ({ | ||
projectName, | ||
page, | ||
isTestSuite | ||
}: { | ||
page: Page | ||
isTestSuite: boolean | ||
projectName: string | ||
}) => { | ||
await page.getByRole('link', { name: projectName }).click() | ||
await page.getByRole('tab', { name: isTestSuite ? 'Test Suites' : 'Reports' }).click() | ||
await page.getByRole('button', { name: 'View' }).first().click() | ||
await page.waitForLoadState('networkidle') | ||
|
||
const Details = page.getByRole('button', { name: 'Details' }) | ||
await expect(Details.first()).toBeVisible() | ||
|
||
const DetailsCount = await Details.count() | ||
|
||
await Details.first().click() | ||
await page.waitForLoadState('networkidle') | ||
|
||
if (DetailsCount > 1) { | ||
await Details.nth(1).click() | ||
await page.waitForLoadState('networkidle') | ||
} | ||
|
||
if (DetailsCount > 2) { | ||
await Details.last().click() | ||
await page.waitForLoadState('networkidle') | ||
} | ||
|
||
await page.waitForTimeout(1000) | ||
} | ||
|
||
const VisualTestSnapshot = async ({ | ||
page, | ||
projectName, | ||
isTestSuite | ||
}: { | ||
page: Page | ||
projectName: string | ||
isTestSuite: boolean | ||
}) => { | ||
await page.goto('/') | ||
await goToFirstSnapshotAndExpanSomeWidgets({ | ||
page, | ||
projectName, | ||
isTestSuite | ||
}) | ||
|
||
await expect(page).toHaveScreenshot({ fullPage: true, maxDiffPixels: 1800 }) | ||
} | ||
|
||
const VisualTestDashboard = async ({ page, projectName }: { page: Page; projectName: string }) => { | ||
await page.goto('/') | ||
await page.getByRole('link', { name: projectName }).click() | ||
await page.waitForLoadState('networkidle') | ||
await expect(page).toHaveScreenshot({ fullPage: true, maxDiffPixels: 800 }) | ||
} | ||
|
||
const BikesDemoProjectName = 'Demo project - Bikes' | ||
const ReviewsDemoProjectName = 'Demo project - Reviews' | ||
|
||
///////////////////// | ||
/// Dashboards | ||
///////////////////// | ||
test(`${BikesDemoProjectName}: Dashboard`, async ({ page }) => { | ||
await VisualTestDashboard({ page, projectName: BikesDemoProjectName }) | ||
}) | ||
|
||
test(`${ReviewsDemoProjectName}: Dashboard`, async ({ page }) => { | ||
await VisualTestDashboard({ page, projectName: ReviewsDemoProjectName }) | ||
}) | ||
|
||
///////////////////// | ||
/// Snapshots | ||
///////////////////// | ||
test(`${BikesDemoProjectName}: Report`, async ({ page }) => { | ||
await VisualTestSnapshot({ page, projectName: BikesDemoProjectName, isTestSuite: false }) | ||
}) | ||
|
||
test(`${BikesDemoProjectName}: Test Suite`, async ({ page }) => { | ||
await VisualTestSnapshot({ page, projectName: BikesDemoProjectName, isTestSuite: true }) | ||
}) | ||
|
||
test(`${ReviewsDemoProjectName}: Report`, async ({ page }) => { | ||
await VisualTestSnapshot({ page, projectName: ReviewsDemoProjectName, isTestSuite: false }) | ||
}) |
Binary file added
BIN
+275 KB
...ts/visual.spec.ts-snapshots/Demo-project---Bikes-Dashboard-1-chromium-linux.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 added
BIN
+708 KB
...tests/visual.spec.ts-snapshots/Demo-project---Bikes-Report-1-chromium-linux.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 added
BIN
+294 KB
...s/visual.spec.ts-snapshots/Demo-project---Bikes-Test-Suite-1-chromium-linux.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 added
BIN
+459 KB
.../visual.spec.ts-snapshots/Demo-project---Reviews-Dashboard-1-chromium-linux.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 added
BIN
+1.06 MB
...sts/visual.spec.ts-snapshots/Demo-project---Reviews-Report-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.