Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: playwright tests #4829

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/pwabuilder/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
/* Maximum time one test can run for. */
timeout: 30 * 1000,
timeout: (process.env.CI ? 30 : 50) * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
Expand All @@ -35,7 +35,7 @@ export default defineConfig({
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://localhost:3000',
baseURL: process.env.CI ? 'https://preview.pwabuilder.com': 'http://localhost:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
Expand Down
4 changes: 1 addition & 3 deletions apps/pwabuilder/tests/basic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { test, expect } from '@playwright/test';

const url = 'https://preview.pwabuilder.com/';

// before each test
test.beforeEach(async ({ page }) => {
await page.goto(url);
await page.goto('/');
});

test('ensure application loads home page', async ({ page }) => {
Expand Down
12 changes: 4 additions & 8 deletions apps/pwabuilder/tests/packaging.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { test, expect, Page } from '@playwright/test';

let currentPage: Page | undefined;

const url = 'https://preview.pwabuilder.com/';
// before each test
test.beforeEach(async ({ page }) => {
currentPage = page;
await page.goto(url);
await page.goto('/');
});

// only run this test once
Expand Down Expand Up @@ -49,15 +48,12 @@ test('Ensure demo app can be packaged for Windows', async ({ page }) => {

await expect(generateButton).toBeVisible();

// wait on request to https://pwabuilder-windows-docker.azurewebsites.net/msix/generatezip to finish
const pageRequest = page.waitForRequest(
'https://pwabuilder-windows-docker.azurewebsites.net/msix/generatezip'
);
// wait on request to finish
const pageRequest = page.waitForRequest('https://pwabuilder-windows-docker-dev.azurewebsites.net/msix/generatezip');
jgw96 marked this conversation as resolved.
Show resolved Hide resolved
await generateButton.click();
const request = await pageRequest;

// wait for response to https://pwabuilder-windows-docker.azurewebsites.net/msix/generatezip to finish

// wait for response to finish
const response = await request.response();

if (response) {
Expand Down
3 changes: 1 addition & 2 deletions apps/pwabuilder/tests/report-card.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { test, expect, Page } from '@playwright/test';

let currentPage: Page | undefined;

const url = 'https://preview.pwabuilder.com';
// before each test
test.beforeEach(async ({ page }) => {
currentPage = page;
await page.goto(url);
await page.goto('/');
});


Expand Down
Loading