-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ Add basic playwright tests for Aladin Lite UI
- Loading branch information
Showing
12 changed files
with
217 additions
and
53 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Playwright Tests | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches: | ||
- develop | ||
workflow_dispatch: | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
components: rust-src | ||
- name: Install wasm-pack | ||
run: cargo install wasm-pack --version ~0.12 | ||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: npx playwright test | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
This file was deleted.
Oops, something went wrong.
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,66 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
/** | ||
* Read environment variables from file. | ||
* https://github.com/motdotla/dotenv | ||
*/ | ||
// import dotenv from 'dotenv'; | ||
// dotenv.config({ path: path.resolve(__dirname, '.env') }); | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: './tests', | ||
fullyParallel: true, | ||
retries: 0, | ||
workers: 10, | ||
reporter: 'html', | ||
use: { | ||
trace: 'on-first-retry', | ||
}, | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
|
||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
// { | ||
// name: 'webkit', | ||
// use: { ...devices['Desktop Safari'] }, | ||
// }, | ||
|
||
/* Test against mobile viewports. */ | ||
// { | ||
// name: 'Mobile Chrome', | ||
// use: { ...devices['Pixel 5'] }, | ||
// }, | ||
// { | ||
// name: 'Mobile Safari', | ||
// use: { ...devices['iPhone 12'] }, | ||
// }, | ||
|
||
/* Test against branded browsers. */ | ||
// { | ||
// name: 'Microsoft Edge', | ||
// use: { ...devices['Desktop Edge'], channel: 'msedge' }, | ||
// }, | ||
// { | ||
// name: 'Google Chrome', | ||
// use: { ...devices['Desktop Chrome'], channel: 'chrome' }, | ||
// }, | ||
], | ||
|
||
/* Run your local dev server before starting the tests */ | ||
webServer: { | ||
command: 'npm run dev', | ||
url: 'http://localhost:5173/examples/index.html', | ||
reuseExistingServer: true, | ||
timeout: 120000, | ||
}, | ||
}); |
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,41 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width, height=device-height, maximum-scale=1.0, initial-scale=1.0, user-scalable=no"> | ||
</head> | ||
<body> | ||
<div id="aladin-lite-div" style="width: 500px; height: 500px"></div> | ||
|
||
<script type="text/javascript" src="./../dist/aladin.umd.cjs" charset="utf-8"></script> | ||
<script type="text/javascript"> | ||
var aladin; | ||
A.init.then(() => { | ||
aladin = A.aladin('#aladin-lite-div', | ||
{ | ||
fullScreen: true, | ||
cooFrame: "ICRSd", | ||
survey: "P/DSS2/color", | ||
fov: 180, | ||
showSimbadPointerControl: false, | ||
showShareControl: false, | ||
showContextMenu: false, | ||
showCatalog: false, | ||
showFov: false, | ||
showCooGrid: false, | ||
showFrame: false, | ||
showCooGridControl: false, | ||
showCooLocation: false, | ||
showFullscreenControl: false, | ||
showLayersControl: false, | ||
showProjectionControl: false, | ||
showReticle: false, | ||
showSettingsControl: false, | ||
showStatusBar: false, | ||
showZoomControl: false, | ||
} | ||
); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
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,41 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width, height=device-height, maximum-scale=1.0, initial-scale=1.0, user-scalable=no"> | ||
</head> | ||
<body> | ||
<div id="aladin-lite-div" style="width: 500px; height: 500px"></div> | ||
|
||
<script type="text/javascript" src="./../dist/aladin.umd.cjs" charset="utf-8"></script> | ||
<script type="text/javascript"> | ||
var aladin; | ||
A.init.then(() => { | ||
aladin = A.aladin('#aladin-lite-div', | ||
{ | ||
fullScreen: true, | ||
cooFrame: "ICRSd", | ||
survey: "P/DSS2/color", | ||
fov: 180, | ||
showSimbadPointerControl: true, | ||
showShareControl: true, | ||
showContextMenu: true, | ||
showCatalog: true, | ||
showFov: true, | ||
showCooGrid: true, | ||
showFrame: true, | ||
showCooGridControl: true, | ||
showCooLocation: true, | ||
showFullscreenControl: true, | ||
showLayersControl: true, | ||
showProjectionControl: true, | ||
showReticle: true, | ||
showSettingsControl: true, | ||
showStatusBar: true, | ||
showZoomControl: true, | ||
} | ||
); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
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,27 @@ | ||
import {test, expect, LocatorScreenshotOptions} from '@playwright/test'; | ||
|
||
async function open(page, exampleName) { | ||
await page.goto(`http://localhost:5173/tests/${exampleName}.html`); | ||
} | ||
|
||
const screenshotOptions: LocatorScreenshotOptions = { | ||
type: "png" | ||
}; | ||
|
||
const toMatchOptions = { | ||
maxDiffPixels: 10 | ||
}; | ||
|
||
const pageTimeout = 2000; | ||
|
||
test("al-ui-on", async ({ page }) => { | ||
await open(page, "al-ui-on"); | ||
await page.waitForTimeout(pageTimeout); | ||
expect(await page.locator('canvas').nth(1).screenshot(screenshotOptions)).toMatchSnapshot(toMatchOptions); | ||
}); | ||
|
||
test("al-ui-off", async ({ page }) => { | ||
await open(page, "al-ui-off"); | ||
await page.waitForTimeout(pageTimeout); | ||
expect(await page.locator('canvas').nth(1).screenshot(screenshotOptions)).toMatchSnapshot(toMatchOptions); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.