Share file snapshots across platforms (#6282)

* Share file snapshots across platforms

* Always skip file snapshot tests on Windows
This commit is contained in:
Jace Browning
2025-04-14 09:26:52 -04:00
committed by GitHub
parent 5c188664bd
commit 22dd4a67dd
9 changed files with 16 additions and 59 deletions

View File

@ -6,9 +6,8 @@ import type { NamedView } from '@rust/kcl-lib/bindings/NamedView'
import {
createProject,
orRunWhenFullSuiteEnabled,
perProjectSettingsToToml,
runningOnMac,
runningOnWindows,
tomlToPerProjectSettings,
} from '@e2e/playwright/test-utils'
import { expect, test } from '@e2e/playwright/zoo-test'
@ -63,9 +62,7 @@ function tomlStringOverWriteNamedViewUuids(toml: string): string {
}
test.describe('Named view tests', () => {
if (runningOnMac()) {
test.fixme(orRunWhenFullSuiteEnabled())
}
test.skip(runningOnWindows(), 'Windows line endings break snapshot matching')
test('Verify project.toml is not created', async ({ page }, testInfo) => {
// Create project and load it
const projectName = 'named-views'
@ -127,7 +124,7 @@ test.describe('Named view tests', () => {
// Write the entire tomlString to a snapshot.
// There are many key/value pairs to check this is a safer match.
expect(tomlString).toMatchSnapshot('verify-named-view-gets-created')
expect(tomlString).toMatchSnapshot('verify-named-view-gets-created.toml')
}).toPass()
})
test('Verify named view gets deleted', async ({
@ -173,7 +170,7 @@ test.describe('Named view tests', () => {
// Write the entire tomlString to a snapshot.
// There are many key/value pairs to check this is a safer match.
expect(tomlString).toMatchSnapshot('verify-named-view-gets-created')
expect(tomlString).toMatchSnapshot('verify-named-view-gets-created.toml')
}).toPass()
// Delete a named view
@ -193,7 +190,7 @@ test.describe('Named view tests', () => {
// Write the entire tomlString to a snapshot.
// There are many key/value pairs to check this is a safer match.
expect(tomlString).toMatchSnapshot('verify-named-view-gets-deleted')
expect(tomlString).toMatchSnapshot('verify-named-view-gets-deleted.toml')
}).toPass()
})
test('Verify named view gets loaded', async ({
@ -239,7 +236,7 @@ test.describe('Named view tests', () => {
// Write the entire tomlString to a snapshot.
// There are many key/value pairs to check this is a safer match.
expect(tomlString).toMatchSnapshot('verify-named-view-gets-created')
expect(tomlString).toMatchSnapshot('verify-named-view-gets-created.toml')
}).toPass()
// Create a load a named view
@ -308,7 +305,9 @@ test.describe('Named view tests', () => {
// Write the entire tomlString to a snapshot.
// There are many key/value pairs to check this is a safer match.
expect(tomlString).toMatchSnapshot('verify-two-named-view-gets-created')
expect(tomlString).toMatchSnapshot(
'verify-two-named-view-gets-created.toml'
)
}).toPass()
})
})

View File

@ -1,16 +0,0 @@
[settings]
modeling = { }
text_editor = { }
command_bar = { }
[settings.app.named_views.0656fb1a-9640-473e-b334-591dc70c0138]
name = "uuid1"
eye_offset = 1_378.0059
fov_y = 45
is_ortho = false
ortho_scale_enabled = true
ortho_scale_factor = 1.6
pivot_position = [ 0, 0, 0 ]
pivot_rotation = [ 0.5380994, 0.0, 0.0, 0.8428814 ]
world_coord_system = "right_handed_up_z"
version = 1

View File

@ -1,28 +0,0 @@
[settings]
modeling = { }
text_editor = { }
command_bar = { }
[settings.app.named_views.0656fb1a-9640-473e-b334-591dc70c0138]
name = "uuid1"
eye_offset = 1_378.0059
fov_y = 45
is_ortho = false
ortho_scale_enabled = true
ortho_scale_factor = 1.6
pivot_position = [ 0, 0, 0 ]
pivot_rotation = [ 0.5380994, 0.0, 0.0, 0.8428814 ]
world_coord_system = "right_handed_up_z"
version = 1
[settings.app.named_views.c810cf04-c6cc-4a4a-8b11-17bf445dcab7]
name = "uuid2"
eye_offset = 1_378.0059
fov_y = 45
is_ortho = false
ortho_scale_enabled = true
ortho_scale_factor = 1.6
pivot_position = [ 1_826.5239, 0.0, 0.0 ]
pivot_rotation = [ 0.5380994, 0.0, 0.0, 0.8428814 ]
world_coord_system = "right_handed_up_z"
version = 1

View File

@ -35,9 +35,9 @@ export default defineConfig({
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Do not retry */
retries: process.env.CI ? 0 : 0,
forbidOnly: Boolean(process.env.CI),
/* Do not retry using Playwright's built-in retry mechanism */
retries: 0,
/* Use all available CPU cores */
workers: workers,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */

View File

@ -32,11 +32,13 @@ export default defineConfig({
timeout: 120_000, // override the default 30s timeout
testDir: './e2e/playwright',
testIgnore: '*.test.ts', // ignore unit tests
/* Share snapshots across all platforms */
snapshotPathTemplate: '{testDir}/{testFileName}-snapshots/{arg}{ext}',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: true,
/* Do not retry */
forbidOnly: Boolean(process.env.CI),
/* Do not retry using Playwright's built-in retry mechanism */
retries: 0,
/* Use all available CPU cores */
workers: workers,