Skip to content

Commit

Permalink
adding test
Browse files Browse the repository at this point in the history
  • Loading branch information
arafatkatze committed Dec 27, 2024
1 parent fcc1c2d commit 2fb48f0
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions vscode/test/e2e/chat-history.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,42 @@ test.extend<ExpectedV2Events>({
await expect(newHistoryItem).toBeVisible()
await newHistoryItem.click()
})

test.extend<ExpectedV2Events>({
// list of events we expect this test to log, add to this list as needed
expectedV2Events: [
'cody.extension:installed',
'cody.auth.login:clicked',
'cody.auth.login:firstEver',
'cody.auth.login.token:clicked',
'cody.auth:connected',
'cody.chat-question:submitted',
'cody.chat-question:executed',
'cody.chatResponse:noCode',
],
})('delete chat from sidebar history view', async ({ page, sidebar }) => {
await sidebarSignin(page, sidebar)

const sidebarChat = getChatSidebarPanel(page)

const sidebarTabHistoryButton = sidebarChat.getByTestId('tab-history')

// Ensure the chat view is ready before we start typing
await expect(sidebarTabHistoryButton).toBeVisible()

const chatInput = getChatInputs(sidebarChat).first()
await chatInput.fill('Hey')
await chatInput.press('Enter')

await sidebarTabHistoryButton.click()

const newHistoryItem = sidebarChat.getByRole('button', { name: 'Hey' })
await expect(newHistoryItem).toBeVisible()
await newHistoryItem.click()

const deleteButton = sidebarChat.getByRole('button', { name: 'Delete chat' })
await expect(deleteButton).toBeVisible()

Check failure on line 71 in vscode/test/e2e/chat-history.test.ts

View workflow job for this annotation

GitHub Actions / test-e2e (ubuntu, 2/5)

chat-history.test.ts:50:3 › delete chat from sidebar history view

1) chat-history.test.ts:50:3 › delete chat from sidebar history view ───────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toBeVisible() Locator: frameLocator('iframe.webview:first-child:last-child').frameLocator('iframe').getByRole('button', { name: 'Delete chat' }) Expected: visible Received: <element(s) not found> Call log: - expect.toBeVisible with timeout 5000ms - waiting for frameLocator('iframe.webview:first-child:last-child').frameLocator('iframe').getByRole('button', { name: 'Delete chat' }) 69 | 70 | const deleteButton = sidebarChat.getByRole('button', { name: 'Delete chat' }) > 71 | await expect(deleteButton).toBeVisible() | ^ 72 | await deleteButton.click() 73 | 74 | await expect(newHistoryItem).not.toBeVisible() at /home/runner/work/cody/cody/vscode/test/e2e/chat-history.test.ts:71:32

Check failure on line 71 in vscode/test/e2e/chat-history.test.ts

View workflow job for this annotation

GitHub Actions / test-e2e (ubuntu, 2/5)

chat-history.test.ts:50:3 › delete chat from sidebar history view

1) chat-history.test.ts:50:3 › delete chat from sidebar history view ───────────────────────────── Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toBeVisible() Locator: frameLocator('iframe.webview:first-child:last-child').frameLocator('iframe').getByRole('button', { name: 'Delete chat' }) Expected: visible Received: <element(s) not found> Call log: - expect.toBeVisible with timeout 5000ms - waiting for frameLocator('iframe.webview:first-child:last-child').frameLocator('iframe').getByRole('button', { name: 'Delete chat' }) 69 | 70 | const deleteButton = sidebarChat.getByRole('button', { name: 'Delete chat' }) > 71 | await expect(deleteButton).toBeVisible() | ^ 72 | await deleteButton.click() 73 | 74 | await expect(newHistoryItem).not.toBeVisible() at /home/runner/work/cody/cody/vscode/test/e2e/chat-history.test.ts:71:32
await deleteButton.click()

await expect(newHistoryItem).not.toBeVisible()
})

0 comments on commit 2fb48f0

Please sign in to comment.