aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/integration/basic.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2021-06-30 11:27:35 +0200
committerGitHub <noreply@github.com>2021-06-30 11:27:35 +0200
commited4fd2a8e77df304539ca7f445a78039028eaa8a (patch)
treeae48b03370b11f3f0987676584724463ac83460d /src/tests/integration/basic.rs
parentMerge pull request #590 from a-kenji/clippy-fixes (diff)
downloadsl0ppij-ed4fd2a8e77df304539ca7f445a78039028eaa8a.tar.gz
sl0ppij-ed4fd2a8e77df304539ca7f445a78039028eaa8a.tar.xz
sl0ppij-ed4fd2a8e77df304539ca7f445a78039028eaa8a.zip
chore(tests): move all integration tests to be either unit or e2e tests - remove old testing infra (#589)
* tests(integration): move basic integration tests to be unit tests * fix(tests): silently fail threadbus for tests * tests(unit): move compatibility tests to become unit tests for grid * tests(unit): move close_pane tests to become unit tests for grid * tests(e2e): move basic layout test to e2e * tests(unit): move move_focus tests to be unit tests * tests(unit): move resize_down tests to be unit tests * tests(unit): move resize_left tests to be unit tests * tests(unit): move resize_right tests to be unit tests * tests(unit): move resize_up tests to be unit tests * tests(infra): remove unused infra * style(fmt): make rustfmt happy * debug * debug * debug * debug * chore(test): shift volume mounting around because github actions is a special child
Diffstat (limited to 'src/tests/integration/basic.rs')
-rw-r--r--src/tests/integration/basic.rs498
1 files changed, 0 insertions, 498 deletions
diff --git a/src/tests/integration/basic.rs b/src/tests/integration/basic.rs
deleted file mode 100644
index 98f77988..00000000
--- a/src/tests/integration/basic.rs
+++ /dev/null
@@ -1,498 +0,0 @@
-use ::insta::assert_snapshot;
-use zellij_utils::pane_size::PositionAndSize;
-
-use crate::tests::fakes::FakeInputOutput;
-use crate::tests::start;
-use crate::tests::utils::commands::{
- BRACKETED_PASTE_END, BRACKETED_PASTE_START, PANE_MODE, QUIT, SCROLL_DOWN_IN_SCROLL_MODE,
- SCROLL_MODE, SCROLL_PAGE_DOWN_IN_SCROLL_MODE, SCROLL_PAGE_UP_IN_SCROLL_MODE,
- SCROLL_UP_IN_SCROLL_MODE, SPAWN_TERMINAL_IN_PANE_MODE, SPLIT_DOWN_IN_PANE_MODE,
- SPLIT_RIGHT_IN_PANE_MODE, TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
-};
-use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots};
-use crate::CliArgs;
-use zellij_utils::input::config::Config;
-
-fn get_fake_os_input(fake_win_size: &PositionAndSize) -> FakeInputOutput {
- FakeInputOutput::new(fake_win_size.clone())
-}
-
-#[test]
-pub fn starts_with_one_terminal() {
- let fake_win_size = PositionAndSize {
- cols: 121,
- rows: 20,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[&QUIT]);
- start(
- Box::new(fake_input_output.clone()),
- CliArgs::default(),
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}
-
-#[test]
-pub fn split_terminals_vertically() {
- let fake_win_size = PositionAndSize {
- cols: 121,
- rows: 20,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[&PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &QUIT]);
- start(
- Box::new(fake_input_output.clone()),
- CliArgs::default(),
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}
-
-#[test]
-pub fn split_terminals_horizontally() {
- let fake_win_size = PositionAndSize {
- cols: 121,
- rows: 20,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[&PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &QUIT]);
- start(
- Box::new(fake_input_output.clone()),
- CliArgs::default(),
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}
-
-#[test]
-pub fn split_largest_terminal() {
- // this finds the largest pane and splits along its longest edge (vertically or horizontally)
- let fake_win_size = PositionAndSize {
- cols: 121,
- rows: 20,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- &PANE_MODE,
- &SPAWN_TERMINAL_IN_PANE_MODE,
- &SPAWN_TERMINAL_IN_PANE_MODE,
- &SPAWN_TERMINAL_IN_PANE_MODE,
- &QUIT,
- ]);
- start(
- Box::new(fake_input_output.clone()),
- CliArgs::default(),
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}
-
-#[test]
-pub fn cannot_split_terminals_vertically_when_active_terminal_is_too_small() {
- let fake_win_size = PositionAndSize {
- cols: 8,
- rows: 20,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[&PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &QUIT]);
- start(
- Box::new(fake_input_output.clone()),
- CliArgs::default(),
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}
-
-#[test]
-pub fn cannot_split_terminals_horizontally_when_active_terminal_is_too_small() {
- let fake_win_size = PositionAndSize {
- cols: 121,
- rows: 4,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[&PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &QUIT]);
- start(
- Box::new(fake_input_output.clone()),
- CliArgs::default(),
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}
-
-#[test]
-pub fn cannot_split_largest_terminal_when_there_is_no_room() {
- let fake_win_size = PositionAndSize {
- cols: 8,
- rows: 4,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[&PANE_MODE, &SPAWN_TERMINAL_IN_PANE_MODE, &QUIT]);
- start(
- Box::new(fake_input_output.clone()),
- CliArgs::default(),
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}
-
-#[test]
-pub fn scrolling_up_inside_a_pane() {
- let fake_win_size = PositionAndSize {
- cols: 121,
- rows: 20,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- &PANE_MODE,
- &SPLIT_DOWN_IN_PANE_MODE,
- &SPLIT_RIGHT_IN_PANE_MODE,
- &SCROLL_MODE,
- &SCROLL_UP_IN_SCROLL_MODE,
- &SCROLL_UP_IN_SCROLL_MODE,
- &QUIT,
- ]);
- start(
- Box::new(fake_input_output.clone()),
- CliArgs::default(),
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}
-
-#[test]
-pub fn scrolling_down_inside_a_pane() {
- let fake_win_size = PositionAndSize {
- cols: 121,
- rows: 20,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- &PANE_MODE,
- &SPLIT_DOWN_IN_PANE_MODE,
- &SPLIT_RIGHT_IN_PANE_MODE,
- &SCROLL_MODE,
- &SCROLL_UP_IN_SCROLL_MODE,
- &SCROLL_UP_IN_SCROLL_MODE,
- &SCROLL_DOWN_IN_SCROLL_MODE,
- &SCROLL_DOWN_IN_SCROLL_MODE,
- &QUIT,
- ]);
- start(
- Box::new(fake_input_output.clone()),
- CliArgs::default(),
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}
-
-#[test]
-pub fn scrolling_page_up_inside_a_pane() {
- let fake_win_size = PositionAndSize {
- cols: 121,
- rows: 20,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- &PANE_MODE,
- &SPLIT_DOWN_IN_PANE_MODE,
- &SPLIT_RIGHT_IN_PANE_MODE,
- &SCROLL_MODE,
- &SCROLL_PAGE_UP_IN_SCROLL_MODE,
- &QUIT,
- ]);
- start(
- Box::new(fake_input_output.clone()),
- CliArgs::default(),
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}
-
-#[test]
-pub fn scrolling_page_down_inside_a_pane() {
- let fake_win_size = PositionAndSize {
- cols: 121,
- rows: 20,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- &PANE_MODE,
- &SPLIT_DOWN_IN_PANE_MODE,
- &SPLIT_RIGHT_IN_PANE_MODE,
- &SCROLL_MODE,
- &SCROLL_PAGE_UP_IN_SCROLL_MODE,
- &SCROLL_PAGE_UP_IN_SCROLL_MODE,
- &SCROLL_PAGE_DOWN_IN_SCROLL_MODE,
- &SCROLL_PAGE_DOWN_IN_SCROLL_MODE,
- &QUIT,
- ]);
- start(
- Box::new(fake_input_output.clone()),
- CliArgs::default(),
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}
-
-#[test]
-pub fn max_panes() {
- // with the --max-panes option, we only allow a certain amount of panes on screen
- // simultaneously, new panes beyond this limit will close older panes on screen
- let fake_win_size = PositionAndSize {
- cols: 121,
- rows: 20,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- &PANE_MODE,
- &SPAWN_TERMINAL_IN_PANE_MODE,
- &SPAWN_TERMINAL_IN_PANE_MODE,
- &SPAWN_TERMINAL_IN_PANE_MODE,
- &SPAWN_TERMINAL_IN_PANE_MODE,
- &QUIT,
- ]);
- let mut opts = CliArgs::default();
- opts.max_panes = Some(4);
- start(
- Box::new(fake_input_output.clone()),
- opts,
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}
-
-#[test]
-pub fn toggle_focused_pane_fullscreen() {
- let fake_win_size = PositionAndSize {
- cols: 121,
- rows: 20,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- &PANE_MODE,
- &SPAWN_TERMINAL_IN_PANE_MODE,
- &SPAWN_TERMINAL_IN_PANE_MODE,
- &SPAWN_TERMINAL_IN_PANE_MODE,
- &TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
- &QUIT,
- ]);
- let mut opts = CliArgs::default();
- opts.max_panes = Some(4);
- start(
- Box::new(fake_input_output.clone()),
- opts,
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}
-
-#[test]
-pub fn bracketed_paste() {
- // bracketed paste (https://xfree86.org/current/ctlseqs.html#Bracketed%20Paste%20Mode)
- // makes sure that text the user pastes is not interpreted as commands by the running program
- // (zellij in this case)
- // this tests makes sure the "SPLIT_RIGHT_IN_PANE_MODE" command is not interpreted as Zellij,
- // since it's inside a bracketed paste block, while the "QUIT" command is, since it is already
- // past the block
- let fake_win_size = PositionAndSize {
- cols: 121,
- rows: 20,
- x: 0,
- y: 0,
- ..Default::default()
- };
- let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- &PANE_MODE,
- &BRACKETED_PASTE_START,
- &SPLIT_RIGHT_IN_PANE_MODE,
- &BRACKETED_PASTE_END,
- &QUIT,
- ]);
- start(
- Box::new(fake_input_output.clone()),
- CliArgs::default(),
- Box::new(fake_input_output.clone()),
- Config::default(),
- None,
- );
- let output_frames = fake_input_output
- .stdout_writer
- .output_frames
- .lock()
- .unwrap();
- let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
- let snapshot_before_quit =
- get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
- assert_snapshot!(snapshot_before_quit);
-}