Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ else
npm run test:snapshots -- --headed --update-snapshots=$(E2E_MODE)
endif

.PHONY: glass-skeleton
glass-skeleton:
$(MAKE) test-e2e-desktop MAKE_GLASS_SKELETON=yes


###############################################################################
# CLEAN

Expand Down
67 changes: 63 additions & 4 deletions e2e/playwright/zoo-test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
/* eslint-disable react-hooks/rules-of-hooks */
import { test as playwrightTestFn } from '@playwright/test'
import {
test as playwrightTestFn,
beforeEach,

Check failure on line 4 in e2e/playwright/zoo-test.ts

View workflow job for this annotation

GitHub Actions / npm-tsc

Module '"@playwright/test"' has no exported member 'beforeEach'. Did you mean to use 'import beforeEach from "@playwright/test"' instead?
afterEach,

Check failure on line 5 in e2e/playwright/zoo-test.ts

View workflow job for this annotation

GitHub Actions / npm-tsc

Module '"@playwright/test"' has no exported member 'afterEach'. Did you mean to use 'import afterEach from "@playwright/test"' instead?
} from '@playwright/test'
import fs from 'node:fs/promises'
import path from 'node:path'

import { GlassSkeletonRecorder } from 'glass-skeleton-recorder'

Check failure on line 10 in e2e/playwright/zoo-test.ts

View workflow job for this annotation

GitHub Actions / npm-tsc

Cannot find module 'glass-skeleton-recorder' or its corresponding type declarations.
import type { Fixtures } from '@e2e/playwright/fixtures/fixtureSetup'
import {
ElectronZoo,
Expand Down Expand Up @@ -94,8 +101,60 @@
],
})

const test = playwrightTestFnWithFixtures_.extend<Fixtures>(
fixturesBasedOnProcessEnvPlatform
)
const playwrightTestFnWithFixtures__ =
playwrightTestFnWithFixtures_.extend<Fixtures>(
fixturesBasedOnProcessEnvPlatform
)

// Add the Glass Skeleton as a fixture to promise a fresh skeleton state
const test = playwrightTestFnWithFixtures__.extend<{
glassSkeleton?: GlassSkeletonRecorder
}>({
glassSkeleton: async ({ page }, use) => {

Check failure on line 113 in e2e/playwright/zoo-test.ts

View workflow job for this annotation

GitHub Actions / npm-tsc

Parameter 'use' implicitly has an 'any' type.

Check failure on line 113 in e2e/playwright/zoo-test.ts

View workflow job for this annotation

GitHub Actions / npm-tsc

Binding element 'page' implicitly has an 'any' type.
const glassSkeleton = process.env.MAKE_GLASS_SKELETON
? // These are functions because those properties are late-bound.
new GlassSkeletonRecorder({
type: 'playwright',
page,
fs: {
writeFile: fs.writeFile,
mkdir: fs.mkdir,
},
path: {
resolve: path.resolve,
},
resources: [
{
protocol: GlassSkeletonRecorder.SupportedProtocol.WebSocket,
urlRegExpStr: 'wss://api.dev.zoo.dev',
removeMatchingRegExpStrs: [
'api-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}',
],
},
],
})
: undefined
await use(glassSkeleton)
},
})
// These exist because otherwise the page is not navigated to yet.
beforeEach(async ({ glassSkeleton }) => {

Check failure on line 141 in e2e/playwright/zoo-test.ts

View workflow job for this annotation

GitHub Actions / npm-tsc

Binding element 'glassSkeleton' implicitly has an 'any' type.
if (glassSkeleton === undefined) return
await glassSkeleton.start()
})
afterEach(async ({ glassSkeleton }, testInfo) => {

Check failure on line 145 in e2e/playwright/zoo-test.ts

View workflow job for this annotation

GitHub Actions / npm-tsc

Parameter 'testInfo' implicitly has an 'any' type.

Check failure on line 145 in e2e/playwright/zoo-test.ts

View workflow job for this annotation

GitHub Actions / npm-tsc

Binding element 'glassSkeleton' implicitly has an 'any' type.
if (glassSkeleton === undefined) return
await glassSkeleton.stop()
void glassSkeleton.save({
outputDir: path.resolve(testInfo.outputPath(), '..'),
outputName:
testInfo.titlePath
.join('-')
.toLowerCase()
.trim()
.replace(/'"/g, '')
.replaceAll(' ', '-') + '.bson',

Check warning on line 156 in e2e/playwright/zoo-test.ts

View workflow job for this annotation

GitHub Actions / semgrep-oss/scan

no-replaceall

The string method replaceAll is not supported in all versions of javascript and is not supported by older browser versions. Consider using replace with a regex as the first argument instead like mystring.replacebadg good instead of mystring.replaceAllbad good httpsdiscourse.threejs.orgtreplaceallisnotafunction14585
})
})

export { test }
36 changes: 33 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"main": ".vite/build/main.js",
"license": "MIT",
"workspaces": [
"../glass-skeleton/recorder",
"packages/codemirror-lang-kcl",
"packages/codemirror-lsp-client",
"rust/kcl-language-server"
Expand Down
Loading