diff --git a/.github/workflows/tests_primary.yml b/.github/workflows/tests_primary.yml index 9e088036920e7..f55bc25572f41 100644 --- a/.github/workflows/tests_primary.yml +++ b/.github/workflows/tests_primary.yml @@ -138,39 +138,6 @@ jobs: env: PWTEST_CHANNEL: firefox-beta - test_web_components: - name: Web Components - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-node@v6 - with: - node-version: 20 - - run: npm ci - - run: npm run build - - - run: npx playwright install --with-deps - - run: npm run test-html-reporter - env: - PWTEST_BOT_NAME: "web-components-html-reporter" - - name: Upload blob report - if: ${{ !cancelled() }} - uses: ./.github/actions/upload-blob-report - with: - report_dir: packages/html-reporter/blob-report - job_name: "web-components-html-reporter" - - - run: npm run test-web - if: ${{ !cancelled() }} - env: - PWTEST_BOT_NAME: "web-components-web" - - name: Upload blob report - if: ${{ !cancelled() }} - uses: ./.github/actions/upload-blob-report - with: - report_dir: packages/web/blob-report - job_name: "web-components-web" - test_vscode_extension: name: VSCode Extension runs-on: ubuntu-latest diff --git a/package.json b/package.json index 8202135f10c06..ef4154d72d70f 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,6 @@ "itest": "playwright test --config=tests/installation/playwright.config.ts", "stest": "playwright test --config=tests/stress/playwright.config.ts", "biditest": "playwright test --config=tests/bidi/playwright.config.ts", - "test-html-reporter": "playwright test --config=packages/html-reporter", - "test-web": "playwright test --config=packages/web", "ttest": "node ./tests/playwright-test/stable-test-runner/node_modules/@playwright/test/cli test --config=tests/playwright-test/playwright.config.ts", "ct": "playwright test tests/components/test-all.spec.js --reporter=list", "test": "playwright test --config=tests/library/playwright.config.ts", diff --git a/packages/html-reporter/playwright.config.ts b/packages/html-reporter/playwright.config.ts deleted file mode 100644 index 1f849f807eae1..0000000000000 --- a/packages/html-reporter/playwright.config.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { devices, defineConfig } from '@playwright/experimental-ct-react'; -import path from 'path'; -import url from 'url'; - -export default defineConfig({ - testDir: 'src', - forbidOnly: !!process.env.CI, - retries: process.env.CI ? 2 : 0, - snapshotPathTemplate: '{testDir}/__screenshots__/{projectName}/{testFilePath}/{arg}{ext}', - reporter: process.env.CI ? [ - ['blob', { fileName: `${process.env.PWTEST_BOT_NAME}.zip` }], - ] : [ - ['html'] - ], - use: { - ctPort: 3101, - ctViteConfig: { - resolve: { - alias: { - '@web': path.resolve(path.dirname(url.fileURLToPath(import.meta.url)), '../web/src'), - }, - } - }, - trace: 'on-first-retry', - }, - projects: [{ - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }], -}); diff --git a/packages/html-reporter/playwright/index.html b/packages/html-reporter/playwright/index.html deleted file mode 100644 index b18a1e9c7d2c5..0000000000000 --- a/packages/html-reporter/playwright/index.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - Playwright Test Report - - -
- - - diff --git a/packages/html-reporter/playwright/index.ts b/packages/html-reporter/playwright/index.ts deleted file mode 100644 index 5137631e68485..0000000000000 --- a/packages/html-reporter/playwright/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import '../src/theme.css'; diff --git a/packages/html-reporter/src/chip.spec.tsx b/packages/html-reporter/src/chip.spec.tsx deleted file mode 100644 index 8c88fee071c95..0000000000000 --- a/packages/html-reporter/src/chip.spec.tsx +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { expect, test } from '@playwright/experimental-ct-react'; -import { AutoChip, Chip as LocalChip } from './chip'; - -test.use({ viewport: { width: 500, height: 500 } }); - -test('expand collapse', async ({ mount }) => { - const component = await mount( - Chip body - ); - await expect(component.getByText('Chip body')).toBeVisible(); - await component.getByText('Title').click(); - await expect(component.getByText('Chip body')).not.toBeVisible(); - await component.getByText('Title').click(); - await expect(component.getByText('Chip body')).toBeVisible(); -}); - -test('render long title', async ({ mount }) => { - const title = 'Extremely long title. '.repeat(10); - const component = await mount( - Chip body - ); - await expect(component).toContainText('Extremely long title.'); - await expect(component.getByText('Extremely long title.')).toHaveAttribute('title', title); -}); - -test('setExpanded is called', async ({ mount }) => { - const expandedValues: boolean[] = []; - const component = await mount( expandedValues.push(expanded)}> - ); - - await component.getByText('Title').click(); - expect(expandedValues).toEqual([true]); -}); - -test('setExpanded should work', async ({ mount }) => { - const component = await mount( - Body - ); - await component.getByText('Title').click(); - await expect(component).toMatchAriaSnapshot(` - - button "Title" [expanded] - - region: Body - `); -}); diff --git a/packages/html-reporter/src/headerView.spec.tsx b/packages/html-reporter/src/headerView.spec.tsx deleted file mode 100644 index 85e78758b01ee..0000000000000 --- a/packages/html-reporter/src/headerView.spec.tsx +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { test, expect } from '@playwright/experimental-ct-react'; -import { GlobalFilterView } from './headerView'; -import { SearchParamsProvider } from './links'; - -test.use({ viewport: { width: 720, height: 200 } }); - -test('should render counters', async ({ mount }) => { - const component = await mount( - { }} /> - ); - await expect(component.locator('a', { hasText: 'All' }).locator('.counter')).toHaveText('90'); - await expect(component.locator('a', { hasText: 'Passed' }).locator('.counter')).toHaveText('42'); - await expect(component.locator('a', { hasText: 'Failed' }).locator('.counter')).toHaveText('31'); - await expect(component.locator('a', { hasText: 'Flaky' }).locator('.counter')).toHaveText('17'); - await expect(component.locator('a', { hasText: 'Skipped' }).locator('.counter')).toHaveText('10'); - await expect(component).toMatchAriaSnapshot(` - - navigation: - - link "All90" - - link "Passed42" - - link "Failed31" - - link "Flaky17" - - link "Skipped10" - `); -}); - -test('should toggle filters', async ({ page, mount }) => { - const filters: string[] = []; - const component = await mount( - filters.push(filterText)} - /> - ); - await component.locator('a', { hasText: 'All' }).click(); - await component.locator('a', { hasText: 'Passed' }).click(); - await expect(page).toHaveURL(/#\?q=s:passed/); - await component.locator('a', { hasText: 'Failed' }).click(); - await expect(page).toHaveURL(/#\?q=s:failed/); - await component.locator('a', { hasText: 'Flaky' }).click(); - await expect(page).toHaveURL(/#\?q=s:flaky/); - await component.locator('a', { hasText: 'Skipped' }).click(); - await expect(page).toHaveURL(/#\?q=s:skipped/); - await component.getByRole('textbox').fill('annot:annotation type=annotation description'); - expect(filters).toEqual(['', '', 's:passed ', 's:failed ', 's:flaky ', 's:skipped ', 'annot:annotation type=annotation description']); -}); diff --git a/packages/html-reporter/src/testCaseView.spec.tsx b/packages/html-reporter/src/testCaseView.spec.tsx deleted file mode 100644 index fd26ca21a5f0d..0000000000000 --- a/packages/html-reporter/src/testCaseView.spec.tsx +++ /dev/null @@ -1,257 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { test, expect } from '@playwright/experimental-ct-react'; -import { TestCaseView } from './testCaseView'; -import type { TestCase, TestCaseSummary, TestResult } from './types'; - -test.use({ viewport: { width: 800, height: 600 } }); - -const result: TestResult = { - retry: 0, - startTime: new Date(0).toUTCString(), - duration: 100, - errors: [], - steps: [{ - title: 'Outer step', - startTime: new Date(100).toUTCString(), - duration: 10, - location: { file: 'test.spec.ts', line: 62, column: 0 }, - count: 1, - steps: [{ - title: 'Inner step', - startTime: new Date(200).toUTCString(), - duration: 10, - location: { file: 'test.spec.ts', line: 82, column: 0 }, - steps: [], - attachments: [], - count: 1, - }], - attachments: [], - }], - annotations: [ - { type: 'annotation', description: 'Annotation text' }, - { type: 'annotation', description: 'Another annotation text' }, - { type: '_annotation', description: 'Hidden annotation' }, - ], - attachments: [], - status: 'passed', -}; - -const testCase: TestCase = { - testId: 'testid', - title: 'My test', - path: [], - projectName: 'chromium', - location: { file: 'test.spec.ts', line: 42, column: 0 }, - annotations: result.annotations, - tags: [], - outcome: 'expected', - duration: 200, - ok: true, - results: [result] -}; - -test('should render test case', async ({ mount }) => { - const component = await mount(); - await expect(component.getByText('Annotation text', { exact: false }).first()).toBeVisible(); - await expect(component.getByText('Hidden annotation')).toBeHidden(); - await component.getByText('Annotations').click(); - await expect(component.getByText('Annotation text')).not.toBeVisible(); - await expect(component.getByText('Outer step')).toBeVisible(); - await expect(component.getByText('Inner step')).not.toBeVisible(); - await component.getByText('Outer step').click(); - await expect(component.getByText('Inner step')).toBeVisible(); - await expect(component.getByText('test.spec.ts:42')).toBeVisible(); - await expect(component.getByText('My test')).toBeVisible(); -}); - -test('should render copy buttons for annotations', async ({ mount, page, context }) => { - await context.grantPermissions(['clipboard-read', 'clipboard-write']); - - const component = await mount(); - await expect(component.getByText('Annotation text', { exact: false }).first()).toBeVisible(); - await component.getByText('Annotation text', { exact: false }).first().hover(); - await expect(component.locator('.test-case-annotation').getByLabel('Copy to clipboard').first()).toBeVisible(); - await component.locator('.test-case-annotation').getByLabel('Copy to clipboard').first().click(); - const handle = await page.evaluateHandle(() => navigator.clipboard.readText()); - const clipboardContent = await handle.jsonValue(); - expect(clipboardContent).toBe('Annotation text'); -}); - -const annotationLinkRenderingTestCase: TestCase = { - testId: 'testid', - title: 'My test', - path: [], - projectName: 'chromium', - location: { file: 'test.spec.ts', line: 42, column: 0 }, - annotations: [], - tags: [], - outcome: 'expected', - duration: 10, - ok: true, - results: [{ - ...result, - annotations: [ - { type: 'more info', description: 'read https://playwright.dev/docs/intro and https://playwright.dev/docs/api/class-playwright' }, - { type: 'related issues', description: 'https://github.com/microsoft/playwright/issues/23180, https://github.com/microsoft/playwright/issues/23181' }, - ] - }] -}; - -test('should correctly render links in annotations', async ({ mount }) => { - const component = await mount(); - - const firstLink = await component.getByText('https://playwright.dev/docs/intro').first(); - await expect(firstLink).toBeVisible(); - await expect(firstLink).toHaveAttribute('href', 'https://playwright.dev/docs/intro'); - - const secondLink = await component.getByText('https://playwright.dev/docs/api/class-playwright').first(); - await expect(secondLink).toBeVisible(); - await expect(secondLink).toHaveAttribute('href', 'https://playwright.dev/docs/api/class-playwright'); - - const thirdLink = await component.getByText('https://github.com/microsoft/playwright/issues/23180').first(); - await expect(thirdLink).toBeVisible(); - await expect(thirdLink).toHaveAttribute('href', 'https://github.com/microsoft/playwright/issues/23180'); - - const fourthLink = await component.getByText('https://github.com/microsoft/playwright/issues/23181').first(); - await expect(fourthLink).toBeVisible(); - await expect(fourthLink).toHaveAttribute('href', 'https://github.com/microsoft/playwright/issues/23181'); -}); - -const resultWithAttachment: TestResult = { - retry: 0, - startTime: new Date(0).toUTCString(), - duration: 100, - errors: [], - steps: [{ - title: 'Outer step', - startTime: new Date(100).toUTCString(), - duration: 10, - location: { file: 'test.spec.ts', line: 62, column: 0 }, - count: 1, - steps: [], - attachments: [1], - }], - attachments: [{ - name: 'first attachment', - body: 'The body with https://playwright.dev/docs/intro link and https://github.com/microsoft/playwright/issues/31284.', - contentType: 'text/plain' - }, { - name: 'attachment with inline link https://github.com/microsoft/playwright/issues/31284', - contentType: 'text/plain' - }], - annotations: [], - status: 'passed', -}; - -const attachmentLinkRenderingTestCase: TestCase = { - testId: 'testid', - title: 'My test', - path: ['group'], - projectName: 'chromium', - location: { file: 'test.spec.ts', line: 42, column: 0 }, - tags: [], - outcome: 'expected', - duration: 10, - ok: true, - annotations: [], - results: [resultWithAttachment] -}; - -const testCaseSummary: TestCaseSummary = { - testId: 'nextTestId', - title: 'next test', - path: [], - projectName: 'chromium', - location: { file: 'test.spec.ts', line: 42, column: 0 }, - tags: [], - outcome: 'expected', - duration: 10, - ok: true, - annotations: [], - results: [resultWithAttachment] -}; - - -test('should correctly render links in attachments', async ({ mount }) => { - const component = await mount(); - await component.getByText('first attachment').click(); - const body = await component.getByText('The body with https://playwright.dev/docs/intro link'); - await expect(body).toBeVisible(); - await expect(body.locator('a').filter({ hasText: 'playwright.dev' })).toHaveAttribute('href', 'https://playwright.dev/docs/intro'); - await expect(body.locator('a').filter({ hasText: 'github.com' })).toHaveAttribute('href', 'https://github.com/microsoft/playwright/issues/31284'); - await expect(component).toMatchAriaSnapshot(` - - link "https://playwright.dev/docs/intro" - - link "https://github.com/microsoft/playwright/issues/31284" - `); -}); - -test('should correctly render links in attachment name', async ({ mount }) => { - const component = await mount(); - const link = component.getByText('attachment with inline link').locator('a'); - await expect(link).toHaveAttribute('href', 'https://github.com/microsoft/playwright/issues/31284'); - await expect(link).toHaveText('https://github.com/microsoft/playwright/issues/31284'); - await expect(component).toMatchAriaSnapshot(` - - link /https:\\/\\/github\\.com\\/microsoft\\/playwright\\/issues\\/\\d+/ - `); -}); - -test('should correctly render prev and next', async ({ mount }) => { - const component = await mount(); - await expect(component).toMatchAriaSnapshot(` - - text: group - - link "« previous" - - link "next »" - - text: "My test test.spec.ts:42 10ms chromium" - `); -}); - - -const testCaseWithTwoAttempts: TestCase = { - ...testCase, - results: [ - { - ...result, - errors: [{ message: 'Error message' }], - status: 'failed', - duration: 50, - }, - { - ...result, - duration: 150, - status: 'passed', - }, - ], -}; - -test('total duration is selected run duration', async ({ mount, page }) => { - const component = await mount(); - await expect(component).toMatchAriaSnapshot(` - - text: "My test test.spec.ts:42 200ms chromium" - - tablist: - - tab "Run 50ms" - - 'tab "Retry #1 150ms"' - `); - await page.getByRole('tab', { name: 'Run' }).click(); - await expect(component).toMatchAriaSnapshot(` - - text: "My test test.spec.ts:42 200ms chromium" - `); - await page.getByRole('tab', { name: 'Retry' }).click(); - await expect(component).toMatchAriaSnapshot(` - - text: "My test test.spec.ts:42 200ms chromium" - `); -}); diff --git a/packages/web/playwright/index.html b/packages/web/playwright/index.html deleted file mode 100644 index 2d7858da5578b..0000000000000 --- a/packages/web/playwright/index.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - Tests - - -
- - - diff --git a/packages/web/playwright/index.ts b/packages/web/playwright/index.ts deleted file mode 100644 index cb53a5548a668..0000000000000 --- a/packages/web/playwright/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import '../src/common.css'; -import '../src/theme'; -import '../src/third_party/vscode/codicon.css'; -import '../src/third_party/vscode/colors.css'; diff --git a/packages/web/src/components/codeMirrorWrapper.spec.tsx b/packages/web/src/components/codeMirrorWrapper.spec.tsx deleted file mode 100644 index 81e8f81d3c367..0000000000000 --- a/packages/web/src/components/codeMirrorWrapper.spec.tsx +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { expect, test } from '@playwright/experimental-ct-react'; -import { CodeMirrorWrapper } from './codeMirrorWrapper'; - -test.use({ viewport: { width: 500, height: 500 } }); - -const javascriptSnippet = `import { test, expect } from '@playwright/test'; - -test('basic test', async ({ page }) => { - await page.goto('https://playwright.dev/'); - const title = page.locator('.navbar__inner .navbar__title'); - await expect(title).toHaveText('Playwright'); -}); -`; - -const pythonSnippet = `import asyncio -from playwright.async_api import async_playwright - -async def main(): - async with async_playwright() as p: - # Works across chromium, firefox and webkit - browser = await p.chromium.launch(headless=False) - -asyncio.run(main()) -`; - -const javaSnippet = `import com.microsoft.playwright.*; - -public class Example { - public static void main(String[] args) { - try (Playwright playwright = Playwright.create()) { - BrowserType chromium = playwright.chromium(); - Browser browser = chromium.launch(new BrowserType.LaunchOptions().setHeadless(false)); - } - } -} -`; - -const csharpSnippet = ` -using Microsoft.Playwright; -using System.Threading.Tasks; - -class Program -{ - public static async Task Main() - { - using var playwright = await Playwright.CreateAsync(); - await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions - { - Headless = false - }); - } -} -`; - -test('highlight JavaScript', async ({ mount }) => { - const component = await mount(); - await expect(component.locator('text="async"').first()).toHaveClass('cm-keyword'); -}); - -test('highlight Python', async ({ mount }) => { - const component = await mount(); - await expect(component.locator('text="async"').first()).toHaveClass('cm-keyword'); -}); - -test('highlight Java', async ({ mount }) => { - const component = await mount(); - await expect(component.locator('text="public"').first()).toHaveClass('cm-keyword'); -}); - -test('highlight C#', async ({ mount }) => { - const component = await mount(); - await expect(component.locator('text="public"').first()).toHaveClass('cm-keyword'); -}); - -test('highlight lines', async ({ mount }) => { - const component = await mount(); - await expect(component.locator('.source-line-running')).toContainText('goto'); - await expect(component.locator('.source-line-paused')).toContainText('title'); - await expect(component.locator('.source-line-error')).toContainText('expect'); -}); diff --git a/packages/web/src/components/expandable.spec.tsx b/packages/web/src/components/expandable.spec.tsx deleted file mode 100644 index 9536004bec3bd..0000000000000 --- a/packages/web/src/components/expandable.spec.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { expect, test } from '@playwright/experimental-ct-react'; -import { Expandable } from './expandable'; - -test.use({ viewport: { width: 500, height: 500 } }); - -test('should render collapsed', async ({ mount }) => { - const component = await mount( {}} title='Title'>Details text); - await expect(component.locator('text=Title')).toBeVisible(); - await expect(component.locator('text=Details')).toBeHidden(); - await expect(component.locator('.codicon-chevron-right')).toBeVisible(); -}); - -test('should render expanded', async ({ mount }) => { - const component = await mount( {}} title='Title'>Details text); - await expect(component.locator('text=Title')).toBeVisible(); - await expect(component.locator('text=Details')).toBeVisible(); - await expect(component.locator('.codicon-chevron-down')).toBeVisible(); -}); - -test('click should expand', async ({ mount }) => { - let expanded = false; - const component = await mount( expanded = e} title='Title'>Details text); - await component.locator('.codicon-chevron-right').click(); - expect(expanded).toBeTruthy(); -}); diff --git a/packages/web/src/components/splitView.spec.tsx b/packages/web/src/components/splitView.spec.tsx deleted file mode 100644 index ca11520912f4c..0000000000000 --- a/packages/web/src/components/splitView.spec.tsx +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { expect, test } from '@playwright/experimental-ct-react'; -import { SplitView } from './splitView'; - -test.use({ viewport: { width: 500, height: 500 } }); - -test('should render', async ({ mount }) => { - const component = await mount( - main} - sidebar={} - />); - const mainBox = await component.locator('#main').boundingBox(); - const sidebarBox = await component.locator('#sidebar').boundingBox(); - expect.soft(mainBox).toEqual({ x: 0, y: 0, width: 500, height: 400 }); - expect.soft(sidebarBox).toEqual({ x: 0, y: 401, width: 500, height: 99 }); -}); - -test('should render sidebar first', async ({ mount }) => { - const component = await mount( - main} - sidebar={} - />); - const mainBox = await component.locator('#main').boundingBox(); - const sidebarBox = await component.locator('#sidebar').boundingBox(); - expect.soft(mainBox).toEqual({ x: 0, y: 100, width: 500, height: 400 }); - expect.soft(sidebarBox).toEqual({ x: 0, y: 0, width: 500, height: 99 }); -}); - -test('should render horizontal split', async ({ mount }) => { - const component = await mount( - main} - sidebar={} - />); - const mainBox = await component.locator('#main').boundingBox(); - const sidebarBox = await component.locator('#sidebar').boundingBox(); - expect.soft(mainBox).toEqual({ x: 100, y: 0, width: 400, height: 500 }); - expect.soft(sidebarBox).toEqual({ x: 0, y: 0, width: 99, height: 500 }); -}); - -test('should hide sidebar', async ({ mount }) => { - const component = await mount( - main} - sidebar={} - />); - const mainBox = await component.locator('#main').boundingBox(); - expect.soft(mainBox).toEqual({ x: 0, y: 0, width: 500, height: 500 }); -}); - -test('drag resize', async ({ page, mount }) => { - const component = await mount( - main} - sidebar={} - />); - await page.mouse.move(25, 400); - await page.mouse.down(); - await page.mouse.move(25, 100); - await page.mouse.up(); - const mainBox = await component.locator('#main').boundingBox(); - const sidebarBox = await component.locator('#sidebar').boundingBox(); - expect.soft(mainBox).toEqual({ x: 0, y: 0, width: 500, height: 100 }); - expect.soft(sidebarBox).toEqual({ x: 0, y: 101, width: 500, height: 399 }); -}); diff --git a/packages/web/src/shared/imageDiffView.spec.tsx b/packages/web/src/shared/imageDiffView.spec.tsx deleted file mode 100644 index 4fefaa1083105..0000000000000 --- a/packages/web/src/shared/imageDiffView.spec.tsx +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { test, expect } from '@playwright/experimental-ct-react'; -import type { ImageDiff } from './imageDiffView'; -import { ImageDiffView } from './imageDiffView'; - -test.use({ viewport: { width: 1000, height: 800 } }); - -const expectedPng = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAQAAAD9CzEMAAACMElEQVRYw+1XT0tCQRD/9Qci0Cw7mp1C6BMYnt5niMhPEEFCh07evNk54XnuGkhFehA/QxHkqYMEFWXpscMTipri7fqeu+vbfY+EoBkQ3Zn5zTo7MzsL/NNfoClkUUQNN3jCJ/ETfavRSpYkkSmFQzz8wMr4gaSp8OBJ2HCU4Iwd0kqGgd9GPxCccZ+0jWgWVW1wxlWy0qR51I3hv7lOllq7b4SC/+aGzr+QBadjEKgAykvzJGXwr/Lj4JfRk5hUSLKIa00HPUJRki0xeMWSWxVXmi5sddXKymqTyxdwquXAUVV3WREeLx3gTcNFWQY/jXtB8QIzgt4qTvAR4OCe0ATKCmrnmFMEM0Pp2BvrIisaFUdUjgKKZgYWSjjDLR5J+x13lATHuHSti6JBzQP+gq2QHXjfRaiJojbPgYqbmGFow0VpiyIW0/VIF9QKLzeBWA2MHmwCu8QJQV++Ps/joHQQH4HpuO0uobUeVztgIcr4Vnf4we9orWfUIWKHbEVyYKkPmaVpIVKICuo0ZYXWjHTITXWhsVYxkIDpUoKsla1i2Oz2QjvYG9fshu36GbFQ8DGyHNOuvRdOKZSDUtCFM7wyHeSM4XN8e7bOpd9F2gg+TRYal753bGkbuEjzMg0YW/yDV1czUDm+e43Byz86OnRwsYDMKXlmkYbeAOwffrtU/nGpXpwkXfPhVza+D9AiMAtrtOMYfVr0q8Wr1nh8n8ADZCJPqAk8AifyjP2n36cvkA6/Wln9MokAAAAASUVORK5CYII='; -const actualPng = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAQAAAD9CzEMAAACcElEQVRYw+2XQU9TQRDHfxAiYoFE8IaHhhjjN3hw4+SJk0npGU+iCQYv1kQjIQInj6+foh4amhjvEi8EI3yAIk24lBgoBkmqqYfuLvt23763r8QmJszc3sz+/29nZ3Zm4Vr+BxkgoESFPY7o0OGIPSqUCBi4OvgUmzToOLTBJlO9g08QcuEEl3pByEQv8Ascp4JLPWYhG/gQ5QjAGVWWmSXPTUa5xxxLfDJ2V2bIF36ELW3hASuMxfqNsiSOvatbjPj9fU0tabPOjUTvHG/4pfxrPrvQg7PqteNA20c5zbkYiWubgmZbZJcTzvjKGneMZP6m1hST4CdpGvmhU0zzXX0/5VFk5V21iyaTboJQwa7STqH4Y1AE6ixCd9XKxHsHFFIpTo1AvVal56juDeFQZxi8KNaMjJJh2oiDH+RQmFfUtzSKXQPjifh+yGBcsnWNrUhZJVO0DIxxFeTAJigJU9X4nkRxYqF8FL4lm6AiTMuW5bMzaXcs36fCs2IT7AvTjHNvNsVjy3dO+O3bBLLE8jF9oemsblPuq3KzRB7PrZhl8/z2pBhTteAkyMUunI+0HzdFzk0gwzDtvKde8SU2o3TJu0MkD3k28bYtpFDMuA/ZnaZZKJ6707SkuhJXoKi6Cy1QDT7XM8U4LfdVEXfZSXnAMz6wTZ1zzqmzrVWGTvEi6bK7vK4bWqO/zUtF7FJJMcxB0nWtN5y3omje89Nr8OpSrKc1HL1lBjzUGosPxWWTDX2a/o8M4FFNbPrm2NKLFrMMXtk1dfCKjo5ZteY3AEeHX3/1HH7jxne/4HiP7314gPTlCdWHR2BfnrHX8u/lL/ENCdIFFeD3AAAAAElFTkSuQmCC'; - -const actualAttachment = { name: 'screenshot-actual.png', path: actualPng, contentType: 'image/png', }; -const expectedAttachment = { name: 'screenshot-expected.png', path: expectedPng, contentType: 'image/png', }; -const diffAttachment = { name: 'screenshot-diff.png', path: expectedPng, contentType: 'image/png', }; - -const imageDiff: ImageDiff = { - name: 'log in', - actual: { attachment: actualAttachment }, - expected: { attachment: expectedAttachment, title: 'Expected' }, - diff: { attachment: diffAttachment }, -}; - -test('should render links', async ({ mount }) => { - const component = await mount(); - await expect(component.locator('a')).toHaveText([ - 'screenshot-diff.png', - 'screenshot-actual.png', - 'screenshot-expected.png', - ]); -}); - -test('should show diff by default', async ({ mount }) => { - const component = await mount(); - - const image = component.locator('img'); - const box = await image.boundingBox(); - expect(box).toEqual(expect.objectContaining({ width: 48, height: 48 })); -}); diff --git a/tests/library/trace-viewer.spec.ts b/tests/library/trace-viewer.spec.ts index 78a27bf16191c..06d91f6b0b2fe 100644 --- a/tests/library/trace-viewer.spec.ts +++ b/tests/library/trace-viewer.spec.ts @@ -481,6 +481,22 @@ test('should show font preview', async ({ page, runAndTrace, server }) => { await expect(traceViewer.page.locator('.network-request-details-tab')).toContainText('ABCDEF'); }); +test('should syntax highlight body', async ({ page, runAndTrace, server }) => { + const traceViewer = await runAndTrace(async () => { + await page.goto(`${server.PREFIX}/network-tab/network.html`); + await page.evaluate(() => (window as any).donePromise); + }); + await traceViewer.selectAction('Navigate'); + await traceViewer.showNetworkTab(); + + await traceViewer.page.getByText('HTML', { exact: true }).click(); + await expect(traceViewer.networkRequests).toHaveCount(1); + await traceViewer.networkRequests.getByText('network.html').click(); + await traceViewer.page.getByTestId('network-request-details').getByTitle('Body').click(); + const keyword = traceViewer.page.locator('.network-request-details-tab').getByText('const').first(); + await expect(keyword).toHaveClass('cm-keyword'); +}); + test('should filter network requests by url', async ({ page, runAndTrace, server }) => { const traceViewer = await runAndTrace(async () => { await page.goto(`${server.PREFIX}/network-tab/network.html`);