Skip to content

Commit a37883b

Browse files
authored
Merge pull request #616 from SlideRuleEarth/carlos-dev
Carlos dev
2 parents 53a026d + 7e11309 commit a37883b

File tree

11 files changed

+214
-67
lines changed

11 files changed

+214
-67
lines changed

.github/workflows/playwright.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Playwright Tests
2+
on:
3+
push:
4+
branches: [ main, master ]
5+
pull_request:
6+
branches: [ main, master ]
7+
jobs:
8+
test:
9+
timeout-minutes: 60
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: lts/*
16+
- name: Install dependencies
17+
run: npm ci
18+
- name: Install Playwright Browsers
19+
run: npx playwright install --with-deps
20+
- name: Run Playwright tests
21+
run: npx playwright test
22+
- uses: actions/upload-artifact@v4
23+
if: ${{ !cancelled() }}
24+
with:
25+
name: playwright-report
26+
path: playwright-report/
27+
retention-days: 30

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,10 @@ override.tf.json
6767

6868
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
6969
# example: *tfplan*
70+
71+
# Playwright
72+
node_modules/
73+
/test-results/
74+
/playwright-report/
75+
/blob-report/
76+
/playwright/.cache/

package-lock.json

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "sliderule-web-client",
3+
"version": "1.0.0",
4+
"description": "---",
5+
"main": "index.js",
6+
"directories": {
7+
"doc": "docs"
8+
},
9+
"devDependencies": {
10+
"@playwright/test": "^1.54.1",
11+
"@types/node": "^24.0.15"
12+
},
13+
"scripts": {},
14+
"keywords": [],
15+
"author": "",
16+
"license": "ISC"
17+
}
File renamed without changes.

tests/simple_test.spec.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { test, expect } from '@playwright/test';
2+
test.skip(({ browserName }) => browserName === 'webkit', 'Workers not supported in Playwright WebKit');
3+
4+
test.beforeEach(async ({ page }) => {
5+
6+
await page.goto('https://client.slideruleearth.io/');
7+
await page.getByText('Welcome to SlideRule Earth!').click();
8+
await page.getByRole('button', { name: 'Next' }).click();
9+
await page.getByText('Step 1: Zoom In').click();
10+
await page.getByRole('button', { name: 'Next' }).click();
11+
await page.getByText('Step 2: Select a draw tool').click();
12+
await page.getByRole('button', { name: 'Next' }).click();
13+
await page.getByText('Step 3: Draw a region').click();
14+
await page.getByRole('button', { name: 'Next' }).click();
15+
await page.getByText('Step 4: Run SlideRule').click();
16+
await page.getByRole('button', { name: 'Next' }).click();
17+
await page.getByText('That\'s it!').click();
18+
await page.getByRole('button', { name: 'Done' }).click();
19+
await page.getByRole('button', { name: 'Close' }).click();
20+
});
21+
22+
test('test', async ({ page }) => {
23+
await page.getByRole('button', { name: '🔍' }).click();
24+
await page.getByRole('textbox', { name: 'Search for' }).fill('Goddard Space Flight Center');
25+
await page.getByRole('textbox', { name: 'Search for' }).press('Enter');
26+
await page.getByTitle('Draw a Rectangle by clicking').getByRole('img').click();
27+
//await page.pause();
28+
const canvas = page.locator('canvas').nth(1);
29+
const box = await canvas.boundingBox();
30+
31+
if (!box) {
32+
throw new Error('Canvas bounding box not found. Make sure the canvas is visible.');
33+
}
34+
await page.getByText('+').click();
35+
await page.getByText('+').click();
36+
await page.getByText('+').click(); // Zoom in to ensure the canvas is large enough for interaction
37+
38+
//debugger;
39+
40+
const startX = 575, startY = 350;
41+
const endX = 500, endY = 325;
42+
43+
// 1. Move to the starting point (no click yet)
44+
await page.mouse.move(box.x + startX, box.y + startY);
45+
46+
// 2. Mouse down (start "drag")
47+
await page.mouse.down();
48+
49+
// 3. Move to the ending point ("drag")
50+
await page.mouse.move(box.x + endX, box.y + endY, { steps: 10 });
51+
52+
// 4. Mouse up (release, finish drag)
53+
await page.mouse.up();
54+
55+
// Click "Run SlideRule"
56+
await page.getByRole('button', { name: ' Run SlideRule' }).click();
57+
58+
// Wait for navigation (optional, depends on app behavior)
59+
await page.waitForURL('**/analyze/1', { timeout: 180000 }); // waits up to 3 minutes
60+
61+
//await page.pause();
62+
//debugger;
63+
await expect(page.getByLabel('1 - atl06p', { exact: true }).getByLabel('h_mean', { exact: true })).toMatchAriaSnapshot(`- combobox "h_mean"`);
64+
65+
});
66+
test.setTimeout(180000); // Set timeout to 3 minutes for the test

web-client/package-lock.json

Lines changed: 0 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web-client/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
"zod": "^3.25.67"
5656
},
5757
"devDependencies": {
58-
"@playwright/test": "^1.54.1",
5958
"@rushstack/eslint-patch": "^1.10.4",
6059
"@tsconfig/node18": "^18.2.4",
6160
"@types/colormap": "^2.3.4",

0 commit comments

Comments
 (0)