aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/e2e/cases.rs
diff options
context:
space:
mode:
authorhar7an <99636919+har7an@users.noreply.github.com>2026-01-26 18:05:51 +0000
committerGitHub <noreply@github.com>2026-01-26 18:05:51 +0000
commitbdf20eef50f2d68501be708ec5ee38dbe9366a91 (patch)
treee97215a9464d322eb65e416b1662c530e44d57f1 /src/tests/e2e/cases.rs
parentfix: get "zellij run --session" to also work on sessions that have no attache... (diff)
downloadsl0ppij-bdf20eef50f2d68501be708ec5ee38dbe9366a91.tar.gz
sl0ppij-bdf20eef50f2d68501be708ec5ee38dbe9366a91.tar.xz
sl0ppij-bdf20eef50f2d68501be708ec5ee38dbe9366a91.zip
Fix loading short layouts and custom config dirs (#4640)
* test(e2e): Write a regression test to validate behavior w.r.t. loading and determining the session layout file. Compared to release v0.43.1, right now there is a problem where `zellij --layout NAME`, with `NAME` being the filename of a layout in the `$ZELLIJ_DATA_DIR/layouts/` subfolder, doesn't resolve to the correct layout file. Instead, zellij will silently fall back to its default config. It does, however, recognize nonexistent configuration files. * fix(utils): Treat bare layout names as file paths first before defaulting to builtin layout names. This restores the behavior shown by zellij up until 0.43.1, which was altered in a recent extension of the server-client API. * fix: Forward client layout information to startup code and ensure it isn't ignored along the way. Update a bunch of tests to react to the new function interface and write new tests to catch deviations in the future. * test: Fix misconfigured e2e test to ensure that a custom `--config-dir` is indeed respected during application startup. * test: Rewrite config dir test to not use variable metadata since the `LayoutInfo` object previously dumped into the snapshot contains information that isn't platform agnostic, including an absolute file path and a timestamp. * docs(CHANGELOG): Mention PR #4640 in the list of changes for the next release. * fix: Handle bare layouts with name "default" correctly and assume a "default" layout if no layout name is given during layout resolution. "default" may not always be the builtin default layout, since users can write their own "default.kdl" that takes effect when placed in the layout directory an no other layouts are explicitly specified.
Diffstat (limited to 'src/tests/e2e/cases.rs')
-rw-r--r--src/tests/e2e/cases.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/tests/e2e/cases.rs b/src/tests/e2e/cases.rs
index f7d9ea0d..96fb9c12 100644
--- a/src/tests/e2e/cases.rs
+++ b/src/tests/e2e/cases.rs
@@ -2898,3 +2898,37 @@ pub fn override_layout_from_default_to_compact() {
let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
+
+#[test]
+#[ignore]
+pub fn use_custom_layout_with_relative_path() {
+ let fake_win_size = Size {
+ cols: 120,
+ rows: 24,
+ };
+ // Should resolve to $fixtures/layouts/upside-down.kdl
+ let config_dir_name = "e2e-upside-down";
+ let mut test_attempts = 10;
+ let last_snapshot = loop {
+ RemoteRunner::kill_running_sessions(fake_win_size);
+ let mut runner = RemoteRunner::new_with_config_dir(fake_win_size, config_dir_name);
+ runner.run_all_steps();
+ let last_snapshot = runner.take_snapshot_after(Step {
+ name: "Wait for app to start",
+ instruction: |remote_terminal: RemoteTerminal| -> bool {
+ let lines = remote_terminal.lines();
+ lines.len() > 2
+ && lines[0].trim().starts_with("Ctrl +")
+ && lines[1].trim().starts_with("Tip:")
+ },
+ });
+ if runner.test_timed_out && test_attempts > 0 {
+ test_attempts -= 1;
+ continue;
+ } else {
+ break last_snapshot;
+ }
+ };
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
+ assert_snapshot!(last_snapshot);
+}