diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc5e3c3..f54b8f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 @@ -52,7 +52,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 @@ -75,7 +75,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 @@ -102,120 +102,6 @@ jobs: path: python/jupyterlab-chat/dist/jupyterlab_chat* if-no-files-found: error - integration-tests: - name: Integration tests - needs: build_extension - runs-on: ubuntu-latest - - env: - PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Base Setup - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - - - name: Download extension package - uses: actions/download-artifact@v4 - with: - name: jupyterlab_chat-artifacts - - - name: Install the extension - run: | - set -eux - python -m pip install "jupyterlab>=4.0.0,<5" jupyterlab_chat*.whl - - - name: Install dependencies - working-directory: ui-tests - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: 0 - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: jlpm install - - - name: Set up browser cache - uses: actions/cache@v3 - with: - path: | - ${{ github.workspace }}/pw-browsers - key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }} - - - name: Install browser - run: jlpm playwright install chromium - working-directory: ui-tests - - - name: Execute integration tests - working-directory: ui-tests - run: | - jlpm test --retries=2 - - - name: Upload Playwright Test report - if: always() - uses: actions/upload-artifact@v4 - with: - name: jupyterlab_chat-playwright-tests - path: | - ui-tests/test-results - ui-tests/playwright-report - - integration-tests-notebook: - name: Integration tests notebook - needs: build_extension - runs-on: ubuntu-latest - - env: - PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Base Setup - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - - - name: Download extension package - uses: actions/download-artifact@v4 - with: - name: jupyterlab_chat-artifacts - - - name: Install the extension - run: | - set -eux - python -m pip install "notebook>=7.0.0,<8" jupyterlab_chat*.whl - - - name: Install dependencies - working-directory: ui-tests - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: 0 - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: jlpm install - - - name: Set up browser cache - uses: actions/cache@v3 - with: - path: | - ${{ github.workspace }}/pw-browsers - key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }} - - - name: Install browser - run: jlpm playwright install chromium - working-directory: ui-tests - - - name: Execute integration tests - working-directory: ui-tests - run: | - jlpm test:notebook --retries=2 - - - name: Upload Playwright Test report - if: always() - uses: actions/upload-artifact@v4 - with: - name: jupyterlab_chat-notebook-playwright-tests - path: | - ui-tests/test-results - ui-tests/playwright-report - typing-tests: name: Typing test runs-on: ubuntu-latest @@ -240,6 +126,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1 diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml index c583401..ba2a9cd 100644 --- a/.github/workflows/check-release.yml +++ b/.github/workflows/check-release.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 diff --git a/.github/workflows/license-header.yml b/.github/workflows/license-header.yml index 7ed6132..a139763 100644 --- a/.github/workflows/license-header.yml +++ b/.github/workflows/license-header.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml new file mode 100644 index 0000000..8fb00ee --- /dev/null +++ b/.github/workflows/ui-tests.yml @@ -0,0 +1,116 @@ +name: UI tests + +on: + push: + branches: main + pull_request: + branches: '*' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + jupyterlab: + name: jupyterlab + runs-on: ubuntu-latest + + env: + PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + + - name: Install the extension + run: | + set -eux + python -m pip install "jupyterlab>=4.0.0,<5" + ./scripts/dev_install.sh + + - name: Install tests dependencies + working-directory: ui-tests + env: + YARN_ENABLE_IMMUTABLE_INSTALLS: 0 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + run: jlpm install + + - name: Set up browser cache + uses: actions/cache@v3 + with: + path: | + ${{ github.workspace }}/pw-browsers + key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }} + + - name: Install browser + run: jlpm playwright install chromium + working-directory: ui-tests + + - name: Execute integration tests + working-directory: ui-tests + run: | + jlpm test --retries=2 + + - name: Upload Playwright Test report + if: always() + uses: actions/upload-artifact@v4 + with: + name: integration-jupyterlab + path: | + ui-tests/test-results + ui-tests/playwright-report + + notebook: + name: notebook + runs-on: ubuntu-latest + + env: + PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + + - name: Install the extension + run: | + set -eux + python -m pip install "notebook>=7.0.0,<8" + ./scripts/dev_install.sh + + - name: Install dependencies + working-directory: ui-tests + env: + YARN_ENABLE_IMMUTABLE_INSTALLS: 0 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + run: jlpm install + + - name: Set up browser cache + uses: actions/cache@v3 + with: + path: | + ${{ github.workspace }}/pw-browsers + key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }} + + - name: Install browser + run: jlpm playwright install chromium + working-directory: ui-tests + + - name: Execute integration tests + working-directory: ui-tests + run: | + jlpm test:notebook --retries=2 + + - name: Upload Playwright Test report + if: always() + uses: actions/upload-artifact@v4 + with: + name: integration-notebook + path: | + ui-tests/test-results + ui-tests/playwright-report diff --git a/python/jupyterlab-chat/jupyterlab_chat/ychat.py b/python/jupyterlab-chat/jupyterlab_chat/ychat.py index 242687d..d80679d 100644 --- a/python/jupyterlab-chat/jupyterlab_chat/ychat.py +++ b/python/jupyterlab-chat/jupyterlab_chat/ychat.py @@ -21,9 +21,9 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._background_tasks: Set[asyncio.Task] = set() self.dirty = True - self._ydoc["users"] = self._yusers = Map() - self._ydoc["messages"] = self._ymessages = Array() - self._ydoc["metadata"] = self._ymetadata = Map() + self._ydoc["users"] = self._yusers = Map() # type:ignore[var-annotated] + self._ydoc["messages"] = self._ymessages = Array() # type:ignore[var-annotated] + self._ydoc["metadata"] = self._ymetadata = Map() # type:ignore[var-annotated] self._ymessages.observe(self._on_messages_change) # Observe the state to initialize the file as soon as the document is not dirty.