Skip to content

Commit 3381d4a

Browse files
committed
fix: load user config even for inTest, pass CODETRACER_TEST=1 for ui tests
this way the stepping tests by Nedy now work just with `just test-e2e
1 parent 71507a1 commit 3381d4a

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

src/common/config.nim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,14 @@ proc findConfig*(folder: string, configPath: string): string =
102102
config = true
103103

104104
proc loadConfig*(folder: string, inTest: bool): Config =
105+
# ignore inTest from now: TODO eventually remove?
105106
var file = findConfig(folder, configPath)
106107
if file.len == 0:
107108
file = userConfigDir / configPath
108109
createDir(userConfigDir)
109110
copyFile(configDir / defaultConfigPath, userConfigDir / configPath)
110-
if inTest:
111-
file = codetracerTestDir / testConfigPath
111+
# if inTest:
112+
# file = codetracerTestDir / testConfigPath
112113
var raw = ""
113114
try:
114115
raw = readFile(file)

src/frontend/index.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,7 @@ proc init(data: var ServerData, config: Config, layout: js, helpers: Helpers) {.
14021402
# config <- file config combined with cli args and other setup
14031403
# improve this code
14041404

1405-
data.config.test = data.config.test or data.startOptions.inTest
1405+
data.config.test = data.config.test # or data.startOptions.inTest
14061406
# TELEMETRY_ENABLED = false
14071407
# data.layout = layout
14081408
# data.helpers = helpers

src/frontend/index_config.nim

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,8 +1253,9 @@ proc loadConfig*(main: js, startOptions: StartOptions, home: cstring = j"", send
12531253
errorPrint " to: ", fmt"{userConfigDir / configPath}"
12541254
quit(1)
12551255

1256-
if startOptions.inTest:
1257-
file = nodePath.join(j(codetracerTestDir), j(testConfigPath))
1256+
# TODO: maybe remove config test logic?
1257+
# if startOptions.inTest:
1258+
# file = nodePath.join(j(codetracerTestDir), j(testConfigPath))
12581259
infoPrint "index: load config ", file
12591260
let (s, err) = await fsreadFileWithErr(file)
12601261
if not err.isNil:
@@ -1310,8 +1311,9 @@ proc loadHelpers*(main: js, filename: string): Future[Helpers] {.async.} =
13101311

13111312
proc saveConfigTheme*(main: js, theme: cstring): Future[void] {.async.} =
13121313
var file = j(userConfigDir)
1313-
if data.startOptions.inTest:
1314-
file = j(configDir & testConfigPath)
1314+
# TODO: maybe remove inTest config logic?
1315+
# if data.startOptions.inTest:
1316+
# file = j(configDir & testConfigPath)
13151317
let (s, err) = await fsReadFileWithErr(file)
13161318
if not err.isNil:
13171319
errorPrint "read config file for theme error: ", err

ui-tests/tests/lib/ct_helpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ async function replayCodetracerInElectron(
159159
process.env.CODETRACER_CALLER_PID = runPid.toString();
160160
process.env.CODETRACER_TRACE_ID = traceId.toString();
161161
process.env.CODETRACER_IN_UI_TEST = "1";
162+
process.env.CODETRACER_TEST = "1";
162163
process.env.CODETRACER_WRAP_ELECTRON = "1";
163164
process.env.CODETRACER_START_INDEX = "1";
164165

ui-tests/tests/noir/stepping.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { test, expect } from "@playwright/test";
44
import {
55
// window,
66
// page,
7-
wait,
7+
// wait,
88
// debugCodetracer,
99
readyOnEntryTest as readyOnEntry,
1010
clickNext,
@@ -17,7 +17,7 @@ ctRun("noir_example/");
1717

1818
test("continue", async () => {
1919
await readyOnEntry();
20-
await wait(5_000);
20+
// await wait(5_000);
2121
await clickContinue();
2222
expect(true);
2323
});

0 commit comments

Comments
 (0)