yarn tsc
This commit is contained in:
@ -72,7 +72,6 @@ test.describe('integrations tests', () => {
|
||||
})
|
||||
await test.step('setup for next assertion', async () => {
|
||||
await toolbar.openFile('main.kcl')
|
||||
|
||||
await scene.settled(cmdBar)
|
||||
|
||||
await clickObj()
|
||||
@ -89,7 +88,7 @@ test.describe('integrations tests', () => {
|
||||
await toolbar.expectFileTreeState(['main.kcl', fileName])
|
||||
})
|
||||
await test.step('check sketch mode is exited when opening a different file', async () => {
|
||||
await toolbar.openFile(fileName, { wait: false })
|
||||
await toolbar.openFile(fileName)
|
||||
|
||||
// check we're out of sketch mode
|
||||
await expect(toolbar.exitSketchBtn).not.toBeVisible()
|
||||
|
@ -39,7 +39,8 @@ export class AuthenticatedApp {
|
||||
}
|
||||
|
||||
async initialise(code = '') {
|
||||
await setup(this.context, this.page, this.testInfo)
|
||||
const testDir = this.testInfo.outputPath('electron-test-projects-dir')
|
||||
await setup(this.context, this.page, testDir, this.testInfo)
|
||||
const u = await getUtils(this.page)
|
||||
|
||||
await this.page.addInitScript(async (code) => {
|
||||
|
@ -159,16 +159,10 @@ export class ToolbarFixture {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Opens file by it's name and waits for execution to finish
|
||||
* Opens file by it's name
|
||||
*/
|
||||
openFile = async (
|
||||
fileName: string,
|
||||
{ wait }: { wait?: boolean } = { wait: true }
|
||||
) => {
|
||||
openFile = async (fileName: string) => {
|
||||
await this.filePane.getByText(fileName).click()
|
||||
if (wait) {
|
||||
await scene.settled(cmdBar)
|
||||
}
|
||||
}
|
||||
selectCenterRectangle = async () => {
|
||||
await this.page
|
||||
|
@ -1029,7 +1029,7 @@ part002 = startSketchOn(XZ)
|
||||
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||
|
||||
await homePage.goToModelingScene()
|
||||
await scene.settled()
|
||||
await scene.settled(cmdBar)
|
||||
|
||||
await page.getByText('line(end = [3.79, 2.68], tag = $seg01)').click()
|
||||
await expect(page.getByRole('button', { name: 'Edit Sketch' })).toBeEnabled(
|
||||
|
@ -71,7 +71,7 @@ export function useNetworkStatus() {
|
||||
? NetworkHealthState.Disconnected
|
||||
: hasIssues || hasIssues === undefined
|
||||
? NetworkHealthState.Issue
|
||||
: ping > 16.6 * 3 // we consider ping longer than 3 frames as weak
|
||||
: (ping ?? 0) > 16.6 * 3 // we consider ping longer than 3 frames as weak
|
||||
? NetworkHealthState.Weak
|
||||
: NetworkHealthState.Ok
|
||||
)
|
||||
|
@ -298,11 +298,9 @@ class EngineConnection extends EventTarget {
|
||||
public webrtcStatsCollector?: () => Promise<ClientMetrics>
|
||||
private engineCommandManager: EngineCommandManager
|
||||
|
||||
private pingPongSpan: { ping?: Date; pong?: Date }
|
||||
private pingIntervalId: ReturnType<typeof setInterval> = setInterval(
|
||||
() => {},
|
||||
60_000
|
||||
)
|
||||
private pingPongSpan: { ping?: number; pong?: number }
|
||||
private pingIntervalId: ReturnType<typeof setInterval> = setInterval(() => {},
|
||||
60_000)
|
||||
isUsingConnectionLite: boolean = false
|
||||
|
||||
timeoutToForceConnectId: ReturnType<typeof setTimeout> = setTimeout(() => {},
|
||||
@ -346,7 +344,7 @@ class EngineConnection extends EventTarget {
|
||||
|
||||
this.send({ type: 'ping' })
|
||||
this.pingPongSpan = {
|
||||
ping: new Date(),
|
||||
ping: Date.now(),
|
||||
pong: undefined,
|
||||
}
|
||||
}, pingIntervalMs)
|
||||
@ -909,7 +907,7 @@ class EngineConnection extends EventTarget {
|
||||
|
||||
// Send an initial ping
|
||||
this.send({ type: 'ping' })
|
||||
this.pingPongSpan.ping = new Date()
|
||||
this.pingPongSpan.ping = Date.now()
|
||||
}
|
||||
this.websocket.addEventListener('open', this.onWebSocketOpen)
|
||||
|
||||
@ -1004,12 +1002,14 @@ class EngineConnection extends EventTarget {
|
||||
|
||||
switch (resp.type) {
|
||||
case 'pong':
|
||||
this.pingPongSpan.pong = new Date()
|
||||
this.pingPongSpan.pong = Date.now()
|
||||
this.dispatchEvent(
|
||||
new CustomEvent(EngineConnectionEvents.PingPongChanged, {
|
||||
detail: Math.min(
|
||||
999,
|
||||
Math.floor(this.pingPongSpan.pong - this.pingPongSpan.ping)
|
||||
Math.floor(
|
||||
this.pingPongSpan.pong - (this.pingPongSpan.ping ?? 0)
|
||||
)
|
||||
),
|
||||
})
|
||||
)
|
||||
@ -1176,7 +1176,7 @@ class EngineConnection extends EventTarget {
|
||||
// Do not change this back to an object or any, we should only be sending the
|
||||
// WebSocketRequest type!
|
||||
unreliableSend(message: Models['WebSocketRequest_type']) {
|
||||
if (this.unreliableDataChannel.readyState !== 'open') return
|
||||
if (this.unreliableDataChannel?.readyState !== 'open') return
|
||||
|
||||
// TODO(paultag): Add in logic to determine the connection state and
|
||||
// take actions if needed?
|
||||
|
@ -223,16 +223,35 @@ export function createSettings() {
|
||||
value: settingValueInStorage,
|
||||
updateValue: writeSettingValueToStorage,
|
||||
}) => {
|
||||
const [timeoutId, setTimeoutId] = useState(undefined)
|
||||
const [timeoutId, setTimeoutId] = useState<
|
||||
ReturnType<typeof setTimeout> | undefined
|
||||
>(undefined)
|
||||
const [preview, setPreview] = useState(
|
||||
settingValueInStorage === undefined
|
||||
? settingValueInStorage
|
||||
: settingValueInStorage / MS_IN_MINUTE
|
||||
)
|
||||
const onChangeRange = (e: React.SyntheticEvent) =>
|
||||
setPreview(e.currentTarget.value)
|
||||
const onChangeRange = (e: React.SyntheticEvent) => {
|
||||
if (
|
||||
!(
|
||||
e.isTrusted &&
|
||||
'value' in e.currentTarget &&
|
||||
e.currentTarget.value
|
||||
)
|
||||
)
|
||||
return
|
||||
setPreview(Number(e.currentTarget.value))
|
||||
}
|
||||
const onSaveRange = (e: React.SyntheticEvent) => {
|
||||
if (preview === undefined) return
|
||||
if (
|
||||
!(
|
||||
e.isTrusted &&
|
||||
'value' in e.currentTarget &&
|
||||
e.currentTarget.value
|
||||
)
|
||||
)
|
||||
return
|
||||
writeSettingValueToStorage(
|
||||
Number(e.currentTarget.value) * MS_IN_MINUTE
|
||||
)
|
||||
@ -241,6 +260,7 @@ export function createSettings() {
|
||||
return (
|
||||
<div className="flex item-center gap-4 m-0 py-0">
|
||||
<Toggle
|
||||
name="streamIdleModeToggle"
|
||||
offLabel="Off"
|
||||
onLabel="On"
|
||||
checked={settingValueInStorage !== undefined}
|
||||
|
Reference in New Issue
Block a user