Add UI tests for notebook menus

pull/6294/head
Jeremy Tuloup 5 years ago
parent 18aa3b5c23
commit 06a4b48026

@ -0,0 +1,45 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
import path from 'path';
import { test } from './fixtures';
import { expect } from '@playwright/test';
const NOTEBOOK = 'empty.ipynb';
const MENU_PATHS = [
'File',
'File>New',
'Edit',
'View',
'Run',
'Kernel',
'Settings',
'Settings>Theme',
'Help'
];
test.use({ autoGoto: false });
test.describe('Notebook Menus', () => {
test.beforeEach(async ({ page, tmpPath }) => {
await page.contents.uploadFile(
path.resolve(__dirname, `./notebooks/${NOTEBOOK}`),
`${tmpPath}/${NOTEBOOK}`
);
});
MENU_PATHS.forEach(menuPath => {
test(`Open menu item ${menuPath}`, async ({ page, tmpPath }) => {
await page.goto(`notebooks/${tmpPath}/${NOTEBOOK}`);
await page.menu.open(menuPath);
expect(await page.menu.isOpen(menuPath)).toBeTruthy();
const imageName = `opened-menu-${menuPath.replace(/>/g, '-')}.png`;
const menu = await page.menu.getOpenMenu();
expect(await menu.screenshot()).toMatchSnapshot(imageName.toLowerCase());
});
});
});

@ -0,0 +1,33 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "6f7028b9-4d2c-4fa2-96ee-bfa77bbee434",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading…
Cancel
Save