Skip to content

Commit

Permalink
Update UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Mar 15, 2024
1 parent 7da5492 commit cfe5538
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ui-tests/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
retries: 1,
expect: {
toMatchSnapshot: {
maxDiffPixelRatio: 0.01
maxDiffPixelRatio: 0.001
}
},
webServer: {
Expand Down
32 changes: 19 additions & 13 deletions ui-tests/tests/ui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,26 @@ test.describe('tljh_repo2docker UI Tests', () => {

test('Log in with admin account', async ({ page }) => {
await login(page, 'alice');
await page.getByRole('button', { name: 'Services' }).click();
await page.getByRole('link', { name: 'tljh_repo2docker' }).click();
await page.waitForURL('**/servers');
await page.waitForTimeout(500);
expect(await page.screenshot()).toMatchSnapshot('admin.png');
});

test('Log in with user account', async ({ page }) => {
await login(page, 'user');
await page.getByRole('button', { name: 'Services' }).click();
await page.getByRole('link', { name: 'tljh_repo2docker' }).click();
await page.waitForURL('**/servers');
await page.waitForTimeout(500);
expect(await page.screenshot()).toMatchSnapshot('user.png');
});

test('Render servers page', async ({ page }) => {
await login(page, 'alice');
await page.getByRole('link', { name: 'Servers' }).click();
await page.getByRole('button', { name: 'Services' }).click();
await page.getByRole('link', { name: 'tljh_repo2docker' }).click();
await page.waitForURL('**/servers');
await page.waitForTimeout(500);
await page.waitForSelector('div:has-text("No servers are running")', {
Expand All @@ -46,6 +55,9 @@ test.describe('tljh_repo2docker UI Tests', () => {

test('Render environments page', async ({ page }) => {
await login(page, 'alice');
await page.getByRole('button', { name: 'Services' }).click();
await page.getByRole('link', { name: 'tljh_repo2docker' }).click();
await page.waitForURL('**/servers');
await page.getByRole('link', { name: 'Environments' }).click();
await page.waitForURL('**/environments');
await page.waitForTimeout(500);
Expand All @@ -57,8 +69,7 @@ test.describe('tljh_repo2docker UI Tests', () => {

test('Render environments dialog', async ({ page }) => {
await login(page, 'alice');
await page.getByRole('link', { name: 'Environments' }).click();
await page.waitForURL('**/environments');
await page.goto('/services/tljh_repo2docker/environments');
await page.waitForTimeout(1000);
await page.getByRole('button', { name: 'Create new environment' }).click();
await page.waitForTimeout(1000);
Expand All @@ -68,8 +79,7 @@ test.describe('tljh_repo2docker UI Tests', () => {

test('Create new environments', async ({ page }) => {
await login(page, 'alice');
await page.getByRole('link', { name: 'Environments' }).click();
await page.waitForURL('**/environments');
await page.goto('/services/tljh_repo2docker/environments');
await page.waitForTimeout(1000);
await page.getByRole('button', { name: 'Create new environment' }).click();
await page
Expand Down Expand Up @@ -102,8 +112,7 @@ test.describe('tljh_repo2docker UI Tests', () => {

test('Render servers dialog', async ({ page }) => {
await login(page, 'alice');
await page.getByRole('link', { name: 'Servers' }).click();
await page.waitForURL('**/servers');
await page.goto('/services/tljh_repo2docker/servers');
await page.waitForTimeout(500);
await page.waitForSelector('div:has-text("No servers are running")', {
timeout: 1000
Expand All @@ -116,8 +125,7 @@ test.describe('tljh_repo2docker UI Tests', () => {

test('Start server', async ({ page }) => {
await login(page, 'alice');
await page.getByRole('link', { name: 'Servers' }).click();
await page.waitForURL('**/servers');
await page.goto('/services/tljh_repo2docker/servers');
await page.waitForTimeout(500);
await page.waitForSelector('div:has-text("No servers are running")', {
timeout: 1000
Expand All @@ -144,8 +152,7 @@ test.describe('tljh_repo2docker UI Tests', () => {

test('Remove server', async ({ page }) => {
await login(page, 'alice');
await page.getByRole('link', { name: 'Servers' }).click();
await page.waitForURL('**/servers');
await page.goto('/services/tljh_repo2docker/servers');
await page.waitForTimeout(1000);

await page.getByRole('button', { name: 'Stop Server' }).click();
Expand All @@ -163,8 +170,7 @@ test.describe('tljh_repo2docker UI Tests', () => {

test('Remove environment', async ({ page }) => {
await login(page, 'alice');
await page.getByRole('link', { name: 'Environments' }).click();
await page.waitForURL('**/environments');
await page.goto('/services/tljh_repo2docker/environments');
await page.waitForTimeout(1000);
await page.getByRole('button', { name: 'Remove' }).click();
await page.waitForTimeout(500);
Expand Down
Binary file modified ui-tests/tests/ui.test.ts-snapshots/admin-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ui-tests/tests/ui.test.ts-snapshots/user-linux.png
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 cfe5538

Please sign in to comment.