-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ui tests * Add build cache * Run docker in background
- Loading branch information
1 parent
fd7ce53
commit c2ce83d
Showing
10 changed files
with
4,376 additions
and
1 deletion.
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
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,12 @@ | ||
FROM trungleduc/salome-docker:9.10.0 | ||
|
||
ARG MAMBA_DOCKERFILE_ACTIVATE=1 | ||
|
||
WORKDIR /home/$MAMBA_USER/cad | ||
|
||
COPY --chown=$MAMBA_USER:$MAMBA_USER ./jupyter_server_test_config.py ./jupytercad_salome*.whl ./ | ||
|
||
RUN python -m pip install jupyterlab "jupytercad>=1.0.0a4" jupytercad_salome*.whl | ||
|
||
EXPOSE 8888 | ||
CMD source /home/user/salome_src/default_env_launch.sh && jupyter lab --config jupyter_server_test_config.py |
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,14 @@ | ||
"""Server configuration for integration tests. | ||
!! Never use this configuration in production because it | ||
opens the server to the world and provide access to JupyterLab | ||
JavaScript objects through the global window variable. | ||
""" | ||
|
||
from jupyterlab.galata import configure_jupyter_server | ||
|
||
configure_jupyter_server(c) # noqa F821 | ||
c.LabApp.collaborative = True # noqa F821 | ||
c.ServerApp.ip = "0.0.0.0" # noqa F821 | ||
# Uncomment to set server log level to debug level | ||
# c.ServerApp.log_level = "DEBUG" |
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,19 @@ | ||
{ | ||
"name": "jupytercad-salome-ui-tests", | ||
"version": "1.0.0", | ||
"description": "JupyterCad Integration Tests", | ||
"private": true, | ||
"scripts": { | ||
"test": "npx playwright test --workers 1", | ||
"test:update": "npx playwright test --update-snapshots", | ||
"test:debug": "PWDEBUG=1 npx playwright test --workers 1" | ||
}, | ||
"devDependencies": { | ||
"@jupyterlab/galata": "^5.0.8", | ||
"@playwright/test": "^1.32.0", | ||
"@types/klaw-sync": "^6.0.1" | ||
}, | ||
"dependencies": { | ||
"klaw-sync": "^6.0.0" | ||
} | ||
} |
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,23 @@ | ||
/** | ||
* Configuration for Playwright using default from @jupyterlab/galata | ||
*/ | ||
const baseConfig = require('@jupyterlab/galata/lib/playwright-config'); | ||
|
||
module.exports = { | ||
...baseConfig, | ||
webServer: { | ||
url: 'http://localhost:8888/lab', | ||
timeout: 120 * 1000, | ||
reuseExistingServer: true | ||
}, | ||
retries: 1, | ||
use: { | ||
...baseConfig.use, | ||
trace: 'off' | ||
}, | ||
expect: { | ||
toMatchSnapshot: { | ||
maxDiffPixelRatio: 0.02 | ||
} | ||
} | ||
}; |
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,70 @@ | ||
import { expect, test, galata } from '@jupyterlab/galata'; | ||
import path from 'path'; | ||
|
||
test.use({ autoGoto: false }); | ||
|
||
test.describe('UI Test', () => { | ||
test.describe('Extension activation test', () => { | ||
test('should emit an activation console message', async ({ | ||
page, | ||
request | ||
}) => { | ||
const logs: string[] = []; | ||
|
||
page.on('console', message => { | ||
logs.push(message.text()); | ||
}); | ||
|
||
await page.goto(); | ||
|
||
expect( | ||
logs.filter(s => s === 'jupytercad:salome is activated!') | ||
).toHaveLength(1); | ||
}); | ||
}); | ||
|
||
test.describe('Mesh generation test', () => { | ||
let errors = 0; | ||
test.beforeEach(async ({ page }) => { | ||
page.setViewportSize({ width: 1920, height: 1080 }); | ||
page.on('console', message => { | ||
if (message.type() === 'error') { | ||
errors += 1; | ||
} | ||
}); | ||
}); | ||
|
||
test.afterEach(async ({ page }) => { | ||
errors = 0; | ||
}); | ||
|
||
test(`Should be able to create mesh without error`, async ({ page }) => { | ||
await page.goto(); | ||
await page.locator('div.jpcad-Spinner').waitFor({ state: 'hidden' }); | ||
|
||
await page | ||
.getByLabel('notebook content') | ||
.getByText('New JCAD File') | ||
.click(); | ||
await page.getByRole('button', { name: 'New Box' }).click(); | ||
await page.getByRole('button', { name: 'Submit' }).click(); | ||
await page.getByRole('button', { name: 'Mesh creation' }).click(); | ||
await page.getByRole('button', { name: 'Submit' }).click(); | ||
await page.waitForTimeout(1000); | ||
await page | ||
.getByRole('tablist', { name: 'main sidebar' }) | ||
.getByRole('tab', { name: 'JupyterCad Control Panel' }) | ||
.click(); | ||
await page | ||
.getByRole('tablist', { name: 'alternate sidebar' }) | ||
.getByRole('tab', { name: 'JupyterCad Control Panel' }) | ||
.click(); | ||
await page.waitForTimeout(500); | ||
const main = await page.$('#jp-main-split-panel'); | ||
expect(errors).toBe(0); | ||
if (main) { | ||
expect(await main.screenshot()).toMatchSnapshot(); | ||
} | ||
}); | ||
}); | ||
}); |
Binary file added
BIN
+79.2 KB
...st-Mesh-generation-test-Should-be-able-to-create-mesh-without-error-1-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.