2024-08-16 07:15:42 -04:00
|
|
|
import { test, expect } from '@playwright/test'
|
2024-08-19 16:29:44 +10:00
|
|
|
import {
|
|
|
|
doExport,
|
|
|
|
getUtils,
|
2024-08-20 05:34:26 +10:00
|
|
|
isOutOfViewInScrollContainer,
|
2024-08-19 16:29:44 +10:00
|
|
|
Paths,
|
|
|
|
setupElectron,
|
|
|
|
tearDown,
|
|
|
|
} from './test-utils'
|
2024-08-16 07:15:42 -04:00
|
|
|
import fsp from 'fs/promises'
|
|
|
|
import fs from 'fs'
|
2024-08-16 14:53:03 -04:00
|
|
|
import { join } from 'path'
|
2024-08-16 07:15:42 -04:00
|
|
|
|
|
|
|
test.afterEach(async ({ page }, testInfo) => {
|
|
|
|
await tearDown(page, testInfo)
|
|
|
|
})
|
|
|
|
|
2024-08-19 16:29:44 +10:00
|
|
|
test(
|
2024-08-19 13:54:11 -07:00
|
|
|
'when code with error first loads you get errors in console',
|
2024-08-19 16:29:44 +10:00
|
|
|
{ tag: '@electron' },
|
|
|
|
async ({ browserName }, testInfo) => {
|
|
|
|
const { electronApp, page } = await setupElectron({
|
|
|
|
testInfo,
|
|
|
|
folderSetupFn: async (dir) => {
|
2024-08-19 13:54:11 -07:00
|
|
|
await fsp.mkdir(`${dir}/broken-code`, { recursive: true })
|
2024-08-19 16:29:44 +10:00
|
|
|
await fsp.copyFile(
|
2024-08-19 13:54:11 -07:00
|
|
|
'src/wasm-lib/tests/executor/inputs/broken-code-test.kcl',
|
|
|
|
`${dir}/broken-code/main.kcl`
|
2024-08-19 16:29:44 +10:00
|
|
|
)
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
await page.setViewportSize({ width: 1200, height: 500 })
|
|
|
|
const u = await getUtils(page)
|
|
|
|
|
2024-08-19 13:54:11 -07:00
|
|
|
await expect(page.getByText('broken-code')).toBeVisible()
|
2024-08-16 07:15:42 -04:00
|
|
|
|
2024-08-19 13:54:11 -07:00
|
|
|
await page.getByText('broken-code').click()
|
2024-08-16 07:15:42 -04:00
|
|
|
|
|
|
|
await expect(page.getByTestId('loading')).toBeAttached()
|
|
|
|
await expect(page.getByTestId('loading')).not.toBeAttached({
|
|
|
|
timeout: 20_000,
|
|
|
|
})
|
|
|
|
|
2024-08-19 13:54:11 -07:00
|
|
|
// error in guter
|
|
|
|
await expect(page.locator('.cm-lint-marker-error')).toBeVisible()
|
2024-08-16 07:15:42 -04:00
|
|
|
|
2024-08-19 13:54:11 -07:00
|
|
|
// error text on hover
|
|
|
|
await page.hover('.cm-lint-marker-error')
|
|
|
|
const crypticErrorText = `Expected a tag declarator`
|
|
|
|
await expect(page.getByText(crypticErrorText).first()).toBeVisible()
|
2024-08-16 07:15:42 -04:00
|
|
|
|
|
|
|
await electronApp.close()
|
|
|
|
}
|
|
|
|
)
|