Skip to content

Commit

Permalink
Test that litegitpuller is not activated if nbgitpuller is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
brichet committed Jul 23, 2024
1 parent 08fec45 commit 9bdad4c
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 4 deletions.
27 changes: 26 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
- name: Execute integration tests
working-directory: ui-tests
run: |
jlpm playwright test
jlpm playwright test --project general
- name: Upload Playwright Test report
if: always()
Expand All @@ -139,6 +139,31 @@ jobs:
ui-tests/test-results
ui-tests/playwright-report
nbgitpuller-test:
name: nbgitpuller tests
needs: integration-tests
runs-on: ubuntu-latest

env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers

steps:
- name: Install nbgitpuller
run: pip install nbgitpuller

- name: Execute test
working-directory: ui-tests
run: jlpm playwright test --project nbgitpuller

- name: Upload Test report
if: failure()
uses: actions/upload-artifact@v3
with:
name: litegitpuller-nbgitpuller-tests
path: |
ui-tests/test-results
ui-tests/playwright-report
check_links:
name: Check Links
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const gitPullerExtension: JupyterFrontEndPlugin<void> = {
) => {
if (await testNbGitPuller()) {
console.log(
'@jupyterlite/litegitpuller is not activated to avoid conflict with nbgitpuller'
'@jupyterlite/litegitpuller is not activated, to avoid conflict with nbgitpuller'
);
return;
}
Expand Down
23 changes: 23 additions & 0 deletions ui-tests/nbgitpuller_test/test.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { expect, test } from '@jupyterlab/galata';

/**
* Don't load JupyterLab webpage before running the tests.
* This is required to ensure we capture all log messages.
*/
test.use({ autoGoto: false });

test('should emit an activation console message', async ({ page }) => {
const logs: string[] = [];

page.on('console', message => {
logs.push(message.text());
});

await page.goto();

expect(
logs.filter(
s => s === '@jupyterlite/litegitpuller is not activated, to avoid conflict with nbgitpuller'
)
).toHaveLength(1);
});
3 changes: 2 additions & 1 deletion ui-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"private": true,
"scripts": {
"start": "jupyter lab --config jupyter_server_test_config.py",
"test": "jlpm playwright test",
"test": "jlpm playwright test --project general",
"test:nbgitpuller": "jlpm playwright test --project nbgitpuller",
"test:update": "jlpm playwright test --update-snapshots"
},
"devDependencies": {
Expand Down
12 changes: 11 additions & 1 deletion ui-tests/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@ module.exports = {
url: 'http://localhost:8888/lab',
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI
}
},
projects: [
{
name: 'general',
testMatch: 'tests/*.spec.ts'
},
{
name: 'nbgitpuller',
testMatch: 'nbgitpuller_test/*.spec.ts'
}
]
};

0 comments on commit 9bdad4c

Please sign in to comment.