Sfoglia il codice sorgente

Start testing the debugger with Galata (#10359)

* Install xeus-python in the UI group on CI

* Update to @jupyterlab/galata 3.0.7-7

* Update reference screenshots to include xeus-python

* Add a simple debugger test suite

* Lint

* Use ipykernel prerelease for the UI tests

* Add ipykernel pre-release to the UI test instructions

* Rename CI group to ui-tests for consistency

* Update reference screenshots
Jeremy Tuloup 3 anni fa
parent
commit
73cf118c2a

+ 2 - 2
.github/workflows/ui-tests.yml

@@ -3,12 +3,12 @@ name: UI Tests
 on: [push, pull_request]
 
 jobs:
-  ui-test:
+  ui-tests:
     name: Visual Regression
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        group: [ui_test]
+        group: [ui-tests]
         python: [3.8]
       fail-fast: false
 

+ 6 - 0
scripts/ci_install.sh

@@ -55,6 +55,12 @@ if [[ $GROUP == js-debugger ]]; then
     pip install xeus-python">=0.9.0,<0.10.0"
 fi
 
+# The UI tests use ipykernel with support for debugging, to not
+# extra launcher items and other UI elements to the reference screenshots
+if [[ $GROUP == ui-tests ]]; then
+    pip install --pre --upgrade ipykernel
+fi
+
 # Pin the jedi dependency to prevent a temporary breakage
 # See https://github.com/ipython/ipython/issues/12740, https://github.com/ipython/ipython/pull/12751
 pip install 'jedi<0.18'

+ 3 - 0
ui-tests/README.md

@@ -16,6 +16,9 @@ import { galata, describe, test } from '@jupyterlab/galata';
 5. If you added visual regression tests, make sure you tested them locally enough number of times to make sure they do not produce false positives due to async nature of UI actions. Use the following steps to test locally.
 
 ```bash
+# install the ipykernel pre-release with support for debugging
+python -m pip install --pre --upgrade ipykernel
+
 # inside ui-tests directory:
 
 # install dependencies

+ 1 - 1
ui-tests/package.json

@@ -14,6 +14,6 @@
   "author": "Project Jupyter",
   "license": "BSD-3-Clause",
   "dependencies": {
-    "@jupyterlab/galata": "3.0.7-6"
+    "@jupyterlab/galata": "3.0.7-7"
   }
 }

BIN
ui-tests/reference-output/screenshots/general_dark_theme.png


BIN
ui-tests/reference-output/screenshots/general_filebrowser_right.png


BIN
ui-tests/reference-output/screenshots/general_launch.png


BIN
ui-tests/reference-output/screenshots/general_simple_mode.png


BIN
ui-tests/reference-output/screenshots/notebook_create_opened_menu_help.png


+ 29 - 0
ui-tests/tests/debugger.test.ts

@@ -0,0 +1,29 @@
+// Copyright (c) Jupyter Development Team.
+// Distributed under the terms of the Modified BSD License.
+
+import { describe, galata, test } from '@jupyterlab/galata';
+
+jest.setTimeout(60000);
+
+describe('Debugger Tests', () => {
+  beforeAll(async () => {
+    await galata.resetUI();
+    galata.context.capturePrefix = 'debugger';
+  });
+
+  afterAll(async () => {
+    galata.context.capturePrefix = '';
+  });
+
+  test('Move Debugger to right', async () => {
+    await galata.sidebar.moveTabToRight('jp-debugger-sidebar');
+    expect(await galata.sidebar.getTabPosition('jp-debugger-sidebar')).toBe(
+      'right'
+    );
+  });
+
+  test('Open Debugger on right', async () => {
+    await galata.sidebar.openTab('jp-debugger-sidebar');
+    expect(await galata.sidebar.isTabOpen('jp-debugger-sidebar')).toBeTruthy();
+  });
+});

+ 10 - 4
ui-tests/yarn.lock

@@ -472,10 +472,10 @@
     "@types/yargs" "^15.0.0"
     chalk "^3.0.0"
 
-"@jupyterlab/galata@3.0.7-6":
-  version "3.0.7-6"
-  resolved "https://registry.yarnpkg.com/@jupyterlab/galata/-/galata-3.0.7-6.tgz#327e5fefb7d9a525372fd134b000134a62407f79"
-  integrity sha512-6zg3DDm3jEhdVGrD9Q/hJ8lHgYnRva/8eF3os92N5x6xam7qn/ZJA8QMAWVS3YmtQqzQksNvJS19ULBtK46m/g==
+"@jupyterlab/galata@3.0.7-7":
+  version "3.0.7-7"
+  resolved "https://registry.yarnpkg.com/@jupyterlab/galata/-/galata-3.0.7-7.tgz#981deeda09b1a25496cef5746aebb20cea8883cf"
+  integrity sha512-OLr5fTSdGdHWoa13NYNpszCFdfwJ4ri8sDP/DFCFAVSl/3tzzp3EvJTgH4CI3VMvJjukeXtcfGSD5K11ofUq6Q==
   dependencies:
     "@types/dateformat" "^3.0.1"
     "@types/jest" "^25.1.2"
@@ -483,6 +483,7 @@
     "@types/node" "^13.1.1"
     "@types/pixelmatch" "^5.0.0"
     "@types/pngjs" "^3.4.1"
+    "@yarnpkg/lockfile" "^1.1.0"
     ansi_up "^5.0.0"
     axios "^0.21.1"
     chalk "^4.0.0"
@@ -653,6 +654,11 @@
   dependencies:
     "@types/node" "*"
 
+"@yarnpkg/lockfile@^1.1.0":
+  version "1.1.0"
+  resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31"
+  integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==
+
 abab@^2.0.0:
   version "2.0.5"
   resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a"