Pass projects, fought hard with filechooser
This commit is contained in:
@ -1,49 +1,41 @@
|
|||||||
import { test, expect } from '@playwright/test'
|
import { test, expect } from './zoo-test'
|
||||||
import {
|
import {
|
||||||
doExport,
|
doExport,
|
||||||
executorInputPath,
|
executorInputPath,
|
||||||
getUtils,
|
getUtils,
|
||||||
isOutOfViewInScrollContainer,
|
isOutOfViewInScrollContainer,
|
||||||
Paths,
|
Paths,
|
||||||
setupElectron,
|
|
||||||
tearDown,
|
|
||||||
createProject,
|
createProject,
|
||||||
|
getPlaywrightDownloadDir,
|
||||||
} from './test-utils'
|
} from './test-utils'
|
||||||
import fsp from 'fs/promises'
|
import fsp from 'fs/promises'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import { join } from 'path'
|
import path from 'path'
|
||||||
import { DEFAULT_PROJECT_KCL_FILE } from 'lib/constants'
|
import { DEFAULT_PROJECT_KCL_FILE } from 'lib/constants'
|
||||||
|
|
||||||
test.afterEach(async ({ page }, testInfo) => {
|
|
||||||
await tearDown(page, testInfo)
|
|
||||||
})
|
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'projects reload if a new one is created, deleted, or renamed externally',
|
'projects reload if a new one is created, deleted, or renamed externally',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
let externalCreatedProjectName = 'external-created-project'
|
let externalCreatedProjectName = 'external-created-project'
|
||||||
|
|
||||||
let targetDir = ''
|
let targetDir = ''
|
||||||
|
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
targetDir = dir
|
targetDir = dir
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const myDir = join(dir, externalCreatedProjectName)
|
const myDir = path.join(dir, externalCreatedProjectName)
|
||||||
;(async () => {
|
;(async () => {
|
||||||
await fsp.mkdir(myDir)
|
await fsp.mkdir(myDir)
|
||||||
await fsp.writeFile(
|
await fsp.writeFile(
|
||||||
join(myDir, DEFAULT_PROJECT_KCL_FILE),
|
path.join(myDir, DEFAULT_PROJECT_KCL_FILE),
|
||||||
'sca ba be bop de day wawa skee'
|
'sca ba be bop de day wawa skee'
|
||||||
)
|
)
|
||||||
})().catch(console.error)
|
})().catch(console.error)
|
||||||
}, 5000)
|
}, 5000)
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
const projectLinks = page.getByTestId('project-link')
|
const projectLinks = page.getByTestId('project-link')
|
||||||
|
|
||||||
@ -51,34 +43,29 @@ test(
|
|||||||
await expect(projectLinks).toContainText(externalCreatedProjectName)
|
await expect(projectLinks).toContainText(externalCreatedProjectName)
|
||||||
|
|
||||||
await fsp.rename(
|
await fsp.rename(
|
||||||
join(targetDir, externalCreatedProjectName),
|
path.join(targetDir, externalCreatedProjectName),
|
||||||
join(targetDir, externalCreatedProjectName + '1')
|
path.join(targetDir, externalCreatedProjectName + '1')
|
||||||
)
|
)
|
||||||
|
|
||||||
externalCreatedProjectName += '1'
|
externalCreatedProjectName += '1'
|
||||||
await expect(projectLinks).toContainText(externalCreatedProjectName)
|
await expect(projectLinks).toContainText(externalCreatedProjectName)
|
||||||
|
|
||||||
await fsp.rm(join(targetDir, externalCreatedProjectName), {
|
await fsp.rm(path.join(targetDir, externalCreatedProjectName), {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
force: true,
|
force: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
await expect(projectLinks).toHaveCount(0)
|
await expect(projectLinks).toHaveCount(0)
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'click help/keybindings from home page',
|
'click help/keybindings from home page',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ page }, testInfo) => {
|
||||||
const { electronApp, page } = await setupElectron({
|
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async () => {},
|
|
||||||
})
|
|
||||||
|
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -90,27 +77,23 @@ test(
|
|||||||
// Make sure the keyboard shortcuts modal is visible.
|
// Make sure the keyboard shortcuts modal is visible.
|
||||||
await expect(page.getByText('Enter Sketch Mode')).toBeVisible()
|
await expect(page.getByText('Enter Sketch Mode')).toBeVisible()
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'click help/keybindings from project page',
|
'click help/keybindings from project page',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
const bracketDir = path.join(dir, 'bracket')
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
const bracketDir = join(dir, 'bracket')
|
|
||||||
await fsp.mkdir(bracketDir, { recursive: true })
|
await fsp.mkdir(bracketDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
||||||
join(bracketDir, 'main.kcl')
|
path.join(bracketDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -132,7 +115,6 @@ test(
|
|||||||
// Make sure the keyboard shortcuts modal is visible.
|
// Make sure the keyboard shortcuts modal is visible.
|
||||||
await expect(page.getByText('Enter Sketch Mode')).toBeVisible()
|
await expect(page.getByText('Enter Sketch Mode')).toBeVisible()
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -468,19 +450,16 @@ test(
|
|||||||
test(
|
test(
|
||||||
'when code with error first loads you get errors in console',
|
'when code with error first loads you get errors in console',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
await fsp.mkdir(path.join(dir, 'broken-code'), { recursive: true })
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
await fsp.mkdir(join(dir, 'broken-code'), { recursive: true })
|
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('broken-code-test.kcl'),
|
executorInputPath('broken-code-test.kcl'),
|
||||||
join(dir, 'broken-code', 'main.kcl')
|
path.join(dir, 'broken-code', 'main.kcl')
|
||||||
)
|
)
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
await expect(page.getByText('broken-code')).toBeVisible()
|
await expect(page.getByText('broken-code')).toBeVisible()
|
||||||
|
|
||||||
@ -499,7 +478,6 @@ test(
|
|||||||
const crypticErrorText = `Expected a tag declarator`
|
const crypticErrorText = `Expected a tag declarator`
|
||||||
await expect(page.getByText(crypticErrorText).first()).toBeVisible()
|
await expect(page.getByText(crypticErrorText).first()).toBeVisible()
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -510,20 +488,17 @@ test.describe('Can export from electron app', () => {
|
|||||||
test(
|
test(
|
||||||
`Can export using ${method}`,
|
`Can export using ${method}`,
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
const bracketDir = path.join(dir, 'bracket')
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
const bracketDir = join(dir, 'bracket')
|
|
||||||
await fsp.mkdir(bracketDir, { recursive: true })
|
await fsp.mkdir(bracketDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
||||||
join(bracketDir, 'main.kcl')
|
path.join(bracketDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
@ -571,12 +546,17 @@ test.describe('Can export from electron app', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const filepath = path.resolve(
|
||||||
|
getPlaywrightDownloadDir(page),
|
||||||
|
'main.gltf'
|
||||||
|
)
|
||||||
|
|
||||||
await test.step('Check the export size', async () => {
|
await test.step('Check the export size', async () => {
|
||||||
await expect
|
await expect
|
||||||
.poll(
|
.poll(
|
||||||
async () => {
|
async () => {
|
||||||
try {
|
try {
|
||||||
const outputGltf = await fsp.readFile('main.gltf')
|
const outputGltf = await fsp.readFile(filepath)
|
||||||
return outputGltf.byteLength
|
return outputGltf.byteLength
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return 0
|
return 0
|
||||||
@ -587,10 +567,9 @@ test.describe('Can export from electron app', () => {
|
|||||||
.toBeGreaterThan(300_000)
|
.toBeGreaterThan(300_000)
|
||||||
|
|
||||||
// clean up exported file
|
// clean up exported file
|
||||||
await fsp.rm('main.gltf')
|
await fsp.rm(filepath)
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -598,10 +577,8 @@ test.describe('Can export from electron app', () => {
|
|||||||
test(
|
test(
|
||||||
'Rename and delete projects, also spam arrow keys when renaming',
|
'Rename and delete projects, also spam arrow keys when renaming',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page}, testInfo) => {
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
await fsp.mkdir(`${dir}/router-template-slate`, { recursive: true })
|
await fsp.mkdir(`${dir}/router-template-slate`, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
||||||
@ -626,10 +603,9 @@ test(
|
|||||||
)
|
)
|
||||||
const _1995 = new Date('1995-01-01T00:03:33')
|
const _1995 = new Date('1995-01-01T00:03:33')
|
||||||
fs.utimesSync(`${dir}/lego/main.kcl`, _1995, _1995)
|
fs.utimesSync(`${dir}/lego/main.kcl`, _1995, _1995)
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -795,25 +771,21 @@ test(
|
|||||||
await expect(page.getByText('bracket')).toBeVisible()
|
await expect(page.getByText('bracket')).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'pressing "delete" on home screen should do nothing',
|
'pressing "delete" on home screen should do nothing',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
await fsp.mkdir(`${dir}/router-template-slate`, { recursive: true })
|
await fsp.mkdir(`${dir}/router-template-slate`, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
||||||
`${dir}/router-template-slate/main.kcl`
|
`${dir}/router-template-slate/main.kcl`
|
||||||
)
|
)
|
||||||
},
|
|
||||||
})
|
})
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -828,7 +800,6 @@ test(
|
|||||||
await expect(page.getByText('router-template-slate')).toBeVisible()
|
await expect(page.getByText('router-template-slate')).toBeVisible()
|
||||||
await expect(page.getByText('Your Projects')).toBeVisible()
|
await expect(page.getByText('Your Projects')).toBeVisible()
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -836,17 +807,14 @@ test.describe(`Project management commands`, () => {
|
|||||||
test(
|
test(
|
||||||
`Rename from project page`,
|
`Rename from project page`,
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const projectName = `my_project_to_rename`
|
const projectName = `my_project_to_rename`
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
|
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
||||||
`${dir}/${projectName}/main.kcl`
|
`${dir}/${projectName}/main.kcl`
|
||||||
)
|
)
|
||||||
},
|
|
||||||
})
|
})
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
|
|
||||||
@ -866,7 +834,7 @@ test.describe(`Project management commands`, () => {
|
|||||||
const toastMessage = page.getByText(`Successfully renamed`)
|
const toastMessage = page.getByText(`Successfully renamed`)
|
||||||
|
|
||||||
await test.step(`Setup`, async () => {
|
await test.step(`Setup`, async () => {
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
await projectHomeLink.click()
|
await projectHomeLink.click()
|
||||||
@ -895,24 +863,20 @@ test.describe(`Project management commands`, () => {
|
|||||||
await expect(projectHomeLink.first()).toContainText(projectRenamedName)
|
await expect(projectHomeLink.first()).toContainText(projectRenamedName)
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
`Delete from project page`,
|
`Delete from project page`,
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName: _ }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const projectName = `my_project_to_delete`
|
const projectName = `my_project_to_delete`
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
|
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
||||||
`${dir}/${projectName}/main.kcl`
|
`${dir}/${projectName}/main.kcl`
|
||||||
)
|
)
|
||||||
},
|
|
||||||
})
|
})
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
|
|
||||||
@ -929,7 +893,7 @@ test.describe(`Project management commands`, () => {
|
|||||||
const noProjectsMessage = page.getByText('No Projects found')
|
const noProjectsMessage = page.getByText('No Projects found')
|
||||||
|
|
||||||
await test.step(`Setup`, async () => {
|
await test.step(`Setup`, async () => {
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
await projectHomeLink.click()
|
await projectHomeLink.click()
|
||||||
@ -952,23 +916,19 @@ test.describe(`Project management commands`, () => {
|
|||||||
await expect(noProjectsMessage).toBeVisible()
|
await expect(noProjectsMessage).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
test(
|
test(
|
||||||
`Rename from home page`,
|
`Rename from home page`,
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName: _ }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const projectName = `my_project_to_rename`
|
const projectName = `my_project_to_rename`
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
|
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
||||||
`${dir}/${projectName}/main.kcl`
|
`${dir}/${projectName}/main.kcl`
|
||||||
)
|
)
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Constants and locators
|
// Constants and locators
|
||||||
@ -986,7 +946,7 @@ test.describe(`Project management commands`, () => {
|
|||||||
const toastMessage = page.getByText(`Successfully renamed`)
|
const toastMessage = page.getByText(`Successfully renamed`)
|
||||||
|
|
||||||
await test.step(`Setup`, async () => {
|
await test.step(`Setup`, async () => {
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
await expect(projectHomeLink).toBeVisible()
|
await expect(projectHomeLink).toBeVisible()
|
||||||
})
|
})
|
||||||
@ -1012,23 +972,19 @@ test.describe(`Project management commands`, () => {
|
|||||||
await expect(projectHomeLink).not.toHaveText(projectName)
|
await expect(projectHomeLink).not.toHaveText(projectName)
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
test(
|
test(
|
||||||
`Delete from home page`,
|
`Delete from home page`,
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName: _ }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const projectName = `my_project_to_delete`
|
const projectName = `my_project_to_delete`
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
|
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
||||||
`${dir}/${projectName}/main.kcl`
|
`${dir}/${projectName}/main.kcl`
|
||||||
)
|
)
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Constants and locators
|
// Constants and locators
|
||||||
@ -1044,7 +1000,7 @@ test.describe(`Project management commands`, () => {
|
|||||||
const noProjectsMessage = page.getByText('No Projects found')
|
const noProjectsMessage = page.getByText('No Projects found')
|
||||||
|
|
||||||
await test.step(`Setup`, async () => {
|
await test.step(`Setup`, async () => {
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
await expect(projectHomeLink).toBeVisible()
|
await expect(projectHomeLink).toBeVisible()
|
||||||
})
|
})
|
||||||
@ -1066,7 +1022,6 @@ test.describe(`Project management commands`, () => {
|
|||||||
await expect(noProjectsMessage).toBeVisible()
|
await expect(noProjectsMessage).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -1074,11 +1029,9 @@ test.describe(`Project management commands`, () => {
|
|||||||
test(
|
test(
|
||||||
'File in the file pane should open with a single click',
|
'File in the file pane should open with a single click',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const projectName = 'router-template-slate'
|
const projectName = 'router-template-slate'
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
|
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl',
|
||||||
@ -1088,10 +1041,9 @@ test(
|
|||||||
'src/wasm-lib/tests/executor/inputs/focusrite_scarlett_mounting_braket.kcl',
|
'src/wasm-lib/tests/executor/inputs/focusrite_scarlett_mounting_braket.kcl',
|
||||||
`${dir}/${projectName}/otherThingToClickOn.kcl`
|
`${dir}/${projectName}/otherThingToClickOn.kcl`
|
||||||
)
|
)
|
||||||
},
|
|
||||||
})
|
})
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -1116,34 +1068,30 @@ test(
|
|||||||
'A mounting bracket for the Focusrite Scarlett Solo audio interface'
|
'A mounting bracket for the Focusrite Scarlett Solo audio interface'
|
||||||
)
|
)
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'Nested directories in project without main.kcl do not create main.kcl',
|
'Nested directories in project without main.kcl do not create main.kcl',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
let testDir: string | undefined
|
let testDir: string | undefined
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
await fsp.mkdir(path.join(dir, 'router-template-slate', 'nested'), {
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
await fsp.mkdir(join(dir, 'router-template-slate', 'nested'), {
|
|
||||||
recursive: true,
|
recursive: true,
|
||||||
})
|
})
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('router-template-slate.kcl'),
|
executorInputPath('router-template-slate.kcl'),
|
||||||
join(dir, 'router-template-slate', 'nested', 'slate.kcl')
|
path.join(dir, 'router-template-slate', 'nested', 'slate.kcl')
|
||||||
)
|
)
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
executorInputPath('focusrite_scarlett_mounting_braket.kcl'),
|
||||||
join(dir, 'router-template-slate', 'nested', 'bracket.kcl')
|
path.join(dir, 'router-template-slate', 'nested', 'bracket.kcl')
|
||||||
)
|
)
|
||||||
testDir = dir
|
testDir = dir
|
||||||
},
|
|
||||||
})
|
})
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -1171,44 +1119,40 @@ test(
|
|||||||
if (testDir !== undefined) {
|
if (testDir !== undefined) {
|
||||||
// eslint-disable-next-line jest/no-conditional-expect
|
// eslint-disable-next-line jest/no-conditional-expect
|
||||||
await expect(
|
await expect(
|
||||||
fsp.access(join(testDir, 'router-template-slate', 'main.kcl'))
|
fsp.access(path.join(testDir, 'router-template-slate', 'main.kcl'))
|
||||||
).rejects.toThrow()
|
).rejects.toThrow()
|
||||||
// eslint-disable-next-line jest/no-conditional-expect
|
// eslint-disable-next-line jest/no-conditional-expect
|
||||||
await expect(
|
await expect(
|
||||||
fsp.access(join(testDir, 'router-template-slate', 'nested', 'main.kcl'))
|
fsp.access(path.join(testDir, 'router-template-slate', 'nested', 'main.kcl'))
|
||||||
).rejects.toThrow()
|
).rejects.toThrow()
|
||||||
}
|
}
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test.fixme(
|
test.fixme(
|
||||||
'Deleting projects, can delete individual project, can still create projects after deleting all',
|
'Deleting projects, can delete individual project, can still create projects after deleting all',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const projectData = [
|
const projectData = [
|
||||||
['router-template-slate', 'cylinder.kcl'],
|
['router-template-slate', 'cylinder.kcl'],
|
||||||
['bracket', 'focusrite_scarlett_mounting_braket.kcl'],
|
['bracket', 'focusrite_scarlett_mounting_braket.kcl'],
|
||||||
['lego', 'lego.kcl'],
|
['lego', 'lego.kcl'],
|
||||||
]
|
]
|
||||||
|
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
// Do these serially to ensure the order is correct
|
// Do these serially to ensure the order is correct
|
||||||
for (const [name, file] of projectData) {
|
for (const [name, file] of projectData) {
|
||||||
await fsp.mkdir(join(dir, name), { recursive: true })
|
await fsp.mkdir(path.join(dir, name), { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath(file),
|
executorInputPath(file),
|
||||||
join(dir, name, `main.kcl`)
|
path.join(dir, name, `main.kcl`)
|
||||||
)
|
)
|
||||||
// Wait 1s between each project to ensure the order is correct
|
// Wait 1s between each project to ensure the order is correct
|
||||||
await new Promise((r) => setTimeout(r, 1_000))
|
await new Promise((r) => setTimeout(r, 1_000))
|
||||||
}
|
}
|
||||||
},
|
|
||||||
})
|
})
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
await test.step('delete the middle project, i.e. the bracket project', async () => {
|
await test.step('delete the middle project, i.e. the bracket project', async () => {
|
||||||
@ -1262,18 +1206,15 @@ test.fixme(
|
|||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'Can load a file with CRLF line endings',
|
'Can load a file with CRLF line endings',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
const routerTemplateDir = path.join(dir, 'router-template-slate')
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
const routerTemplateDir = join(dir, 'router-template-slate')
|
|
||||||
await fsp.mkdir(routerTemplateDir, { recursive: true })
|
await fsp.mkdir(routerTemplateDir, { recursive: true })
|
||||||
|
|
||||||
const file = await fsp.readFile(
|
const file = await fsp.readFile(
|
||||||
@ -1283,14 +1224,13 @@ test(
|
|||||||
// Replace both \r optionally so we don't end up with \r\r\n
|
// Replace both \r optionally so we don't end up with \r\r\n
|
||||||
const fileWithCRLF = file.replace(/\r?\n/g, '\r\n')
|
const fileWithCRLF = file.replace(/\r?\n/g, '\r\n')
|
||||||
await fsp.writeFile(
|
await fsp.writeFile(
|
||||||
join(routerTemplateDir, 'main.kcl'),
|
path.join(routerTemplateDir, 'main.kcl'),
|
||||||
fileWithCRLF,
|
fileWithCRLF,
|
||||||
'utf-8'
|
'utf-8'
|
||||||
)
|
)
|
||||||
},
|
|
||||||
})
|
})
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -1304,36 +1244,32 @@ test(
|
|||||||
await expect(u.codeLocator).toContainText('templateGap')
|
await expect(u.codeLocator).toContainText('templateGap')
|
||||||
await expect(u.codeLocator).toContainText('minClampingDistance')
|
await expect(u.codeLocator).toContainText('minClampingDistance')
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'Can sort projects on home page',
|
'Can sort projects on home page',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const projectData = [
|
const projectData = [
|
||||||
['router-template-slate', 'cylinder.kcl'],
|
['router-template-slate', 'cylinder.kcl'],
|
||||||
['bracket', 'focusrite_scarlett_mounting_braket.kcl'],
|
['bracket', 'focusrite_scarlett_mounting_braket.kcl'],
|
||||||
['lego', 'lego.kcl'],
|
['lego', 'lego.kcl'],
|
||||||
]
|
]
|
||||||
|
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
// Do these serially to ensure the order is correct
|
// Do these serially to ensure the order is correct
|
||||||
for (const [name, file] of projectData) {
|
for (const [name, file] of projectData) {
|
||||||
await fsp.mkdir(join(dir, name), { recursive: true })
|
await fsp.mkdir(path.join(dir, name), { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath(file),
|
executorInputPath(file),
|
||||||
join(dir, name, `main.kcl`)
|
path.join(dir, name, `main.kcl`)
|
||||||
)
|
)
|
||||||
// Wait 1s between each project to ensure the order is correct
|
// Wait 1s between each project to ensure the order is correct
|
||||||
await new Promise((r) => setTimeout(r, 1_000))
|
await new Promise((r) => setTimeout(r, 1_000))
|
||||||
}
|
}
|
||||||
},
|
|
||||||
})
|
})
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
const getAllProjects = () => page.getByTestId('project-link').all()
|
const getAllProjects = () => page.getByTestId('project-link').all()
|
||||||
|
|
||||||
@ -1416,17 +1352,15 @@ test(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test.fixme(
|
test.fixme(
|
||||||
'When the project folder is empty, user can create new project and open it.',
|
'When the project folder is empty, user can create new project and open it.',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ page }, testInfo) => {
|
||||||
const { electronApp, page } = await setupElectron({ testInfo })
|
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -1509,24 +1443,21 @@ extrude001 = extrude(200, sketch001)`)
|
|||||||
await createProject({ name, page, returnHome: true })
|
await createProject({ name, page, returnHome: true })
|
||||||
await expect(projectLinks.getByText(name)).toBeVisible()
|
await expect(projectLinks.getByText(name)).toBeVisible()
|
||||||
}
|
}
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'Opening a project should successfully load the stream, (regression test that this also works when switching between projects)',
|
'Opening a project should successfully load the stream, (regression test that this also works when switching between projects)',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
fsp.mkdir(join(dir, 'router-template-slate'), { recursive: true }),
|
fsp.mkdir(path.join(dir, 'router-template-slate'), { recursive: true }),
|
||||||
fsp.mkdir(join(dir, 'bracket'), { recursive: true }),
|
fsp.mkdir(path.join(dir, 'bracket'), { recursive: true }),
|
||||||
])
|
])
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
fsp.copyFile(
|
fsp.copyFile(
|
||||||
join(
|
path.join(
|
||||||
'src',
|
'src',
|
||||||
'wasm-lib',
|
'wasm-lib',
|
||||||
'tests',
|
'tests',
|
||||||
@ -1534,10 +1465,10 @@ test(
|
|||||||
'inputs',
|
'inputs',
|
||||||
'router-template-slate.kcl'
|
'router-template-slate.kcl'
|
||||||
),
|
),
|
||||||
join(dir, 'router-template-slate', 'main.kcl')
|
path.join(dir, 'router-template-slate', 'main.kcl')
|
||||||
),
|
),
|
||||||
fsp.copyFile(
|
fsp.copyFile(
|
||||||
join(
|
path.join(
|
||||||
'src',
|
'src',
|
||||||
'wasm-lib',
|
'wasm-lib',
|
||||||
'tests',
|
'tests',
|
||||||
@ -1545,13 +1476,12 @@ test(
|
|||||||
'inputs',
|
'inputs',
|
||||||
'focusrite_scarlett_mounting_braket.kcl'
|
'focusrite_scarlett_mounting_braket.kcl'
|
||||||
),
|
),
|
||||||
join(dir, 'bracket', 'main.kcl')
|
path.join(dir, 'bracket', 'main.kcl')
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
},
|
|
||||||
})
|
})
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -1611,17 +1541,14 @@ test(
|
|||||||
await expect(page.getByText('New Project')).toBeVisible()
|
await expect(page.getByText('New Project')).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'You can change the root projects directory and nothing is lost',
|
'You can change the root projects directory and nothing is lost',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page, electronApp }, testInfo) => {
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
fsp.mkdir(`${dir}/router-template-slate`, { recursive: true }),
|
fsp.mkdir(`${dir}/router-template-slate`, { recursive: true }),
|
||||||
fsp.mkdir(`${dir}/bracket`, { recursive: true }),
|
fsp.mkdir(`${dir}/bracket`, { recursive: true }),
|
||||||
@ -1636,9 +1563,8 @@ test(
|
|||||||
`${dir}/bracket/main.kcl`
|
`${dir}/bracket/main.kcl`
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
},
|
|
||||||
})
|
})
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -1664,7 +1590,6 @@ test(
|
|||||||
.locator('section#projectDirectory input')
|
.locator('section#projectDirectory input')
|
||||||
.inputValue()
|
.inputValue()
|
||||||
|
|
||||||
// Can't use Playwright filechooser since this is happening in electron.
|
|
||||||
const handleFile = electronApp.evaluate(
|
const handleFile = electronApp.evaluate(
|
||||||
async ({ dialog }, filePaths) => {
|
async ({ dialog }, filePaths) => {
|
||||||
dialog.showOpenDialog = () =>
|
dialog.showOpenDialog = () =>
|
||||||
@ -1675,7 +1600,7 @@ test(
|
|||||||
await page.getByTestId('project-directory-button').click()
|
await page.getByTestId('project-directory-button').click()
|
||||||
await handleFile
|
await handleFile
|
||||||
|
|
||||||
await expect(page.locator('section#projectDirectory input')).toHaveValue(
|
await expect.poll(() => page.locator('section#projectDirectory input').inputValue()).toContain(
|
||||||
newProjectDirName
|
newProjectDirName
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1695,6 +1620,7 @@ test(
|
|||||||
|
|
||||||
await page.getByTestId('project-directory-settings-link').click()
|
await page.getByTestId('project-directory-settings-link').click()
|
||||||
|
|
||||||
|
|
||||||
const handleFile = electronApp.evaluate(
|
const handleFile = electronApp.evaluate(
|
||||||
async ({ dialog }, filePaths) => {
|
async ({ dialog }, filePaths) => {
|
||||||
dialog.showOpenDialog = () =>
|
dialog.showOpenDialog = () =>
|
||||||
@ -1716,15 +1642,13 @@ test(
|
|||||||
await expect(page.getByText('bracket')).toBeVisible()
|
await expect(page.getByText('bracket')).toBeVisible()
|
||||||
await expect(page.getByText('router-template-slate')).toBeVisible()
|
await expect(page.getByText('router-template-slate')).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'Search projects on desktop home',
|
'Search projects on desktop home',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName: _ }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const projectData = [
|
const projectData = [
|
||||||
['basic bracket', 'focusrite_scarlett_mounting_braket.kcl'],
|
['basic bracket', 'focusrite_scarlett_mounting_braket.kcl'],
|
||||||
['basic-cube', 'basic_fillet_cube_end.kcl'],
|
['basic-cube', 'basic_fillet_cube_end.kcl'],
|
||||||
@ -1732,20 +1656,17 @@ test(
|
|||||||
['router-template-slate', 'router-template-slate.kcl'],
|
['router-template-slate', 'router-template-slate.kcl'],
|
||||||
['Ancient Temple Block', 'lego.kcl'],
|
['Ancient Temple Block', 'lego.kcl'],
|
||||||
]
|
]
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
// Do these serially to ensure the order is correct
|
// Do these serially to ensure the order is correct
|
||||||
for (const [name, file] of projectData) {
|
for (const [name, file] of projectData) {
|
||||||
await fsp.mkdir(join(dir, name), { recursive: true })
|
await fsp.mkdir(path.join(dir, name), { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath(file),
|
executorInputPath(file),
|
||||||
join(dir, name, `main.kcl`)
|
path.join(dir, name, `main.kcl`)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
|
||||||
})
|
})
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -1778,18 +1699,15 @@ test(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'file pane is scrollable when there are many files',
|
'file pane is scrollable when there are many files',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
const testDir = path.join(dir, 'testProject')
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
const testDir = join(dir, 'testProject')
|
|
||||||
await fsp.mkdir(testDir, { recursive: true })
|
await fsp.mkdir(testDir, { recursive: true })
|
||||||
const fileNames = [
|
const fileNames = [
|
||||||
'angled_line.kcl',
|
'angled_line.kcl',
|
||||||
@ -1855,13 +1773,12 @@ test(
|
|||||||
for (const fileName of fileNames) {
|
for (const fileName of fileNames) {
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath(fileName),
|
executorInputPath(fileName),
|
||||||
join(testDir, fileName)
|
path.join(testDir, fileName)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -1888,29 +1805,25 @@ test(
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'select all in code editor does not actually select all, just what is visible (regression)',
|
'select all in code editor does not actually select all, just what is visible (regression)',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ context, page }, testInfo) => {
|
||||||
const { electronApp, page } = await setupElectron({
|
await context.folderSetupFn(async (dir) => {
|
||||||
testInfo,
|
|
||||||
folderSetupFn: async (dir) => {
|
|
||||||
// src/wasm-lib/tests/executor/inputs/mike_stress_test.kcl
|
// src/wasm-lib/tests/executor/inputs/mike_stress_test.kcl
|
||||||
const name = 'mike_stress_test'
|
const name = 'mike_stress_test'
|
||||||
const testDir = join(dir, name)
|
const testDir = path.join(dir, name)
|
||||||
await fsp.mkdir(testDir, { recursive: true })
|
await fsp.mkdir(testDir, { recursive: true })
|
||||||
await fsp.copyFile(
|
await fsp.copyFile(
|
||||||
executorInputPath(`${name}.kcl`),
|
executorInputPath(`${name}.kcl`),
|
||||||
join(testDir, 'main.kcl')
|
path.join(testDir, 'main.kcl')
|
||||||
)
|
)
|
||||||
},
|
|
||||||
})
|
})
|
||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -1951,19 +1864,15 @@ test(
|
|||||||
await expect(u.codeLocator).toHaveText('')
|
await expect(u.codeLocator).toHaveText('')
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'Settings persist across restarts',
|
'Settings persist across restarts',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron', cleanProjectDir: true },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ page }, testInfo) => {
|
||||||
await test.step('We can change a user setting like theme', async () => {
|
await test.step('We can change a user setting like theme', async () => {
|
||||||
const { electronApp, page } = await setupElectron({
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
testInfo,
|
|
||||||
})
|
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
@ -1975,25 +1884,15 @@ test(
|
|||||||
|
|
||||||
await page.getByTestId('app-theme').selectOption('light')
|
await page.getByTestId('app-theme').selectOption('light')
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step('Starting the app again and we can see the same theme', async () => {
|
await test.step('Starting the app again and we can see the same theme', async () => {
|
||||||
let { electronApp, page } = await setupElectron({
|
await page.reload()
|
||||||
testInfo,
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
cleanProjectDir: false,
|
|
||||||
})
|
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
|
||||||
|
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
|
|
||||||
await page.getByTestId('user-sidebar-toggle').click()
|
|
||||||
|
|
||||||
await page.getByTestId('user-settings').click()
|
|
||||||
|
|
||||||
await expect(page.getByTestId('app-theme')).toHaveValue('light')
|
await expect(page.getByTestId('app-theme')).toHaveValue('light')
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -2002,11 +1901,8 @@ test(
|
|||||||
test.fixme(
|
test.fixme(
|
||||||
'Original project name persist after onboarding',
|
'Original project name persist after onboarding',
|
||||||
{ tag: '@electron' },
|
{ tag: '@electron' },
|
||||||
async ({ browserName }, testInfo) => {
|
async ({ page }, testInfo) => {
|
||||||
const { electronApp, page } = await setupElectron({
|
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||||
testInfo,
|
|
||||||
})
|
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
|
||||||
|
|
||||||
const getAllProjects = () => page.getByTestId('project-link').all()
|
const getAllProjects = () => page.getByTestId('project-link').all()
|
||||||
page.on('console', console.log)
|
page.on('console', console.log)
|
||||||
@ -2039,6 +1935,5 @@ test.fixme(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await electronApp.close()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -73,6 +73,7 @@ export function test(desc, objOrFn, fnMaybe) {
|
|||||||
{
|
{
|
||||||
context: tronApp.context,
|
context: tronApp.context,
|
||||||
page: tronApp.page,
|
page: tronApp.page,
|
||||||
|
electronApp: tronApp.electronApp,
|
||||||
...fixtures,
|
...fixtures,
|
||||||
},
|
},
|
||||||
testInfo
|
testInfo
|
||||||
|
Reference in New Issue
Block a user