Files
diff-viewer-extension/tests/extension.spec.ts
Pierre Jacquier f4fa083137 e2e tests (#17)
* Setup playwright for e2e tests
Fixes #12

* Chromium

* First working test, clean up

* Merge actions

* New headless mode

* Clean up, bugfix

* Bug fixes, cleaner sendMessage code

* Rebase

* Rebase

* Load tokens and open public page

* Test CI

* Working test

* Lint

* Try to address flakyness

* Clean up test

* Comment

* No export

* More clean up

* More clean up

* Adds authorized pop up test

* Adds comment

* Add snapshots

* New linux screenshots
2023-03-15 04:32:46 -04:00

47 lines
1.6 KiB
TypeScript

import { test, expect } from './fixtures'
test('popup page', async ({ page, extensionId }) => {
await page.goto(`chrome-extension://${extensionId}/index.html`)
await expect(page.locator('body')).toContainText('Enter a GitHub token')
await expect(page.locator('body')).toContainText('Enter a KittyCAD token')
})
test('authorized popup page', async ({
page,
extensionId,
authorizedBackground,
}) => {
await page.goto(`chrome-extension://${extensionId}/index.html`)
await page.waitForSelector('button')
await expect(page.locator('body')).toContainText('Sign out')
await expect(page.locator('button')).toHaveCount(2)
})
test('pull request diff with an .obj file', async ({
page,
authorizedBackground,
}) => {
page.on('console', msg => console.log(msg.text()))
await page.goto('https://github.com/KittyCAD/kittycad.ts/pull/3/files')
const element = await page.waitForSelector('.js-file-content canvas')
await page.waitForTimeout(1000) // making sure the element fully settled in
const screenshot = await element.screenshot()
expect(screenshot).toMatchSnapshot()
})
test('commit diff with an .obj file', async ({
page,
authorizedBackground,
}) => {
page.on('console', msg => console.log(msg.text()))
await page.goto(
'https://github.com/KittyCAD/kittycad.ts/commit/08b50ee5a23b3ae7dd7b19383f14bbd520079cc1'
)
const element = await page.waitForSelector('.js-file-content canvas')
await page.waitForTimeout(1000) // making sure the element fully settled in
const screenshot = await element.screenshot()
expect(screenshot).toMatchSnapshot()
})