Skip to content

Commit 2d15023

Browse files
✅ fix e2e test
1 parent bcdba36 commit 2d15023

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ esm
44
coverage
55
rum-events-format
66
.yarn
7-
developer-extension/dist
87
test/**/dist
98
yarn.lock
109
/docs

eslint.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export default tseslint.config(
2424
'packages/*/bundle',
2525
'packages/*/cjs',
2626
'packages/*/esm',
27-
'developer-extension/dist',
2827
'test/**/dist',
2928
'sandbox',
3029
'coverage',

test/e2e/lib/framework/createExtension.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import fs from 'fs'
12
import type { RumInitConfiguration } from '@datadog/browser-rum-core'
23
import type test from '@playwright/test'
34
import type { LogsInitConfiguration } from '@datadog/browser-logs'
@@ -17,6 +18,9 @@ export class Extension {
1718
public logsConfiguration: LogsInitConfiguration | undefined
1819

1920
constructor(path: string) {
21+
if (!fs.existsSync(path)) {
22+
throw new Error(`Extension ${path} does not exist`)
23+
}
2024
this.fixture = createExtensionTest(path)
2125

2226
return this
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
import path from 'path'
2-
import { expect } from '@playwright/test'
2+
import { expect, test } from '@playwright/test'
33
import { createExtension, createTest } from '../../lib/framework'
44

5-
const developerExtensionPath = path.join(process.cwd(), 'developer-extension', 'dist')
5+
const developerExtensionPath = path.join(process.cwd(), 'developer-extension/.output/chrome-mv3')
66

7-
createTest('should switch between tabs')
8-
.withExtension(createExtension(developerExtensionPath))
9-
.run(async ({ page, getExtensionId, flushBrowserLogs }) => {
10-
const extensionId = await getExtensionId()
7+
test.describe('developer extension', () => {
8+
createTest('should switch between tabs')
9+
.withExtension(createExtension(developerExtensionPath))
10+
.run(async ({ page, getExtensionId, flushBrowserLogs }) => {
11+
const extensionId = await getExtensionId()
1112

12-
await page.goto(`chrome-extension://${extensionId}/panel.html`)
13+
await page.goto(`chrome-extension://${extensionId}/panel.html`)
1314

14-
const getSelectedTab = () => page.getByRole('tab', { selected: true })
15-
const getTab = (name: string) => page.getByRole('tab', { name })
15+
const getSelectedTab = () => page.getByRole('tab', { selected: true })
16+
const getTab = (name: string) => page.getByRole('tab', { name })
1617

17-
expect(await getSelectedTab().innerText()).toEqual('Events')
18+
expect(await getSelectedTab().innerText()).toEqual('Events')
1819

19-
await getTab('Infos').click()
20-
expect(await getSelectedTab().innerText()).toEqual('Infos')
20+
await getTab('Infos').click()
21+
expect(await getSelectedTab().innerText()).toEqual('Infos')
2122

22-
flushBrowserLogs()
23-
})
23+
flushBrowserLogs()
24+
})
25+
})

0 commit comments

Comments
 (0)