Skip to content

Commit

Permalink
debug test
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Jan 24, 2024
1 parent 58654f1 commit bb9e001
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 10 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
set -eux
yarn install
yarn run lint:check
- name: Package the application
shell: bash -l {0}
run: |
Expand Down Expand Up @@ -171,6 +171,7 @@ jobs:
python=3.10
nodejs=18
yarn=3
wget
- name: Download app package
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions frontend/ui-tests/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
2 changes: 2 additions & 0 deletions frontend/ui-tests/tests/ui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ 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();
});
test('Render environments page', async ({ page }) => {
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();
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 15 additions & 1 deletion tljh_repo2docker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from typing import Any, Coroutine, Optional

from aiodocker import Docker
from dockerspawner import DockerSpawner
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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")},
),
]
Expand Down

0 comments on commit bb9e001

Please sign in to comment.