Fix: stable E2E tests on ubuntu localhost (#5269)
* fix: Needed to increase timeout for this test. waitForExecutionDone does not work since there are errors in the KCL code * fix: again another wait for execution does not work * fix: bug that desyncs codeManager, executeCode, lspPlugin * fix: fixing react race condition on parsing numeric literals in command bar on open * fix: adding comment to clarify the gotcha * fix: saving off debugging... * fix: added wait for execution done * fix: removing testing code * fix: adding wait for execution done * fix: adding execution done wait * fix: only fixes the chamfer point and click delete * fix: add 1250ms before every progresscmdbar, removed model loaded scene state that is flaky, added toast if someone presses the command bar too quickly * fix: adding a wait for execution * fix: updating wait for execution * fix: wait for execution done * fix: wait for execution done * fix: not waiting for scene, not waiting for command bar * fix: restoring name * fix: auto fixes * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * fix: bad prompt fix * fix: Fixed testing selections with wait * fix: last wait fix * fix: trying to resolve more flakes when running with more workers * chore: adding a skipLocalEngine tag * fix: fixing test when using local engine * fix: codespell * fix: big if true * chore: skipping one more local engine tests that fails * fix: auto fix: * fix: restoring this testing code --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -9,6 +9,8 @@ import {
|
||||
getCalculatedKclExpressionValue,
|
||||
programMemoryFromVariables,
|
||||
} from './kclHelpers'
|
||||
import { parse, resultIsOk } from 'lang/wasm'
|
||||
import { err } from 'lib/trap'
|
||||
|
||||
const isValidVariableName = (name: string) =>
|
||||
/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name)
|
||||
@ -50,7 +52,20 @@ export function useCalculateKclExpression({
|
||||
bodyPath: [],
|
||||
})
|
||||
const [valueNode, setValueNode] = useState<Expr | null>(null)
|
||||
const [calcResult, setCalcResult] = useState('NAN')
|
||||
// Gotcha: If we do not attempt to parse numeric literals instantly it means that there is an async action to verify
|
||||
// the value is good. This means all E2E tests have a race condition on when they can hit "next" in the command bar.
|
||||
// Most scenarios automatically pass a numeric literal. We can try to parse that first, otherwise make it go through the slow
|
||||
// async method.
|
||||
// If we pass in numeric literals, we should instantly parse them, they have nothing to do with application memory
|
||||
const _code_value = `const __result__ = ${value}`
|
||||
const codeValueParseResult = parse(_code_value)
|
||||
let isValueParsable = true
|
||||
if (err(codeValueParseResult) || !resultIsOk(codeValueParseResult)) {
|
||||
isValueParsable = false
|
||||
}
|
||||
const initialCalcResult: number | string =
|
||||
Number.isNaN(Number(value)) || !isValueParsable ? 'NAN' : value
|
||||
const [calcResult, setCalcResult] = useState(initialCalcResult)
|
||||
const [newVariableName, setNewVariableName] = useState('')
|
||||
const [isNewVariableNameUnique, setIsNewVariableNameUnique] = useState(true)
|
||||
|
||||
|
Reference in New Issue
Block a user