-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add basic search test with playwright (#31)
* add basic search test with playwright * adhere to linter * add newline * add playwright tests in CI workflow * add files to Manifest * enable playwright tests on CI * rename artifact name * remove previous playwright test invocation * fix jinja issues * install ripgrep for playwright tests
- Loading branch information
1 parent
aabc6ef
commit 971f74c
Showing
8 changed files
with
4,389 additions
and
0 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
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,19 @@ | ||
"""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 tempfile import mkdtemp | ||
|
||
c.ServerApp.port = 8888 | ||
c.ServerApp.port_retries = 0 | ||
c.ServerApp.open_browser = False | ||
|
||
c.ServerApp.root_dir = mkdtemp(prefix="galata-test-") | ||
c.ServerApp.token = "" | ||
c.ServerApp.password = "" | ||
c.ServerApp.disable_check_xsrf = True | ||
c.LabApp.expose_app_in_browser = True | ||
|
||
# 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,14 @@ | ||
{ | ||
"name": "search-replace-ui-tests", | ||
"version": "1.0.0", | ||
"description": "JupyterLab search-replace Integration Tests", | ||
"private": true, | ||
"scripts": { | ||
"start": "jupyter lab --config jupyter_server_test_config.py", | ||
"test": "jlpm playwright test" | ||
}, | ||
"devDependencies": { | ||
"@jupyterlab/galata": "^4.1.0", | ||
"@playwright/test": "^1.19.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,14 @@ | ||
/** | ||
* Configuration for Playwright using default from @jupyterlab/galata | ||
*/ | ||
const baseConfig = require('@jupyterlab/galata/lib/playwright-config'); | ||
|
||
module.exports = { | ||
...baseConfig, | ||
webServer: { | ||
command: 'jlpm start', | ||
url: 'http://localhost:8888/lab', | ||
timeout: 120 * 1000, | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
} |
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,25 @@ | ||
import { test } from '@jupyterlab/galata'; | ||
import { expect } from '@playwright/test'; | ||
|
||
test('test', async ({ page }) => { | ||
// Click #tab-key-0 .lm-TabBar-tabIcon svg >> nth=0 | ||
await page.locator('[title="Search and replace"]').click(); | ||
// Click input[type="search"] | ||
await page.locator('input[type="search"]').click(); | ||
// Fill input[type="search"] | ||
await page.locator('input[type="search"]').fill('strange'); | ||
|
||
await Promise.all([ | ||
page.waitForResponse( | ||
response => | ||
/.*search\/\?query=strange/.test( | ||
response.url() | ||
) && response.request().method() === 'GET' | ||
), | ||
page.locator('input[type="search"]').press('Enter') | ||
]); | ||
|
||
expect( | ||
await page.waitForSelector(`#jp-search-replace >> text=${JSON.stringify({"matches":[]}, undefined, 4)}`) | ||
).toBeTruthy(); | ||
}); |
Oops, something went wrong.