diff --git a/tests/extension.spec.ts b/tests/extension.spec.ts index 9fe897c..23b21c4 100644 --- a/tests/extension.spec.ts +++ b/tests/extension.spec.ts @@ -18,18 +18,22 @@ test('authorized popup page', async ({ await expect(page.locator('button')).toHaveCount(2) }) -async function getFirstDiffScreenshot(page: Page, url: string) { +async function getFirstDiffScreenshot( + page: Page, + url: string, + extension: string +) { page.on('console', msg => console.log(msg.text())) await page.goto(url) // waiting for the canvas (that holds the diff) to show up await page.waitForSelector( - '.js-file[data-file-type=".obj"] .js-file-content canvas' + `.js-file[data-file-type=".${extension}"] .js-file-content canvas` ) // screenshot the file diff with its toolbar const element = await page.waitForSelector( - '.js-file[data-file-type=".obj"]' + `.js-file[data-file-type=".${extension}"]` ) await page.waitForTimeout(1000) // making sure the element fully settled in return await element.screenshot() @@ -39,17 +43,26 @@ test('pull request diff with an .obj file', async ({ page, authorizedBackground, }) => { - const url = 'https://github.com/KittyCAD/kittycad.ts/pull/3/files' - const screenshot = await getFirstDiffScreenshot(page, url) + const url = 'https://github.com/KittyCAD/diff-samples/pull/2/files' + const screenshot = await getFirstDiffScreenshot(page, url, 'obj') expect(screenshot).toMatchSnapshot() }) -test('commit diff with an .obj file', async ({ +test('pull request diff with a .step file', async ({ + page, + authorizedBackground, +}) => { + const url = 'https://github.com/KittyCAD/diff-samples/pull/2/files' + const screenshot = await getFirstDiffScreenshot(page, url, 'step') + expect(screenshot).toMatchSnapshot() +}) + +test('commit diff with a .step file', async ({ page, authorizedBackground, }) => { const url = - 'https://github.com/KittyCAD/kittycad.ts/commit/08b50ee5a23b3ae7dd7b19383f14bbd520079cc1' - const screenshot = await getFirstDiffScreenshot(page, url) + 'https://github.com/KittyCAD/diff-samples/commit/fd9eec79f0464833686ea6b5b34ea07145e32734' + const screenshot = await getFirstDiffScreenshot(page, url, 'step') expect(screenshot).toMatchSnapshot() }) diff --git a/tests/extension.spec.ts-snapshots/commit-diff-with-a-step-file-1-chromium-darwin.png b/tests/extension.spec.ts-snapshots/commit-diff-with-a-step-file-1-chromium-darwin.png new file mode 100644 index 0000000..15d7dd7 Binary files /dev/null and b/tests/extension.spec.ts-snapshots/commit-diff-with-a-step-file-1-chromium-darwin.png differ diff --git a/tests/extension.spec.ts-snapshots/commit-diff-with-a-step-file-1-chromium-linux.png b/tests/extension.spec.ts-snapshots/commit-diff-with-a-step-file-1-chromium-linux.png new file mode 100644 index 0000000..cc20f8b Binary files /dev/null and b/tests/extension.spec.ts-snapshots/commit-diff-with-a-step-file-1-chromium-linux.png differ diff --git a/tests/extension.spec.ts-snapshots/commit-diff-with-an-obj-file-1-chromium-darwin.png b/tests/extension.spec.ts-snapshots/commit-diff-with-an-obj-file-1-chromium-darwin.png deleted file mode 100644 index 8f77d2d..0000000 Binary files a/tests/extension.spec.ts-snapshots/commit-diff-with-an-obj-file-1-chromium-darwin.png and /dev/null differ diff --git a/tests/extension.spec.ts-snapshots/commit-diff-with-an-obj-file-1-chromium-linux.png b/tests/extension.spec.ts-snapshots/commit-diff-with-an-obj-file-1-chromium-linux.png deleted file mode 100644 index 08a273d..0000000 Binary files a/tests/extension.spec.ts-snapshots/commit-diff-with-an-obj-file-1-chromium-linux.png and /dev/null differ diff --git a/tests/extension.spec.ts-snapshots/pull-request-diff-with-a-step-file-1-chromium-darwin.png b/tests/extension.spec.ts-snapshots/pull-request-diff-with-a-step-file-1-chromium-darwin.png new file mode 100644 index 0000000..5977918 Binary files /dev/null and b/tests/extension.spec.ts-snapshots/pull-request-diff-with-a-step-file-1-chromium-darwin.png differ diff --git a/tests/extension.spec.ts-snapshots/pull-request-diff-with-a-step-file-1-chromium-linux.png b/tests/extension.spec.ts-snapshots/pull-request-diff-with-a-step-file-1-chromium-linux.png new file mode 100644 index 0000000..9012554 Binary files /dev/null and b/tests/extension.spec.ts-snapshots/pull-request-diff-with-a-step-file-1-chromium-linux.png differ diff --git a/tests/extension.spec.ts-snapshots/pull-request-diff-with-an-obj-file-1-chromium-darwin.png b/tests/extension.spec.ts-snapshots/pull-request-diff-with-an-obj-file-1-chromium-darwin.png index 88d0b05..7854ace 100644 Binary files a/tests/extension.spec.ts-snapshots/pull-request-diff-with-an-obj-file-1-chromium-darwin.png and b/tests/extension.spec.ts-snapshots/pull-request-diff-with-an-obj-file-1-chromium-darwin.png differ diff --git a/tests/extension.spec.ts-snapshots/pull-request-diff-with-an-obj-file-1-chromium-linux.png b/tests/extension.spec.ts-snapshots/pull-request-diff-with-an-obj-file-1-chromium-linux.png index 85633ca..ed8afdd 100644 Binary files a/tests/extension.spec.ts-snapshots/pull-request-diff-with-an-obj-file-1-chromium-linux.png and b/tests/extension.spec.ts-snapshots/pull-request-diff-with-an-obj-file-1-chromium-linux.png differ