Skip to content

Commit 6d876be

Browse files
Clean up test names and improve output format
- Remove verbose test name prefixes - Consolidate bookmark button test into Basics - Remove duplicate test block - Add list reporter and prevent truncation - Remove intermingled console.log output 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8dc2b14 commit 6d876be

2 files changed

Lines changed: 48 additions & 57 deletions

File tree

playwright.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { defineConfig, devices } from '@playwright/test';
22

3+
// Prevent list reporter from truncating test names
4+
process.stdout.columns = 200;
5+
36
export default defineConfig({
47
testDir: './tests',
58
snapshotPathTemplate: '{snapshotDir}/{arg}{ext}',
@@ -8,7 +11,7 @@ export default defineConfig({
811
forbidOnly: !!process.env.CI,
912
retries: process.env.CI ? 2 : 0,
1013
workers: 1,
11-
reporter: [['html', { open: 'never' }]],
14+
reporter: [['list'], ['html', { open: 'never' }]],
1215
use: {
1316
trace: 'on-first-retry',
1417
},

tests/extension.spec.js

Lines changed: 44 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function loadFixture(name) {
5555
return readFileSync(path.join(__dirname, 'fixtures', name), 'utf-8');
5656
}
5757

58-
test.describe('GitHub Bookmarked Issues Extension', () => {
58+
test.describe('', () => {
5959
let context;
6060
let page;
6161
let extensionId;
@@ -129,17 +129,50 @@ test.describe('GitHub Bookmarked Issues Extension', () => {
129129
// NO LOGIN REQUIRED - Extension basics and public pages
130130
// ============================================================
131131

132-
test.describe('Extension Basics', () => {
132+
test.describe('Basics', () => {
133133
test('loads successfully', async () => {
134134
expect(extensionId).toBeTruthy();
135-
console.log('Extension ID:', extensionId);
135+
});
136+
137+
test('bookmark button', async () => {
138+
const bookmarkSelector = '[data-extension-bookmark]';
139+
const headerActionsSelector = '[data-component="PH_Actions"]';
140+
141+
await clearBookmarks(context);
142+
143+
await page.goto(issueUrl(TEST_ISSUES[0]));
144+
await page.waitForLoadState('domcontentloaded');
145+
146+
await expect(page.locator(headerActionsSelector)).toBeVisible({ timeout: 15000 });
147+
148+
const bookmarkButton = page.locator(bookmarkSelector);
149+
await expect(bookmarkButton).toBeVisible({ timeout: 10000 });
150+
151+
// Click to add bookmark
152+
await bookmarkButton.click();
153+
154+
// Verify bookmark was added to storage
155+
const expectedKey = `${TEST_ISSUES[0].owner}/${TEST_ISSUES[0].repo}/issues/${TEST_ISSUES[0].number}`;
156+
await expect(async () => {
157+
const bookmarks = await getBookmarks(context);
158+
expect(Object.keys(bookmarks)).toContain(expectedKey);
159+
}).toPass({ timeout: 5000 });
160+
161+
// Click again to remove bookmark
162+
await bookmarkButton.click();
163+
164+
// Verify bookmark was removed
165+
await expect(async () => {
166+
const bookmarks = await getBookmarks(context);
167+
expect(Object.keys(bookmarks)).not.toContain(expectedKey);
168+
}).toPass({ timeout: 5000 });
136169
});
137170
});
138171

139172
// Bookmark button navigation tests - ensure button appears regardless of navigation path
140173
// NOTE: These tests can be flaky due to GitHub's variable page load times and React hydration.
141174
// Retries are enabled to mitigate transient failures.
142-
test.describe('Bookmark Button Navigation', { tag: '@navigation' }, () => {
175+
test.describe('Navigation', { tag: '@navigation' }, () => {
143176
test.describe.configure({ retries: 2 });
144177

145178
const bookmarkSelector = '[data-extension-bookmark]';
@@ -195,52 +228,7 @@ test.describe('GitHub Bookmarked Issues Extension', () => {
195228
const bookmarkButton = page.locator(bookmarkSelector);
196229
await expect(bookmarkButton).toBeVisible({ timeout: 10000 });
197230
});
198-
});
199231

200-
test.describe('Bookmark Button (Public Issue Pages)', () => {
201-
const bookmarkSelector = '[data-extension-bookmark]';
202-
const headerActionsSelector = '[data-component="PH_Actions"]';
203-
204-
test('appears on GitHub issue page', async () => {
205-
await page.goto(issueUrl(TEST_ISSUES[0]));
206-
await page.waitForLoadState('domcontentloaded');
207-
208-
await expect(page.locator(headerActionsSelector)).toBeVisible({ timeout: 15000 });
209-
210-
const bookmarkButton = page.locator(bookmarkSelector);
211-
await expect(bookmarkButton).toBeVisible({ timeout: 10000 });
212-
});
213-
214-
test('toggles bookmark on click', async () => {
215-
await clearBookmarks(context);
216-
217-
await page.goto(issueUrl(TEST_ISSUES[0]));
218-
await page.waitForLoadState('domcontentloaded');
219-
220-
await expect(page.locator(headerActionsSelector)).toBeVisible({ timeout: 15000 });
221-
222-
const bookmarkButton = page.locator(bookmarkSelector);
223-
await expect(bookmarkButton).toBeVisible({ timeout: 10000 });
224-
225-
// Click to add bookmark
226-
await bookmarkButton.click();
227-
228-
// Verify bookmark was added to storage
229-
const expectedKey = `${TEST_ISSUES[0].owner}/${TEST_ISSUES[0].repo}/issues/${TEST_ISSUES[0].number}`;
230-
await expect(async () => {
231-
const bookmarks = await getBookmarks(context);
232-
expect(Object.keys(bookmarks)).toContain(expectedKey);
233-
}).toPass({ timeout: 5000 });
234-
235-
// Click again to remove bookmark
236-
await bookmarkButton.click();
237-
238-
// Verify bookmark was removed
239-
await expect(async () => {
240-
const bookmarks = await getBookmarks(context);
241-
expect(Object.keys(bookmarks)).not.toContain(expectedKey);
242-
}).toPass({ timeout: 5000 });
243-
});
244232
});
245233

246234
test.describe('Popup', () => {
@@ -305,7 +293,7 @@ test.describe('GitHub Bookmarked Issues Extension', () => {
305293
await popupPage.close();
306294
});
307295

308-
test('imports from fixture and saves to storage', async () => {
296+
test('imports and saves', async () => {
309297
await clearBookmarks(context);
310298

311299
const popupPage = await context.newPage();
@@ -372,7 +360,7 @@ test.describe('GitHub Bookmarked Issues Extension', () => {
372360
});
373361
});
374362

375-
test.describe('Options Page', () => {
363+
test.describe('Options', () => {
376364
test('opens and displays UI', async () => {
377365
const optionsPage = await context.newPage();
378366
await optionsPage.goto(`chrome-extension://${extensionId}/assets/options.html`);
@@ -755,7 +743,7 @@ test.describe('GitHub Bookmarked Issues Extension', () => {
755743
// VISUAL REGRESSION - Screenshot comparison for CSS development
756744
// ============================================================
757745

758-
test.describe('Visual Regression', { tag: '@visual' }, () => {
746+
test.describe('Visual', { tag: '@visual' }, () => {
759747
test('popup with issues', async () => {
760748
// Setup mock bookmarks
761749
const testBookmarks = {
@@ -840,7 +828,7 @@ test.describe('GitHub Bookmarked Issues Extension', () => {
840828
await popupPage.close();
841829
});
842830

843-
test('options page default', async () => {
831+
test('default state', async () => {
844832
const optionsPage = await context.newPage();
845833
await optionsPage.goto(`chrome-extension://${extensionId}/assets/options.html`);
846834
await optionsPage.evaluate(() => {
@@ -856,7 +844,7 @@ test.describe('GitHub Bookmarked Issues Extension', () => {
856844
await optionsPage.close();
857845
});
858846

859-
test('options page with token configured', async () => {
847+
test('with token', async () => {
860848
const optionsPage = await context.newPage();
861849
await optionsPage.goto(`chrome-extension://${extensionId}/assets/options.html`);
862850
await optionsPage.evaluate(() => {
@@ -886,7 +874,7 @@ test.describe('GitHub Bookmarked Issues Extension', () => {
886874
// LOGIN REQUIRED - github.com/issues requires authentication
887875
// ============================================================
888876

889-
test.describe('Bookmarks View (Requires GitHub Login)', { tag: '@auth' }, () => {
877+
test.describe('Bookmarked view', { tag: '@auth' }, () => {
890878
test.skip(() => !getGitHubAuth(), 'GITHUB_AUTH_STATE not configured');
891879

892880
let authContext;
@@ -1013,7 +1001,7 @@ test.describe('GitHub Bookmarked Issues Extension', () => {
10131001
});
10141002

10151003
// Error handling tests - intercept GraphQL and REST API to test error display
1016-
test.describe('Error Handling (Requires GitHub Login)', { tag: '@auth' }, () => {
1004+
test.describe('Error Handling', { tag: '@auth' }, () => {
10171005
test.skip(() => !getGitHubAuth(), 'GITHUB_AUTH_STATE not configured');
10181006

10191007
const singleBookmark = makeBookmark(TEST_ISSUES[0]);

0 commit comments

Comments
 (0)