diff options
| author | Aram Drevekenin <aram@poor.dev> | 2021-06-30 11:27:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-30 11:27:35 +0200 |
| commit | ed4fd2a8e77df304539ca7f445a78039028eaa8a (patch) | |
| tree | ae48b03370b11f3f0987676584724463ac83460d /src/tests/e2e/cases.rs | |
| parent | Merge pull request #590 from a-kenji/clippy-fixes (diff) | |
| download | sl0ppij-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/e2e/cases.rs')
| -rw-r--r-- | src/tests/e2e/cases.rs | 83 |
1 files changed, 77 insertions, 6 deletions
diff --git a/src/tests/e2e/cases.rs b/src/tests/e2e/cases.rs index 5af67074..69233f25 100644 --- a/src/tests/e2e/cases.rs +++ b/src/tests/e2e/cases.rs @@ -1,15 +1,58 @@ +#![allow(unused)] + use ::insta::assert_snapshot; use zellij_utils::pane_size::PositionAndSize; use rand::Rng; +use std::path::Path; + use super::remote_runner::{RemoteRunner, RemoteTerminal, Step}; -use crate::tests::utils::commands::{ - CLOSE_PANE_IN_PANE_MODE, DETACH_IN_SESSION_MODE, ENTER, LOCK_MODE, NEW_TAB_IN_TAB_MODE, - PANE_MODE, QUIT, RESIZE_LEFT_IN_RESIZE_MODE, RESIZE_MODE, SCROLL_MODE, - SCROLL_UP_IN_SCROLL_MODE, SESSION_MODE, SPLIT_RIGHT_IN_PANE_MODE, TAB_MODE, - TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE, -}; + +pub const QUIT: [u8; 1] = [17]; // ctrl-q +pub const ESC: [u8; 1] = [27]; +pub const ENTER: [u8; 1] = [10]; // char '\n' +pub const LOCK_MODE: [u8; 1] = [7]; // ctrl-g + +pub const MOVE_FOCUS_LEFT_IN_NORMAL_MODE: [u8; 2] = [27, 104]; // alt-h +pub const MOVE_FOCUS_RIGHT_IN_NORMAL_MODE: [u8; 2] = [27, 108]; // alt-l + +pub const PANE_MODE: [u8; 1] = [16]; // ctrl-p +pub const SPAWN_TERMINAL_IN_PANE_MODE: [u8; 1] = [110]; // n +pub const MOVE_FOCUS_IN_PANE_MODE: [u8; 1] = [112]; // p +pub const SPLIT_DOWN_IN_PANE_MODE: [u8; 1] = [100]; // d +pub const SPLIT_RIGHT_IN_PANE_MODE: [u8; 1] = [114]; // r +pub const TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE: [u8; 1] = [102]; // f +pub const CLOSE_PANE_IN_PANE_MODE: [u8; 1] = [120]; // x +pub const MOVE_FOCUS_DOWN_IN_PANE_MODE: [u8; 1] = [106]; // j +pub const MOVE_FOCUS_UP_IN_PANE_MODE: [u8; 1] = [107]; // k +pub const MOVE_FOCUS_LEFT_IN_PANE_MODE: [u8; 1] = [104]; // h +pub const MOVE_FOCUS_RIGHT_IN_PANE_MODE: [u8; 1] = [108]; // l + +pub const SCROLL_MODE: [u8; 1] = [19]; // ctrl-s +pub const SCROLL_UP_IN_SCROLL_MODE: [u8; 1] = [107]; // k +pub const SCROLL_DOWN_IN_SCROLL_MODE: [u8; 1] = [106]; // j +pub const SCROLL_PAGE_UP_IN_SCROLL_MODE: [u8; 1] = [2]; // ctrl-b +pub const SCROLL_PAGE_DOWN_IN_SCROLL_MODE: [u8; 1] = [6]; // ctrl-f + +pub const RESIZE_MODE: [u8; 1] = [18]; // ctrl-r +pub const RESIZE_DOWN_IN_RESIZE_MODE: [u8; 1] = [106]; // j +pub const RESIZE_UP_IN_RESIZE_MODE: [u8; 1] = [107]; // k +pub const RESIZE_LEFT_IN_RESIZE_MODE: [u8; 1] = [104]; // h +pub const RESIZE_RIGHT_IN_RESIZE_MODE: [u8; 1] = [108]; // l + +pub const TAB_MODE: [u8; 1] = [20]; // ctrl-t +pub const NEW_TAB_IN_TAB_MODE: [u8; 1] = [110]; // n +pub const SWITCH_NEXT_TAB_IN_TAB_MODE: [u8; 1] = [108]; // l +pub const SWITCH_PREV_TAB_IN_TAB_MODE: [u8; 1] = [104]; // h +pub const CLOSE_TAB_IN_TAB_MODE: [u8; 1] = [120]; // x + +pub const SESSION_MODE: [u8; 1] = [15]; // ctrl-o +pub const DETACH_IN_SESSION_MODE: [u8; 1] = [100]; // d + +pub const BRACKETED_PASTE_START: [u8; 6] = [27, 91, 50, 48, 48, 126]; // \u{1b}[200~ +pub const BRACKETED_PASTE_END: [u8; 6] = [27, 91, 50, 48, 49, 126]; // \u{1b}[201 +pub const SLEEP: [u8; 0] = []; // All the E2E tests are marked as "ignored" so that they can be run separately from the normal // tests @@ -714,3 +757,31 @@ pub fn detach_and_attach_session() { .run_all_steps(); assert_snapshot!(last_snapshot); } + +#[test] +#[ignore] +pub fn accepts_basic_layout() { + let fake_win_size = PositionAndSize { + cols: 120, + rows: 24, + x: 0, + y: 0, + ..Default::default() + }; + let layout_file_name = "three-panes-with-nesting.yaml"; + let last_snapshot = RemoteRunner::new_with_layout("accepts_basic_layout", fake_win_size, layout_file_name, None) + .add_step(Step { + name: "Wait for app to load", + instruction: |remote_terminal: RemoteTerminal| -> bool { + let mut step_is_complete = false; + if remote_terminal.cursor_position_is(2, 0) + && remote_terminal.snapshot_contains("$ █ │$") + && remote_terminal.snapshot_contains("$ ") { + step_is_complete = true; + } + step_is_complete + }, + }) + .run_all_steps(); + assert_snapshot!(last_snapshot); +} |
