This commit is contained in:
lee-at-zoo-corp
2025-03-27 10:47:25 -04:00
parent 81f70251e1
commit 9e19d131eb
8 changed files with 53 additions and 19 deletions

View File

@ -76,4 +76,3 @@ test(
await expect(page.getByText(notFoundText).nth(1)).toBeVisible()
}
)

View File

@ -189,7 +189,7 @@ test.describe('Point-and-click tests', () => {
editor,
toolbar,
scene,
cmdBar
cmdBar,
}) => {
const file = await fs.readFile(
path.resolve(
@ -1588,7 +1588,7 @@ extrude001 = extrude(profile001, length = 100)
page,
homePage,
scene,
cmdBar
cmdBar,
}) => {
const initialCode = `sketch001 = startSketchOn(XZ)
|> circle(center = [0, 0], radius = 30)

View File

@ -401,7 +401,9 @@ test(
await page.getByText('broken-code').click()
// Gotcha: You can not use scene.settled() since the KCL code is going to fail
await expect(page.getByTestId('model-state-indicator-playing')).toBeAttached()
await expect(
page.getByTestId('model-state-indicator-playing')
).toBeAttached()
// Gotcha: Scroll to the text content in code mirror because CodeMirror lazy loads DOM content
await editor.scrollToText(

View File

@ -74,7 +74,10 @@ async function waitForPageLoadWithRetry(page: Page) {
await expect(async () => {
await page.goto('/')
const errorMessage = 'App failed to load - 🔃 Retrying ...'
await expect(page.getByTestId('model-state-indicator-playing'), errorMessage).toBeAttached({
await expect(
page.getByTestId('model-state-indicator-playing'),
errorMessage
).toBeAttached({
timeout: 20_000,
})
@ -873,7 +876,7 @@ export async function setup(
context: BrowserContext,
page: Page,
testDir: string,
testInfo?: TestInfo,
testInfo?: TestInfo
) {
await page.addInitScript(
async ({

View File

@ -250,7 +250,12 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
},
] as const
for (const { testName, value, constraint } of cases) {
test(`${constraint} - ${testName}`, async ({ page, homePage, scene, cmdBar }) => {
test(`${constraint} - ${testName}`, async ({
page,
homePage,
scene,
cmdBar,
}) => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
@ -361,7 +366,12 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
},
] as const
for (const { testName, addVariable, value, constraint } of cases) {
test(`${constraint} - ${testName}`, async ({ page, homePage, scene, cmdBar }) => {
test(`${constraint} - ${testName}`, async ({
page,
homePage,
scene,
cmdBar,
}) => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
@ -655,7 +665,14 @@ test.describe('Testing constraints', { tag: ['@skipWin'] }, () => {
},
] as const
for (const { testName, addVariable, value, constraint } of cases) {
test(`${testName}`, async ({ context, homePage, page, editor, scene, cmdBar }) => {
test(`${testName}`, async ({
context,
homePage,
page,
editor,
scene,
cmdBar,
}) => {
// constants and locators
const cmdBarKclInput = page
.getByTestId('cmd-bar-arg-value')
@ -995,7 +1012,7 @@ part002 = startSketchOn(XZ)
page,
homePage,
scene,
cmdBar
cmdBar,
}) => {
test.fixme(orRunWhenFullSuiteEnabled())
test.setTimeout(70_000)

View File

@ -305,7 +305,8 @@ class EngineConnection extends EventTarget {
)
isUsingConnectionLite: boolean = false
timeoutToForceConnectId: ReturnType<typeof setTimeout> = setTimeout(() => {}, 3000)
timeoutToForceConnectId: ReturnType<typeof setTimeout> = setTimeout(() => {},
3000)
constructor({
engineCommandManager,

View File

@ -456,7 +456,9 @@ const getAppFolderName = () => {
export const getAppSettingsFilePath = async () => {
const isTestEnv = window.electron.process.env.IS_PLAYWRIGHT === 'true'
const testSettingsPath = await window.electron.getAppTestProperty('TEST_SETTINGS_FILE_KEY')
const testSettingsPath = await window.electron.getAppTestProperty(
'TEST_SETTINGS_FILE_KEY'
)
const appConfig = await window.electron.getPath('appData')
@ -476,7 +478,9 @@ export const getAppSettingsFilePath = async () => {
}
const getTokenFilePath = async () => {
const isTestEnv = window.electron.process.env.IS_PLAYWRIGHT === 'true'
const testSettingsPath = await window.electron.getAppTestProperty('TEST_SETTINGS_FILE_KEY')
const testSettingsPath = await window.electron.getAppTestProperty(
'TEST_SETTINGS_FILE_KEY'
)
const appConfig = await window.electron.getPath('appData')
const fullPath = isTestEnv
@ -495,7 +499,9 @@ const getTokenFilePath = async () => {
const getTelemetryFilePath = async () => {
const isTestEnv = window.electron.process.env.IS_PLAYWRIGHT === 'true'
const testSettingsPath = await window.electron.getAppTestProperty('TEST_SETTINGS_FILE_KEY')
const testSettingsPath = await window.electron.getAppTestProperty(
'TEST_SETTINGS_FILE_KEY'
)
const appConfig = await window.electron.getPath('appData')
const fullPath = isTestEnv
@ -514,7 +520,9 @@ const getTelemetryFilePath = async () => {
const getRawTelemetryFilePath = async () => {
const isTestEnv = window.electron.process.env.IS_PLAYWRIGHT === 'true'
const testSettingsPath = await window.electron.getAppTestProperty('TEST_SETTINGS_FILE_KEY')
const testSettingsPath = await window.electron.getAppTestProperty(
'TEST_SETTINGS_FILE_KEY'
)
const appConfig = await window.electron.getPath('appData')
const fullPath = isTestEnv
@ -544,7 +552,9 @@ const getProjectSettingsFilePath = async (projectPath: string) => {
export const getInitialDefaultDir = async () => {
const isTestEnv = window.electron.process.env.IS_PLAYWRIGHT === 'true'
const testSettingsPath = await window.electron.getAppTestProperty('TEST_SETTINGS_FILE_KEY')
const testSettingsPath = await window.electron.getAppTestProperty(
'TEST_SETTINGS_FILE_KEY'
)
if (!window.electron) {
return ''

View File

@ -17,7 +17,9 @@ const save_ = async (file: ModelingAppFile, toastId: string) => {
if (window.electron.process.env.IS_PLAYWRIGHT) {
// Skip file picker, save to the test dir downloads directory
const testSettingsPath = await window.electron.getAppTestProperty('TEST_SETTINGS_FILE_KEY')
const testSettingsPath = await window.electron.getAppTestProperty(
'TEST_SETTINGS_FILE_KEY'
)
const downloadDir = window.electron.join(
testSettingsPath,
'downloads-during-playwright'