aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/e2e
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-09-20 15:38:20 +0200
committerGitHub <noreply@github.com>2024-09-20 15:38:20 +0200
commitce8e3995df9e554250543e1a8d90e2e053e3dbec (patch)
tree5c2be78e50d0fac36f118931c5112dee5ef6fe16 /src/tests/e2e
parentdocs(changelog): break multiple panes APIs (diff)
downloadsl0ppij-ce8e3995df9e554250543e1a8d90e2e053e3dbec.tar.gz
sl0ppij-ce8e3995df9e554250543e1a8d90e2e053e3dbec.tar.xz
sl0ppij-ce8e3995df9e554250543e1a8d90e2e053e3dbec.zip
feat(config): allow loading background plugins on startup (#3616)
* remove old partial implementation * feat(plugins): allow loading background plugins on startup * add e2e test * update config * udpate config merging * style(fmt): rustfmt
Diffstat (limited to 'src/tests/e2e')
-rw-r--r--src/tests/e2e/cases.rs52
-rw-r--r--src/tests/e2e/remote_runner.rs4
-rw-r--r--src/tests/e2e/snapshots/zellij__tests__e2e__cases__load_plugins_in_background_on_startup.snap29
3 files changed, 85 insertions, 0 deletions
diff --git a/src/tests/e2e/cases.rs b/src/tests/e2e/cases.rs
index eec66096..5103d656 100644
--- a/src/tests/e2e/cases.rs
+++ b/src/tests/e2e/cases.rs
@@ -2371,3 +2371,55 @@ pub fn send_command_through_the_cli() {
let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
+
+#[test]
+#[ignore]
+pub fn load_plugins_in_background_on_startup() {
+ let fake_win_size = Size {
+ cols: 120,
+ rows: 24,
+ };
+ let config_file_name = "load_background_plugins.kdl";
+ let mut test_attempts = 10;
+ let mut test_timed_out = false;
+ let last_snapshot = loop {
+ RemoteRunner::kill_running_sessions(fake_win_size);
+ let mut runner =
+ RemoteRunner::new_with_config(fake_win_size, config_file_name).add_step(Step {
+ name: "Wait for plugin to load and request permissions",
+ instruction: |mut remote_terminal: RemoteTerminal| -> bool {
+ let mut step_is_complete = false;
+ if remote_terminal.snapshot_contains("Allow? (y/n)") {
+ std::thread::sleep(std::time::Duration::from_millis(100));
+ remote_terminal.send_key("y".as_bytes());
+ step_is_complete = true;
+ }
+ step_is_complete
+ },
+ });
+ runner.run_all_steps();
+ let last_snapshot = runner.take_snapshot_after(Step {
+ name: "Wait for plugin to disappear after permissions were granted",
+ instruction: |mut remote_terminal: RemoteTerminal| -> bool {
+ let mut step_is_complete = false;
+ if !remote_terminal.snapshot_contains("Allow? (y/n)") {
+ step_is_complete = true;
+ }
+ step_is_complete
+ },
+ });
+ if runner.test_timed_out && test_attempts > 0 {
+ test_attempts -= 1;
+ continue;
+ } else {
+ test_timed_out = runner.test_timed_out;
+ break last_snapshot;
+ }
+ };
+ let last_snapshot = account_for_races_in_snapshot(last_snapshot);
+ assert!(
+ !test_timed_out,
+ "Test timed out, possibly waiting for permission request"
+ );
+ assert_snapshot!(last_snapshot);
+}
diff --git a/src/tests/e2e/remote_runner.rs b/src/tests/e2e/remote_runner.rs
index 49cdf64e..40feeb21 100644
--- a/src/tests/e2e/remote_runner.rs
+++ b/src/tests/e2e/remote_runner.rs
@@ -67,9 +67,13 @@ fn stop_zellij(channel: &mut ssh2::Channel) {
channel.write_all(b"rm -rf /tmp/*\n").unwrap(); // remove temporary artifacts from previous
// tests
channel.write_all(b"rm -rf /tmp/*\n").unwrap(); // remove temporary artifacts from previous
+ channel.write_all(b"rm -rf /tmp/*\n").unwrap(); // remove temporary artifacts from previous
channel
.write_all(b"rm -rf ~/.cache/zellij/*/session_info\n")
.unwrap();
+ channel
+ .write_all(b"rm -rf ~/.cache/zellij/permissions.kdl\n")
+ .unwrap();
}
fn start_zellij(channel: &mut ssh2::Channel) {
diff --git a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__load_plugins_in_background_on_startup.snap b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__load_plugins_in_background_on_startup.snap
new file mode 100644
index 00000000..cabf017a
--- /dev/null
+++ b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__load_plugins_in_background_on_startup.snap
@@ -0,0 +1,29 @@
+---
+source: src/tests/e2e/cases.rs
+assertion_line: 2426
+expression: last_snapshot
+---
+ Zellij (e2e-test)  Tab #1 
+┌ Pane #1 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
+│$ █ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+│ │
+└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
+ Ctrl g  UNLOCK  Alt +  <n> New Pane  <←↓↑→> Change Focus  <f> Floating 