Skip to content

Commit 3ba23e4

Browse files
author
Nicolas Brichet
committed
Set up UI test on labextensions
1 parent 9d65c10 commit 3ba23e4

27 files changed

+140
-3181
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,8 @@ package-lock.json
120120
.goutputstream*
121121
.idea
122122
.mypy_cache
123+
124+
125+
# playwright output tests directory
126+
playwright-report
127+
test-results

conftest.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import pytest
2+
3+
pytest_plugins = ["jupyter_server.pytest_plugin"]
4+
5+
6+
@pytest.fixture
7+
def jp_server_config(jp_server_config):
8+
return {"ServerApp": {"jpserver_extensions": {"nbgrader": True}}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""Server configuration for integration tests.
2+
!! Never use this configuration in production because it
3+
opens the server to the world and provide access to JupyterLab
4+
JavaScript objects through the global window variable.
5+
"""
6+
from tempfile import mkdtemp
7+
8+
c.ServerApp.port = 8888
9+
c.ServerApp.port_retries = 0
10+
c.ServerApp.open_browser = False
11+
12+
c.ServerApp.root_dir = mkdtemp(prefix="galata-test-")
13+
c.ServerApp.token = ""
14+
c.ServerApp.password = ""
15+
c.ServerApp.disable_check_xsrf = True
16+
c.LabApp.expose_app_in_browser = True
17+
18+
# Uncomment to set server log level to debug level
19+
# c.ServerApp.log_level = "DEBUG"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { test, galata } from '@jupyterlab/galata';
2+
import { expect } from '@playwright/test';
3+
4+
test('Assignment list command', async ({
5+
page
6+
}) => {
7+
8+
await expect(page.locator("#jp-main-dock-panel .lm-TabBar-tab.p-TabBar-tab")).toHaveCount(1);
9+
10+
await page.keyboard.press('Control+Shift+c');
11+
await page.locator('#modal-command-palette li[data-command="nbgrader:assignment-list"]').click();
12+
13+
await expect(page.locator("#jp-main-dock-panel .lm-TabBar-tab.p-TabBar-tab")).toHaveCount(2);
14+
15+
var tabs = page.locator("#jp-main-dock-panel .lm-TabBar-tab.p-TabBar-tab");
16+
var newTab_label = tabs.last().locator(".lm-TabBar-tabLabel.p-TabBar-tabLabel");
17+
await expect(newTab_label).toHaveText("Assignments");
18+
19+
}
20+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { test, galata } from '@jupyterlab/galata';
2+
import { expect } from '@playwright/test';
3+
4+
test('Course list command', async ({
5+
page
6+
}) => {
7+
8+
await expect(page.locator("#jp-main-dock-panel .lm-TabBar-tab.p-TabBar-tab")).toHaveCount(1);
9+
10+
await page.keyboard.press('Control+Shift+c');
11+
await page.locator('#modal-command-palette li[data-command="nbgrader:course-list"]').click();
12+
13+
await expect(page.locator("#jp-main-dock-panel .lm-TabBar-tab.p-TabBar-tab")).toHaveCount(2);
14+
15+
var tabs = page.locator("#jp-main-dock-panel .lm-TabBar-tab.p-TabBar-tab");
16+
var newTab_label = tabs.last().locator(".lm-TabBar-tabLabel.p-TabBar-tabLabel");
17+
await expect(newTab_label).toHaveText("Courses");
18+
19+
}
20+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { test, galata } from '@jupyterlab/galata';
2+
import { expect } from '@playwright/test';
3+
4+
test('Formgrader command', async ({
5+
page
6+
}) => {
7+
8+
await expect(page.locator("#jp-main-dock-panel .lm-TabBar-tab.p-TabBar-tab")).toHaveCount(1);
9+
10+
await page.keyboard.press('Control+Shift+c');
11+
await page.locator('#modal-command-palette li[data-command="nbgrader:formgrader"]').click();
12+
13+
await expect(page.locator("#jp-main-dock-panel .lm-TabBar-tab.p-TabBar-tab")).toHaveCount(2);
14+
15+
var tabs = page.locator("#jp-main-dock-panel .lm-TabBar-tab.p-TabBar-tab");
16+
var newTab_label = tabs.last().locator(".lm-TabBar-tabLabel.p-TabBar-tabLabel");
17+
await expect(newTab_label).toHaveText("Formgrader");
18+
19+
}
20+
);

nbgrader/tests/labextensions/__init__.py

Whitespace-only changes.

nbgrader/tests/labextensions/conftest.py

-239
This file was deleted.

nbgrader/tests/labextensions/files/blank.ipynb

-30
This file was deleted.

nbgrader/tests/labextensions/files/data.txt

-4
This file was deleted.

0 commit comments

Comments
 (0)