forked from jupyterlab/jupyterlab
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport PR jupyterlab#15524: Fix visual tests
* Try to make the test terminal snapshot more robust by mock `tree . -L 2` command * Workaround `test-` dirs issue by capturing `/data` instead of `/` * Update Playwright Snapshots * Run customization docs snapshots in serial * Ignore all test files in galata tests * Update Playwright Snapshots * Disable concurrency in `build:examples` to fix flaky test This was already use in `build:src` * Ensure no flaky focus indicator on snapshot (cherry picked from commit c26a0e7)
- Loading branch information
1 parent
3ce0331
commit bf2e51f
Showing
12 changed files
with
170 additions
and
104 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,37 @@ | ||
$ tree . -L 2 | ||
. | ||
├── LICENSE | ||
├── README.md | ||
├── data | ||
│ ├── 1024px-Hubble_Interacting_Galaxy_AM_0500-620_(2008-04-24).jpg | ||
│ ├── Dockerfile | ||
│ ├── Museums_in_DC.geojson | ||
│ ├── README.md | ||
│ ├── bar.vl.json | ||
│ ├── iris.csv | ||
│ ├── japan_meterological_agency_201707211555.json | ||
│ └── zika_assembled_genomes.fasta | ||
├── jupyter_notebook_config.py | ||
├── narrative | ||
│ ├── QConAI.md | ||
│ ├── jupyterlab.md | ||
│ ├── markdown_python.md | ||
│ └── scipy2017.md | ||
├── notebooks | ||
│ ├── Cpp.ipynb | ||
│ ├── Data.ipynb | ||
│ ├── Fasta.ipynb | ||
│ ├── Julia.ipynb | ||
│ ├── Lorenz.ipynb | ||
│ ├── R.ipynb | ||
│ ├── audio | ||
│ ├── images | ||
│ └── lorenz.py | ||
├── slides | ||
│ ├── jupyterlab-slides.key | ||
│ ├── jupyterlab-slides.pdf | ||
│ └── jupyterlab-slides_scipy19.pdf | ||
├── talks.yml | ||
└── tasks.py | ||
|
||
6 directories, 27 files |
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,113 @@ | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
|
||
import { expect, galata, test } from '@jupyterlab/galata'; | ||
import { setSidebarWidth } from './utils'; | ||
|
||
test.use({ | ||
autoGoto: false, | ||
mockState: galata.DEFAULT_DOCUMENTATION_STATE, | ||
viewport: { height: 720, width: 1280 } | ||
}); | ||
|
||
// Use serial mode to avoid flaky screenshots | ||
test.describe.configure({ mode: 'serial' }); | ||
|
||
test.describe('Overview', () => { | ||
test('Overview', async ({ page }) => { | ||
await galata.Mock.freezeContentLastModified(page); | ||
await openOverview(page); | ||
|
||
expect(await page.screenshot()).toMatchSnapshot('interface_jupyterlab.png'); | ||
}); | ||
|
||
test('Open tabs', async ({ page }) => { | ||
await openOverview(page); | ||
|
||
await page.click('[title="Running Terminals and Kernels"]'); | ||
|
||
await page | ||
.locator( | ||
'.jp-RunningSessions-item.jp-mod-kernel >> text="Python 3 (ipykernel)"' | ||
) | ||
.waitFor(); | ||
expect( | ||
await page.screenshot({ clip: { y: 27, x: 0, width: 283, height: 400 } }) | ||
).toMatchSnapshot('interface_tabs.png'); | ||
}); | ||
|
||
test('Tabs menu', async ({ page }) => { | ||
await galata.Mock.freezeContentLastModified(page); | ||
await openOverview(page); | ||
|
||
await page.click('text="Tabs"'); | ||
|
||
expect( | ||
await page.screenshot({ clip: { y: 0, x: 210, width: 700, height: 350 } }) | ||
).toMatchSnapshot('interface_tabs_menu.png'); | ||
}); | ||
}); | ||
|
||
async function openOverview(page) { | ||
await page.goto(); | ||
await page.addStyleTag({ | ||
content: `.jp-LabShell.jp-mod-devMode { | ||
border-top: none; | ||
}` | ||
}); | ||
|
||
await setSidebarWidth(page); | ||
|
||
// Open Data.ipynb | ||
await page.dblclick('[aria-label="File Browser Section"] >> text=notebooks'); | ||
await page.dblclick('text=Data.ipynb'); | ||
|
||
// Back home | ||
await page.click('.jp-BreadCrumbs-home svg'); | ||
|
||
// Open jupyterlab.md | ||
await page.dblclick('[aria-label="File Browser Section"] >> text=narrative'); | ||
await page.click('text=jupyterlab.md', { | ||
button: 'right' | ||
}); | ||
await page.click('text=Open With'); | ||
await page.click('text=Markdown Preview'); | ||
|
||
// Back home | ||
await page.click('.jp-BreadCrumbs-home svg'); | ||
|
||
// Open bar.vl.json | ||
await page.dblclick('[aria-label="File Browser Section"] >> text=data'); | ||
await page.dblclick('text=bar.vl.json'); | ||
await page.dblclick( | ||
'text=1024px-Hubble_Interacting_Galaxy_AM_0500-620_(2008-04-24).jpg' | ||
); | ||
|
||
// Move notebook panel | ||
const notebookHandle = await page.$('div[role="main"] >> text=Data.ipynb'); | ||
await notebookHandle.click(); | ||
const notebookBBox = await notebookHandle.boundingBox(); | ||
|
||
await page.mouse.move( | ||
notebookBBox.x + 0.5 * notebookBBox.width, | ||
notebookBBox.y + 0.5 * notebookBBox.height | ||
); | ||
await page.mouse.down(); | ||
await page.mouse.move(notebookBBox.x + 0.5 * notebookBBox.width, 350); | ||
await page.mouse.up(); | ||
|
||
// Move md panel | ||
const mdHandle = await page.$('div[role="main"] >> text=jupyterlab.md'); | ||
await mdHandle.click(); | ||
const mdBBox = await mdHandle.boundingBox(); | ||
const panelHandle = await page.activity.getPanel(); | ||
const panelBBox = await panelHandle.boundingBox(); | ||
|
||
await page.mouse.move( | ||
mdBBox.x + 0.5 * mdBBox.width, | ||
mdBBox.y + 0.5 * mdBBox.height | ||
); | ||
await page.mouse.down(); | ||
await page.mouse.move(panelBBox.x + 0.5 * panelBBox.width, 200); | ||
await page.mouse.up(); | ||
} |
File renamed without changes
File renamed without changes
File renamed without changes
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