Skip to content
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
11 changes: 7 additions & 4 deletions playwright/github-pr-drawer/active-context-switch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@
).toBeHidden()
await expect(
page.getByRole('status', { name: 'Open pull request status', includeHidden: true }),
).toContainText('Repository is selected from Workspaces.')

Check failure on line 1288 in playwright/github-pr-drawer/active-context-switch.spec.ts

View workflow job for this annotation

GitHub Actions / E2E (Playwright, chromium)

[chromium] › playwright/github-pr-drawer/active-context-switch.spec.ts:1167:1 › Active PR context deactivates after token remove and re-add when PR is closed

1) [chromium] › playwright/github-pr-drawer/active-context-switch.spec.ts:1167:1 › Active PR context deactivates after token remove and re-add when PR is closed Error: expect(locator).toContainText(expected) failed Locator: getByRole('status', { name: 'Open pull request status', includeHidden: true }) Expected substring: "Repository is selected from Workspaces." Received string: "Saved pull request context is not open on GitHub. Open PR mode restored." Timeout: 90000ms Call log: - Expect "toContainText" with timeout 90000ms - waiting for getByRole('status', { name: 'Open pull request status', includeHidden: true }) 93 × locator resolved to <p role="status" data-level="neutral" id="github-pr-status" class="github-pr-drawer__status" aria-label="Open pull request status">Saved pull request context is not open on GitHub.…</p> - unexpected value "Saved pull request context is not open on GitHub. Open PR mode restored." 1286 | await expect( 1287 | page.getByRole('status', { name: 'Open pull request status', includeHidden: true }), > 1288 | ).toContainText('Repository is selected from Workspaces.') | ^ 1289 | }) 1290 | 1291 | test('Active PR context recovers when saved head branch is missing but PR metadata exists', async ({ at /home/runner/work/develop/develop/playwright/github-pr-drawer/active-context-switch.spec.ts:1288:5
})

test('Active PR context recovers when saved head branch is missing but PR metadata exists', async ({
Expand Down Expand Up @@ -1719,10 +1719,13 @@
const tabs = Array.isArray(workspaceRecord?.tabs)
? (workspaceRecord.tabs as Array<Record<string, unknown>>)
: []
const tabIds = new Set(
tabs.map(tab => (typeof tab?.id === 'string' ? tab.id : '')).filter(Boolean),
)
const hasPrimaryTabs = tabIds.has('component') && tabIds.has('styles')
const hasEntryTab = tabs.some(tab => tab?.role === 'entry')
const hasStyleTab = tabs.some(tab => {
const language =
typeof tab?.language === 'string' ? tab.language.trim().toLowerCase() : ''
return language === 'css' || language === 'less' || language === 'sass'
})
const hasPrimaryTabs = hasEntryTab && hasStyleTab
return hasPrimaryTabs && tabs.every(tab => tab?.isDirty === false)
})
.toBe(true)
Expand Down
22 changes: 14 additions & 8 deletions playwright/github-pr-drawer/active-context-sync.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1045,10 +1045,13 @@ test('Active PR context push commit uses Git Database API atomic path by default
const tabs = Array.isArray(workspaceRecord?.tabs)
? (workspaceRecord.tabs as Array<Record<string, unknown>>)
: []
const tabIds = new Set(
tabs.map(tab => (typeof tab?.id === 'string' ? tab.id : '')).filter(Boolean),
)
const hasPrimaryTabs = tabIds.has('component') && tabIds.has('styles')
const hasEntryTab = tabs.some(tab => tab?.role === 'entry')
const hasStyleTab = tabs.some(tab => {
const language =
typeof tab?.language === 'string' ? tab.language.trim().toLowerCase() : ''
return language === 'css' || language === 'less' || language === 'sass'
})
const hasPrimaryTabs = hasEntryTab && hasStyleTab
return hasPrimaryTabs && tabs.every(tab => tab?.isDirty === false)
},
{ timeout: 10_000 },
Expand Down Expand Up @@ -2186,8 +2189,11 @@ test('Reloaded active PR context does not apply partial sync when one primary fi
? (workspaceRecord.tabs as Array<Record<string, unknown>>)
: []

const entryTab = tabs.find(tab => tab?.id === 'component')
const stylesTab = tabs.find(tab => tab?.id === 'styles')
const entryTab = tabs.find(tab => tab?.role === 'entry')
const stylesTab = tabs.find(
tab =>
typeof tab?.path === 'string' && tab.path.trim() === 'src/styles/app.css',
)

return {
entryContent: typeof entryTab?.content === 'string' ? entryTab.content : '',
Expand Down Expand Up @@ -2377,7 +2383,7 @@ test('Reloaded active PR context sync does not overwrite non-primary module tabs
? (workspaceRecord.tabs as Array<Record<string, unknown>>)
: []

const entryTab = tabs.find(tab => tab?.id === 'component')
const entryTab = tabs.find(tab => tab?.role === 'entry')
const boopTab = tabs.find(tab => tab?.id === 'module-boop')
const beepTab = tabs.find(tab => tab?.id === 'module-beep')

Expand Down Expand Up @@ -2590,7 +2596,7 @@ test('Reloaded active PR context sync does not overwrite non-primary tabs with s
? (workspaceRecord.tabs as Array<Record<string, unknown>>)
: []

const entryTab = tabs.find(tab => tab?.id === 'component')
const entryTab = tabs.find(tab => tab?.role === 'entry')
const boopTab = tabs.find(tab => tab?.id === 'module-boop')
const beepTab = tabs.find(tab => tab?.id === 'module-beep')

Expand Down
24 changes: 12 additions & 12 deletions playwright/github-pr-drawer/github-pr-drawer.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ export const seedActivePrWorkspaceContext = async (
renderMode,
tabs: [
{
id: 'component',
id: 'entry',
name: 'App.tsx',
path: 'src/components/App.tsx',
language: 'javascript-jsx',
Expand All @@ -575,7 +575,7 @@ export const seedActivePrWorkspaceContext = async (
content: 'export const App = () => <main>Hello from Knighted</main>',
},
{
id: 'styles',
id: 'style',
name: 'app.css',
path: 'src/styles/app.css',
language: safeStyleLanguage,
Expand All @@ -584,7 +584,7 @@ export const seedActivePrWorkspaceContext = async (
content: 'main { color: #111; }',
},
],
activeTabId: 'component',
activeTabId: 'entry',
createdAt: Date.now() + 60_000,
lastModified: Date.now() + 60_000,
},
Expand Down Expand Up @@ -706,7 +706,7 @@ export const getWorkspaceComponentContent = (record: Record<string, unknown> | n
return false
}

return (tab as { id?: unknown }).id === 'component'
return (tab as { role?: unknown }).role === 'entry'
}) as { content?: unknown } | undefined

return typeof componentTab?.content === 'string' ? componentTab.content : ''
Expand Down Expand Up @@ -829,7 +829,7 @@ export const runActiveWorkspaceSwitchIntegrityScenario = async ({
renderMode: 'react',
tabs: [
{
id: 'component',
id: 'entry',
name: 'App.tsx',
path: 'src/components/App.tsx',
language: 'javascript-jsx',
Expand All @@ -838,7 +838,7 @@ export const runActiveWorkspaceSwitchIntegrityScenario = async ({
content: 'export const App = () => <main>Active A content</main>',
},
],
activeTabId: 'component',
activeTabId: 'entry',
createdAt: Date.now() - 60_000,
lastModified: Date.now() - 60_000,
},
Expand All @@ -853,7 +853,7 @@ export const runActiveWorkspaceSwitchIntegrityScenario = async ({
renderMode: 'dom',
tabs: [
{
id: 'component',
id: 'entry',
name: 'App.tsx',
path: 'src/components/App.tsx',
language: 'javascript-jsx',
Expand All @@ -862,7 +862,7 @@ export const runActiveWorkspaceSwitchIntegrityScenario = async ({
content: `export const App = () => <main>Target ${targetState} content</main>`,
},
],
activeTabId: 'component',
activeTabId: 'entry',
createdAt: Date.now() - 120_000,
lastModified: Date.now() - 120_000,
},
Expand Down Expand Up @@ -1077,7 +1077,7 @@ export const runActiveWorkspaceCrossRepoSwitchIntegrityScenario = async ({
renderMode: 'react',
tabs: [
{
id: 'component',
id: 'entry',
name: 'App.tsx',
path: 'src/components/App.tsx',
language: 'javascript-jsx',
Expand All @@ -1086,7 +1086,7 @@ export const runActiveWorkspaceCrossRepoSwitchIntegrityScenario = async ({
content: 'export const App = () => <main>Cross source active content</main>',
},
],
activeTabId: 'component',
activeTabId: 'entry',
createdAt: Date.now() - 60_000,
lastModified: Date.now() - 60_000,
},
Expand All @@ -1101,7 +1101,7 @@ export const runActiveWorkspaceCrossRepoSwitchIntegrityScenario = async ({
renderMode: 'dom',
tabs: [
{
id: 'component',
id: 'entry',
name: 'App.tsx',
path: 'src/components/App.tsx',
language: 'javascript-jsx',
Expand All @@ -1110,7 +1110,7 @@ export const runActiveWorkspaceCrossRepoSwitchIntegrityScenario = async ({
content: `export const App = () => <main>Cross target ${targetState} content</main>`,
},
],
activeTabId: 'component',
activeTabId: 'entry',
createdAt: Date.now() - 120_000,
lastModified: Date.now() - 120_000,
},
Expand Down
4 changes: 2 additions & 2 deletions playwright/github-pr-drawer/open-pr-create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ test('Open PR success normalizes trailing newline without showing Edited indicat

await setComponentEditorSource(page, 'const App = () => <button>tap me</button>')
await setStylesEditorSource(page, '.button { color: red; }')
await addWorkspaceTab(page, { kind: 'styles' })
await addWorkspaceTab(page, { type: 'style' })

const moduleStylesEditor = page
.locator('.editor-panel[data-editor-kind="styles"] .cm-content')
Expand Down Expand Up @@ -816,7 +816,7 @@ test('Open PR success normalizes trailing newline without showing Edited indicat
? (workspaceRecord.tabs as Array<Record<string, unknown>>)
: []

const componentTab = tabs.find(tab => tab?.id === 'component')
const componentTab = tabs.find(tab => tab?.role === 'entry')
const appStylesTab = tabs.find(
tab =>
typeof tab?.path === 'string' && tab.path.trim() === 'src/styles/app.css',
Expand Down
7 changes: 4 additions & 3 deletions playwright/helpers/app-test-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
export const waitForAppReady = async (page: Page, path = appEntryPath) => {
await navigateToApp(page, path)
await expect(page.getByRole('heading', { name: '@knighted/develop' })).toBeVisible()
await expect

Check failure on line 77 in playwright/helpers/app-test-helpers.ts

View workflow job for this annotation

GitHub Actions / E2E (Playwright, chromium)

[chromium] › playwright/github-pr-drawer/open-pr-create.spec.ts:1177:1 › Switching Workspaces repository scope to Local keeps inactive record repo and shows it as local in drawer

2) [chromium] › playwright/github-pr-drawer/open-pr-create.spec.ts:1177:1 › Switching Workspaces repository scope to Local keeps inactive record repo and shows it as local in drawer Error: expect(received).toBe(expected) // Object.is equality Expected: true Received: false Call Log: - Timeout 90000ms exceeded while waiting on the predicate at helpers/app-test-helpers.ts:77 75 | await navigateToApp(page, path) 76 | await expect(page.getByRole('heading', { name: '@knighted/develop' })).toBeVisible() > 77 | await expect | ^ 78 | .poll(async () => { 79 | const statusText = ( 80 | await page.getByRole('status', { name: 'App status' }).textContent() at waitForAppReady (/home/runner/work/develop/develop/playwright/helpers/app-test-helpers.ts:77:3) at /home/runner/work/develop/develop/playwright/github-pr-drawer/open-pr-create.spec.ts:1183:3
.poll(async () => {
const statusText = (
await page.getByRole('status', { name: 'App status' }).textContent()
Expand All @@ -83,7 +83,8 @@
return (
statusText === 'Rendered' ||
statusText?.startsWith('Rendered (Type errors:') ||
statusText === 'Error'
statusText === 'Error' ||
statusText === 'Could not restore local workspace context.'
)
})
.toBe(true)
Expand Down Expand Up @@ -155,10 +156,10 @@

export const addWorkspaceTab = async (
page: Page,
{ kind = 'component' }: { kind?: 'component' | 'styles' } = {},
{ type = 'script' }: { type?: 'script' | 'style' } = {},
) => {
await page.getByRole('button', { name: 'Add workspace tab' }).click()
if (kind === 'styles') {
if (type === 'style') {
await page.getByRole('button', { name: 'Add styles tab' }).click()
return
}
Expand Down Expand Up @@ -551,7 +552,7 @@
await ensureWorkspacesDrawerClosed(page)

const repoSelect = page.getByLabel('Pull request repository')
await expect(repoSelect).toHaveValue('knightedcodemonkey/develop')

Check failure on line 555 in playwright/helpers/app-test-helpers.ts

View workflow job for this annotation

GitHub Actions / E2E (Playwright, webkit, shard 2/4)

[webkit] › playwright/github-pr-drawer/open-pr-confirmation.spec.ts:14:1 › Open PR drawer shows confirmation with tab-derived files

1) [webkit] › playwright/github-pr-drawer/open-pr-confirmation.spec.ts:14:1 › Open PR drawer shows confirmation with tab-derived files Error: expect(locator).toHaveValue(expected) failed Locator: getByLabel('Pull request repository') Expected: "knightedcodemonkey/develop" Received: "" Timeout: 90000ms Call log: - Expect "toHaveValue" with timeout 90000ms - waiting for getByLabel('Pull request repository') 93 × locator resolved to <select disabled id="github-pr-repo-select" aria-label="Pull request repository">…</select> - unexpected value "" at helpers/app-test-helpers.ts:555 553 | 554 | const repoSelect = page.getByLabel('Pull request repository') > 555 | await expect(repoSelect).toHaveValue('knightedcodemonkey/develop') | ^ 556 | await expect(repoSelect).toBeDisabled() 557 | 558 | await expect( at connectByotWithSingleRepo (/home/runner/work/develop/develop/playwright/helpers/app-test-helpers.ts:555:28) at /home/runner/work/develop/develop/playwright/github-pr-drawer/open-pr-confirmation.spec.ts:16:3
await expect(repoSelect).toBeDisabled()

await expect(
Expand Down
Loading
Loading