more conclusive text to cad playwright tests (#3672)

This commit is contained in:
Kurt Hutten
2024-08-27 16:36:05 +10:00
committed by GitHub
parent 3f47486fb5
commit b231a26115

View File

@ -6,6 +6,8 @@ import {
setupElectron, setupElectron,
createProjectAndRenameIt, createProjectAndRenameIt,
} from './test-utils' } from './test-utils'
import { join } from 'path'
import fs from 'fs'
test.beforeEach(async ({ context, page }) => { test.beforeEach(async ({ context, page }) => {
await setup(context, page) await setup(context, page)
@ -694,10 +696,9 @@ test(
'Text-to-CAD functionality', 'Text-to-CAD functionality',
{ tag: '@electron' }, { tag: '@electron' },
async ({ browserName }, testInfo) => { async ({ browserName }, testInfo) => {
const { electronApp, page } = await setupElectron({ const { electronApp, page, dir } = await setupElectron({ testInfo })
testInfo, const fileExists = () =>
folderSetupFn: async () => {}, fs.existsSync(join(dir, 'test-000', 'lego-2x4.kcl'))
})
await page.setViewportSize({ width: 1200, height: 500 }) await page.setViewportSize({ width: 1200, height: 500 })
@ -721,6 +722,7 @@ test(
// File is considered created if it shows up in the Project Files pane // File is considered created if it shows up in the Project Files pane
const file = page.getByRole('button', { name: 'lego-2x4.kcl' }) const file = page.getByRole('button', { name: 'lego-2x4.kcl' })
await expect(file).toBeVisible({ timeout: 20_000 }) await expect(file).toBeVisible({ timeout: 20_000 })
expect(fileExists()).toBeTruthy()
}) })
await test.step(`Test file navigation`, async () => { await test.step(`Test file navigation`, async () => {
@ -741,6 +743,7 @@ test(
`Successfully deleted file "lego-2x4.kcl"` `Successfully deleted file "lego-2x4.kcl"`
) )
await expect(submittingToastMessage).toBeVisible() await expect(submittingToastMessage).toBeVisible()
expect(fileExists()).toBeFalsy()
}) })
await electronApp.close() await electronApp.close()