Skip to content

Commit

Permalink
debug test
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Jan 23, 2024
1 parent 58654f1 commit 78b3ca4
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 60 deletions.
109 changes: 60 additions & 49 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,54 +100,54 @@ jobs:
shell: bash -l {0}
run: python -c "import tljh_repo2docker"

unit-tests:
name: Unit tests
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
jupyterhub-version: [latest, 1.2.2]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: "1.5.5-0"
environment-name: tljh
init-shell: bash
create-args: >-
python=${{ matrix.python-version }}
nodejs=18
yarn=3
- name: Download app package
uses: actions/download-artifact@v3
with:
name: tljh_repo2docker-artifacts

- name: Install package
shell: bash -l {0}
run: |
set -eux
python -m pip install -r dev-requirements.txt
python -m pip install tljh_repo2docker*.whl
npm -g install configurable-http-proxy
- name: Downgrade jupyterhub
if: ${{ matrix.jupyterhub-version != 'latest' }}
shell: bash -l {0}
run: |
python -m pip install -U 'jupyterhub==${{ matrix.jupyterhub-version }}'
- name: Run Tests
shell: bash -l {0}
run: |
python -m pytest --cov
# unit-tests:
# name: Unit tests
# needs: build
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# python-version: ["3.8", "3.9", "3.10"]
# jupyterhub-version: [latest, 1.2.2]

# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: Set up Python ${{ matrix.python-version }}
# uses: mamba-org/setup-micromamba@v1
# with:
# micromamba-version: "1.5.5-0"
# environment-name: tljh
# init-shell: bash
# create-args: >-
# python=${{ matrix.python-version }}
# nodejs=18
# yarn=3

# - name: Download app package
# uses: actions/download-artifact@v3
# with:
# name: tljh_repo2docker-artifacts

# - name: Install package
# shell: bash -l {0}
# run: |
# set -eux
# python -m pip install -r dev-requirements.txt
# python -m pip install tljh_repo2docker*.whl
# npm -g install configurable-http-proxy

# - name: Downgrade jupyterhub
# if: ${{ matrix.jupyterhub-version != 'latest' }}
# shell: bash -l {0}
# run: |
# python -m pip install -U 'jupyterhub==${{ matrix.jupyterhub-version }}'

# - name: Run Tests
# shell: bash -l {0}
# run: |
# python -m pytest --cov

integration-tests:
name: Integration tests
Expand All @@ -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,7 +207,7 @@ jobs:

- name: Start JupyterHub
shell: bash -l {0}
run: |
run: |
python -m jupyterhub -f ./jupyterhub_config.py &
- name: Wait for JupyterHub
Expand All @@ -215,6 +216,16 @@ jobs:
resource: http-get://localhost:8000
timeout: 360000

- name: Test file
shell: bash -l {0}
run: |
which python
wget http://localhost:8000
head -10 index.html
wget http://localhost:8000/hub/environments-static/js/react/servers.js
head -1 servers.js
- name: Execute integration tests
shell: bash -l {0}
working-directory: frontend/ui-tests
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
};
19 changes: 15 additions & 4 deletions frontend/ui-tests/tests/ui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test.describe('tljh_repo2docker UI Tests', () => {

test('Render Login', async ({ page }) => {
await page.goto('hub/login');
await page.waitForTimeout(1000);
await page.getByText('Sign in');
expect(await page.screenshot()).toMatchSnapshot();
});
Expand All @@ -34,15 +35,25 @@ test.describe('tljh_repo2docker UI Tests', () => {
});
test('Render servers page', async ({ page }) => {
await login(page, 'alice');
await page.getByRole('link', { name: 'Servers' }).click();
await page.waitForURL('**/servers');
// await page.getByRole('link', { name: 'Servers' }).click();
// await page.waitForURL('**/servers');
await page.goto('hub/servers');
page.on('console', msg => {
console.log(`Error text: "${msg.text()}"`);
});
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.getByRole('link', { name: 'Environments' }).click();
// await page.waitForURL('**/environments');
await page.goto('hub/environments');
page.on('console', msg => {
console.log(`Error text: "${msg.text()}"`);
});
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.

0 comments on commit 78b3ca4

Please sign in to comment.