2024-08-14 01:18:59 +02:00
|
|
|
import { test, expect } from '@playwright/test'
|
|
|
|
import { getUtils, setupElectron, tearDown } from './test-utils'
|
2024-08-12 18:06:08 -04:00
|
|
|
|
2024-08-13 17:00:56 +10:00
|
|
|
test.afterEach(async ({ page }, testInfo) => {
|
|
|
|
await tearDown(page, testInfo)
|
|
|
|
})
|
|
|
|
|
2024-08-13 17:02:24 +10:00
|
|
|
test(
|
|
|
|
'When the project folder is empty, user can create new project and open it.',
|
|
|
|
{ tag: '@electron' },
|
2024-08-14 02:24:17 +02:00
|
|
|
async ({ browserName }, testInfo) => {
|
|
|
|
test.skip(
|
|
|
|
browserName === 'webkit',
|
|
|
|
'Skip on Safari because `window.tearDown` does not work'
|
|
|
|
)
|
2024-08-14 01:18:59 +02:00
|
|
|
const { electronApp, page } = await setupElectron({ testInfo })
|
2024-08-13 17:02:24 +10:00
|
|
|
const u = await getUtils(page)
|
2024-08-13 19:36:39 +02:00
|
|
|
await page.goto('http://localhost:3000/')
|
2024-08-13 17:00:56 +10:00
|
|
|
|
2024-08-13 17:02:24 +10:00
|
|
|
page.on('console', console.log)
|
2024-08-13 17:00:56 +10:00
|
|
|
|
2024-08-13 17:02:24 +10:00
|
|
|
// expect to see text "No Projects found"
|
|
|
|
await expect(page.getByText('No Projects found')).toBeVisible()
|
2024-08-13 17:00:56 +10:00
|
|
|
|
2024-08-13 17:02:24 +10:00
|
|
|
await page.getByRole('button', { name: 'New project' }).click()
|
2024-08-13 17:00:56 +10:00
|
|
|
|
2024-08-13 17:02:24 +10:00
|
|
|
await expect(page.getByText('Successfully created')).toBeVisible()
|
|
|
|
await expect(page.getByText('Successfully created')).not.toBeVisible()
|
2024-08-13 17:00:56 +10:00
|
|
|
|
2024-08-13 17:02:24 +10:00
|
|
|
await expect(page.getByText('project-000')).toBeVisible()
|
2024-08-13 17:00:56 +10:00
|
|
|
|
2024-08-13 17:02:24 +10:00
|
|
|
await page.getByText('project-000').click()
|
2024-08-13 17:00:56 +10:00
|
|
|
|
2024-08-13 17:02:24 +10:00
|
|
|
await expect(page.getByTestId('loading')).toBeAttached()
|
|
|
|
await expect(page.getByTestId('loading')).not.toBeAttached({
|
|
|
|
timeout: 20_000,
|
|
|
|
})
|
2024-08-13 17:00:56 +10:00
|
|
|
|
2024-08-13 17:02:24 +10:00
|
|
|
await expect(
|
|
|
|
page.getByRole('button', { name: 'Start Sketch' })
|
|
|
|
).toBeEnabled({
|
|
|
|
timeout: 20_000,
|
|
|
|
})
|
2024-08-13 17:00:56 +10:00
|
|
|
|
2024-08-13 17:02:24 +10:00
|
|
|
await electronApp.close()
|
|
|
|
}
|
|
|
|
)
|