diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9755f56..ad718ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,7 +55,7 @@ jobs: set -eux yarn install yarn run lint:check - + - name: Package the application shell: bash -l {0} run: | @@ -171,6 +171,7 @@ jobs: python=3.10 nodejs=18 yarn=3 + wget - name: Download app package uses: actions/download-artifact@v3 @@ -206,8 +207,9 @@ jobs: - name: Start JupyterHub shell: bash -l {0} + working-directory: frontend/ui-tests run: | - python -m jupyterhub -f ./jupyterhub_config.py & + python -m jupyterhub -f ../../jupyterhub_config.py - name: Wait for JupyterHub uses: ifaxity/wait-on-action@v1 diff --git a/frontend/ui-tests/playwright.config.js b/frontend/ui-tests/playwright.config.js index 5505f28..5635722 100644 --- a/frontend/ui-tests/playwright.config.js +++ b/frontend/ui-tests/playwright.config.js @@ -3,12 +3,8 @@ module.exports = { reporter: [[process.env.CI ? 'dot' : 'list'], ['html']], use: { baseURL: 'http://localhost:8000', - video: 'retain-on-failure' + video: 'retain-on-failure', + trace: 'on-first-retry' }, - retries: 0, - expect: { - toMatchSnapshot: { - maxDiffPixelRatio: 0.005 - } - } + retries: 1 }; diff --git a/frontend/ui-tests/tests/ui.test.ts b/frontend/ui-tests/tests/ui.test.ts index ad9f85e..2fa6ae6 100644 --- a/frontend/ui-tests/tests/ui.test.ts +++ b/frontend/ui-tests/tests/ui.test.ts @@ -36,6 +36,7 @@ test.describe('tljh_repo2docker UI Tests', () => { await login(page, 'alice'); await page.getByRole('link', { name: 'Servers' }).click(); await page.waitForURL('**/servers'); + await page.waitForTimeout(1000); await page.getByText('No servers are running'); expect(await page.screenshot()).toMatchSnapshot(); }); @@ -43,6 +44,7 @@ test.describe('tljh_repo2docker UI Tests', () => { await login(page, 'alice'); await page.getByRole('link', { name: 'Environments' }).click(); await page.waitForURL('**/environments'); + await page.waitForTimeout(1000); await page.getByText('No environment available'); expect(await page.screenshot()).toMatchSnapshot(); }); diff --git a/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Log-in-with-admin-account-1-linux.png b/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Log-in-with-admin-account-1-linux.png index 64f828b..0a5ec2d 100644 Binary files a/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Log-in-with-admin-account-1-linux.png and b/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Log-in-with-admin-account-1-linux.png differ diff --git a/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Log-in-with-user-account-1-linux.png b/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Log-in-with-user-account-1-linux.png index 03cb468..d263762 100644 Binary files a/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Log-in-with-user-account-1-linux.png and b/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Log-in-with-user-account-1-linux.png differ diff --git a/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Render-Login-1-linux.png b/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Render-Login-1-linux.png index c8b1c69..e516d04 100644 Binary files a/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Render-Login-1-linux.png and b/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Render-Login-1-linux.png differ diff --git a/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Render-environments-page-1-linux.png b/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Render-environments-page-1-linux.png index 149ba83..a55ab21 100644 Binary files a/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Render-environments-page-1-linux.png and b/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Render-environments-page-1-linux.png differ diff --git a/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Render-servers-page-1-linux.png b/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Render-servers-page-1-linux.png index 488a24c..73628f0 100644 Binary files a/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Render-servers-page-1-linux.png and b/frontend/ui-tests/tests/ui.test.ts-snapshots/tljh-repo2docker-UI-Tests-Render-servers-page-1-linux.png differ diff --git a/tljh_repo2docker/__init__.py b/tljh_repo2docker/__init__.py index 4e64338..90b2466 100644 --- a/tljh_repo2docker/__init__.py +++ b/tljh_repo2docker/__init__.py @@ -1,4 +1,5 @@ import os +from typing import Any, Coroutine, Optional from aiodocker import Docker from dockerspawner import DockerSpawner @@ -157,6 +158,19 @@ async def set_limits(self): ) +class Temp(CacheControlStaticFilesHandler): + def initialize(self, path: str, default_filename: str | None = None) -> None: + print("AAAAAAAAA PATH IS", os.path.dirname(__file__), path) + return super().initialize(path, default_filename) + + async def get(self, path: str, include_body: bool = True) -> None: + temp = self.parse_url_path(path) + aa = self.get_absolute_path(self.root, temp) + print("@###############", self.root, path, aa, flush=True) + + return await super().get(path, include_body) + + class Repo2DockerSpawner(SpawnerMixin, DockerSpawner): """ A custom spawner for using local Docker images built with tljh-repo2docker. @@ -203,7 +217,7 @@ def tljh_custom_jupyterhub_config(c): (r"api/environments/([^/]+)/logs", LogsHandler), ( r"environments-static/(.*)", - CacheControlStaticFilesHandler, + Temp, {"path": os.path.join(os.path.dirname(__file__), "static")}, ), ]