This commit is contained in:
Kurt Hutten Irev-Dev
2024-08-13 17:02:24 +10:00
parent 128c9cb3f8
commit 713a302479

View File

@ -1,8 +1,5 @@
import { _electron as electron, test, expect } from '@playwright/test'
import {
getUtils,
tearDown,
} from './test-utils'
import { getUtils, tearDown } from './test-utils'
import fs from 'node:fs'
import { secrets } from './secrets'
@ -10,7 +7,10 @@ test.afterEach(async ({ page }, testInfo) => {
await tearDown(page, testInfo)
})
test('When the project folder is empty, user can create new project and open it.', { tag: '@electron' }, async () => {
test(
'When the project folder is empty, user can create new project and open it.',
{ tag: '@electron' },
async () => {
// create or otherwise clear the folder ./electron-test-projects-dir
const fileName = './electron-test-projects-dir'
try {
@ -39,13 +39,15 @@ test('When the project folder is empty, user can create new project and open it.
(token) => localStorage.setItem('TOKEN_PERSIST_KEY', token),
secrets.token
)
await page.evaluate((fullPath) =>
await page.evaluate(
(fullPath) =>
localStorage.setItem(
'APP_SETTINGS_OVERRIDE',
JSON.stringify({
projectDirectory: fullPath,
})
), fullPath
),
fullPath
)
const u = await getUtils(page)
@ -70,11 +72,14 @@ test('When the project folder is empty, user can create new project and open it.
timeout: 20_000,
})
await expect(page.getByRole('button', { name: 'Start Sketch' })).toBeEnabled({
await expect(
page.getByRole('button', { name: 'Start Sketch' })
).toBeEnabled({
timeout: 20_000,
})
await page.locator('.cm-content').fill(`const sketch001 = startSketchOn('XZ')
await page.locator('.cm-content')
.fill(`const sketch001 = startSketchOn('XZ')
|> startProfileAt([-87.4, 282.92], %)
|> line([324.07, 27.199], %, $seg01)
|> line([118.328, -291.754], %)
@ -99,4 +104,5 @@ const extrude001 = extrude(200, sketch001)`)
.toBeLessThan(10)
await electronApp.close()
})
}
)