Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Jan 22, 2024
1 parent 756601d commit 165e558
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/ui-tests/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
retries: 0,
expect: {
toMatchSnapshot: {
maxDiffPixelRatio: 0.02,
maxDiffPixelRatio: 0.005,
},
}
};
35 changes: 34 additions & 1 deletion frontend/ui-tests/tests/ui.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { expect, test } from '@playwright/test';
import { expect, test, Page } from '@playwright/test';

async function login(page: Page, user: string) {
await page.goto('hub/login');
await page.getByText('Sign in');
await page.getByLabel('Username:').fill(user);
await page.getByLabel('Password:').fill('123');
await page.getByRole('button', { name: 'Sign in' }).click();
await page.getByRole('link', { name: 'JupyterHub logo' });
}
test.describe('tljh_repo2docker UI Tests', () => {
test.beforeEach(({ page }) => {
page.setDefaultTimeout(60000);
Expand All @@ -14,4 +22,29 @@ test.describe('tljh_repo2docker UI Tests', () => {
await page.getByText('Sign in');
expect(await page.screenshot()).toMatchSnapshot();
});

test('Log in with admin account', async ({ page }) => {
await login(page, 'alice');
expect(await page.screenshot()).toMatchSnapshot();
});

test('Log in with user account', async ({ page }) => {
await login(page, 'user');
expect(await page.screenshot()).toMatchSnapshot();
});
test('Render servers page', async ({ page }) => {
await login(page, 'alice');
await page.getByRole('link', { name: 'Servers' }).click();
// await page.getByRole('button', { name: 'Create new Server' });
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.waitForTimeout(1000)
await page.getByText('No environment available');
expect(await page.screenshot()).toMatchSnapshot();
});
});
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.

0 comments on commit 165e558

Please sign in to comment.