Skip to content

Commit 837241a

Browse files
committed
fix github errors
1 parent 00ba861 commit 837241a

File tree

4 files changed

+64
-53
lines changed

4 files changed

+64
-53
lines changed

playwright.config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ export default defineConfig({
3737
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
3838
reporter: 'html',
3939

40-
globalSetup: './playwright/global-setup.js', // Changed to direct path
40+
// Add testMatch pattern to explicitly match test files
41+
testMatch: '**/*.spec.js',
42+
43+
globalSetup: './playwright/global-setup.js',
4144
use: {
4245
baseURL: process.env.REACT_APP_PLAYWRIGHT_URL,
4346
navigationTimeout: 30000,
@@ -51,10 +54,11 @@ export default defineConfig({
5154
projects: [
5255
{
5356
name: 'setup',
54-
testMatch: /global-setup\.js/ // Updated extension
57+
testMatch: /global-setup\.js/,
5558
},
5659
{
5760
name: 'chromium',
61+
testMatch: '**/*.spec.js',
5862
use: {
5963
...devices['Desktop Chrome'],
6064
storageState: 'state.json',
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { test, expect } from '@playwright/test';
22

3-
test.use({ storageState: './state.json' });
4-
test.beforeEach(async ({ page }) => {
5-
await page.goto(process.env.REACT_APP_PLAYWRIGHT_URL);
6-
await page.waitForLoadState('networkidle');
7-
await page.getByRole('banner').locator('a').filter({ hasText: 'Sign in' }).click();
8-
});
3+
test.describe('Logged in navigation', () => {
4+
test.use({ storageState: './state.json' });
5+
test.beforeEach(async ({ page }) => {
6+
await page.goto(process.env.REACT_APP_PLAYWRIGHT_URL);
7+
await page.waitForLoadState('networkidle');
8+
await page.getByRole('banner').locator('a').filter({ hasText: 'Sign in' }).click();
9+
});
910

10-
test('should navigate to Find Challenges', async ({ page }) => {
11-
await page.getByRole('navigation').getByRole('link', { name: 'Find Challenges' }).click();
12-
await expect(page.getByRole('heading', { name: 'Challenges' }).locator('span')).toBeVisible();
11+
test('should navigate to Find Challenges', async ({ page }) => {
12+
await page.getByRole('navigation').getByRole('link', { name: 'Find Challenges' }).click();
13+
await expect(page.getByRole('heading', { name: 'Challenges' }).locator('span')).toBeVisible();
14+
});
1315
});
Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
11
import { test, expect } from '@playwright/test';
22

3-
// Use a new context for these tests without the stored auth state
4-
test.use({ storageState: { cookies: [], origins: [] } });
5-
6-
test.beforeEach(async ({ page }) => {
7-
await page.goto(process.env.REACT_APP_PLAYWRIGHT_URL);
8-
await page.waitForLoadState('networkidle');
9-
await expect(page).toHaveTitle(/MapRoulette/);
10-
});
11-
12-
test('should load find challenges page', async ({ page }) => {
13-
await page.getByRole('navigation').getByRole('link', { name: 'Find Challenges' }).click();
14-
await expect(page.getByRole('heading', { name: 'Challenges' }).locator('span')).toBeVisible();
15-
await expect(page.locator('a').filter({ hasText: 'Sign in' })).toBeVisible();
16-
});
17-
18-
test('should load leaderboard page', async ({ page }) => {
19-
await page.getByRole('navigation').getByRole('link', { name: 'Leaderboard' }).click();
20-
await page.waitForLoadState('networkidle');
21-
});
22-
23-
test('should load learn page', async ({ page }) => {
24-
await page.getByRole('navigation').getByRole('link', { name: 'Learn' }).click();
25-
await page.waitForLoadState('networkidle');
26-
});
27-
28-
test('should load blog page', async ({ page }) => {
29-
await page.getByRole('navigation').getByRole('link', { name: 'Blog' }).click();
30-
await page.waitForLoadState('networkidle');
31-
});
32-
33-
test('should load donate page', async ({ page }) => {
34-
await page.getByRole('navigation').getByRole('link', { name: 'Donate' }).click();
35-
await page.waitForLoadState('networkidle');
3+
// Create a new test fixture that doesn't use the stored auth state
4+
test.describe('Logged out navigation', () => {
5+
// Use a new context for these tests without the stored auth state
6+
test.use({ storageState: { cookies: [], origins: [] } });
7+
8+
test.beforeEach(async ({ page }) => {
9+
await page.goto(process.env.REACT_APP_PLAYWRIGHT_URL);
10+
await page.waitForLoadState('networkidle');
11+
await expect(page).toHaveTitle(/MapRoulette/);
12+
});
13+
14+
test('should load find challenges page', async ({ page }) => {
15+
await page.getByRole('navigation').getByRole('link', { name: 'Find Challenges' }).click();
16+
await expect(page.getByRole('heading', { name: 'Challenges' }).locator('span')).toBeVisible();
17+
await expect(page.locator('a').filter({ hasText: 'Sign in' })).toBeVisible();
18+
});
19+
20+
test('should load leaderboard page', async ({ page }) => {
21+
await page.getByRole('navigation').getByRole('link', { name: 'Leaderboard' }).click();
22+
await page.waitForLoadState('networkidle');
23+
});
24+
25+
test('should load learn page', async ({ page }) => {
26+
await page.getByRole('navigation').getByRole('link', { name: 'Learn' }).click();
27+
await page.waitForLoadState('networkidle');
28+
});
29+
30+
test('should load blog page', async ({ page }) => {
31+
await page.getByRole('navigation').getByRole('link', { name: 'Blog' }).click();
32+
await page.waitForLoadState('networkidle');
33+
});
34+
35+
test('should load donate page', async ({ page }) => {
36+
await page.getByRole('navigation').getByRole('link', { name: 'Donate' }).click();
37+
await page.waitForLoadState('networkidle');
38+
});
3639
});
3740

playwright/tests/login.spec.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { test, expect } from '@playwright/test';
22

3-
test.use({ storageState: { cookies: [], origins: [] } });
3+
test.describe('Logged in navigation', () => {
4+
test.use({ storageState: { cookies: [], origins: [] } });
45

5-
test('should login and redirect to maproulette', async ({ page }) => {
6-
await page.goto(process.env.REACT_APP_PLAYWRIGHT_URL);
7-
await page.getByRole('banner').locator('a').filter({ hasText: 'Sign in' }).click();
8-
await page.getByLabel('Email Address or Username').fill(process.env.REACT_APP_PLAYWRIGHT_USERNAME || "");
9-
await page.getByLabel('Password').fill(process.env.REACT_APP_PLAYWRIGHT_PASSWORD || "");
10-
await page.getByRole('button', { name: 'Log in' }).click();
11-
await page.waitForLoadState('networkidle');
12-
await expect(page).toHaveTitle(/MapRoulette/);
6+
test('should login and redirect to maproulette', async ({ page }) => {
7+
await page.goto(process.env.REACT_APP_PLAYWRIGHT_URL);
8+
await page.getByRole('banner').locator('a').filter({ hasText: 'Sign in' }).click();
9+
await page.getByLabel('Email Address or Username').fill(process.env.REACT_APP_PLAYWRIGHT_USERNAME || "");
10+
await page.getByLabel('Password').fill(process.env.REACT_APP_PLAYWRIGHT_PASSWORD || "");
11+
await page.getByRole('button', { name: 'Log in' }).click();
12+
await page.waitForLoadState('networkidle');
13+
await expect(page).toHaveTitle(/MapRoulette/);
14+
});
1315
});
1416

0 commit comments

Comments
 (0)