Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -1719,10 +1719,13 @@ test('Active PR context push with no local changes shows neutral status', async
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
4 changes: 2 additions & 2 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, webkit, shard 3/4)

[webkit] › playwright/rendering-modes/core.spec.ts:518:1 › jsx syntax errors affect status but not diagnostics toggle severity

3) [webkit] › playwright/rendering-modes/core.spec.ts:518:1 › jsx syntax errors affect status but not diagnostics toggle severity 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 waitForInitialRender (/home/runner/work/develop/develop/playwright/helpers/app-test-helpers.ts:140:3) at /home/runner/work/develop/develop/playwright/rendering-modes/core.spec.ts:521:3

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

View workflow job for this annotation

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

[webkit] › playwright/rendering-modes/core.spec.ts:244:1 › preview styles require explicit import from entry graph

2) [webkit] › playwright/rendering-modes/core.spec.ts:244:1 › preview styles require explicit import from entry graph 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 waitForInitialRender (/home/runner/work/develop/develop/playwright/helpers/app-test-helpers.ts:140:3) at /home/runner/work/develop/develop/playwright/rendering-modes/core.spec.ts:245:3
.poll(async () => {
const statusText = (
await page.getByRole('status', { name: 'App status' }).textContent()
Expand Down Expand Up @@ -155,10 +155,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
Loading
Loading