aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/e2e
diff options
context:
space:
mode:
authorThomas Linford <tlinford@users.noreply.github.com>2023-05-03 21:16:38 +0200
committerGitHub <noreply@github.com>2023-05-03 21:16:38 +0200
commitf598ca373829c99c6e2b2c6064047ed07c139ff7 (patch)
tree3f409b9218d9eaec5f7ce087408f75c29914fb07 /src/tests/e2e
parentdocs(changelog): fix theme loading (diff)
downloadsl0ppij-f598ca373829c99c6e2b2c6064047ed07c139ff7.tar.gz
sl0ppij-f598ca373829c99c6e2b2c6064047ed07c139ff7.tar.xz
sl0ppij-f598ca373829c99c6e2b2c6064047ed07c139ff7.zip
improve build/ci times (#2396)
- avoid building all workspace crates with `cargo x build` (only plugins and main binary) - only set the target triple in tests for plugins - add new profile for `cargo x run` to build with optimized dependencies => FAST plugins when developing (thanks [Bevy Book](https://bevyengine.org/learn/book/getting-started/setup/#compile-with-performance-optimizations) for the idea) - use https://github.com/Swatinem/rust-cache to avoid rebuilding dependencies every time in ci - split `Build & Test` job into two so they run in parallel - hopefully improve the flaky tests situation, this also makes the e2e tests run much faster (some tests produced correct snapshots but had some logic errors causing them to loop for much longer than necessary). Add some output to the tests so it is easier to see if something goes wrong. - remove verbose build output from e2e test build
Diffstat (limited to 'src/tests/e2e')
-rw-r--r--src/tests/e2e/cases.rs31
-rw-r--r--src/tests/e2e/remote_runner.rs15
2 files changed, 33 insertions, 13 deletions
diff --git a/src/tests/e2e/cases.rs b/src/tests/e2e/cases.rs
index d2b7086a..b34138b9 100644
--- a/src/tests/e2e/cases.rs
+++ b/src/tests/e2e/cases.rs
@@ -190,8 +190,7 @@ pub fn cannot_split_terminals_vertically_when_active_terminal_is_too_small() {
name: "Split pane to the right",
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
- if remote_terminal.status_bar_appears() && remote_terminal.cursor_position_is(3, 2)
- {
+ if remote_terminal.cursor_position_is(3, 2) {
remote_terminal.send_key(&PANE_MODE);
remote_terminal.send_key(&SPLIT_RIGHT_IN_PANE_MODE);
// back to normal mode after split
@@ -205,7 +204,12 @@ pub fn cannot_split_terminals_vertically_when_active_terminal_is_too_small() {
name: "Make sure only one pane appears",
instruction: |remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
- if remote_terminal.cursor_position_is(3, 2) {
+ if remote_terminal.cursor_position_is(3, 2)
+ //two empty lines at the bottom to make sure there is no plugin output
+ && remote_terminal
+ .current_snapshot()
+ .ends_with(" \n ")
+ {
// ... is the truncated tip line
step_is_complete = true;
}
@@ -967,7 +971,7 @@ pub fn detach_and_attach_session() {
name: "Wait for session to be attached",
instruction: |remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
- if remote_terminal.status_bar_appears() && remote_terminal.cursor_position_is(3, 2)
+ if remote_terminal.status_bar_appears() && remote_terminal.cursor_position_is(77, 2)
{
// we're back inside the session
step_is_complete = true;
@@ -1003,9 +1007,7 @@ pub fn status_bar_loads_custom_keybindings() {
name: "Wait for app to load",
instruction: |remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
- if remote_terminal.cursor_position_is(3, 1)
- && remote_terminal.snapshot_contains("$ █ ││$")
- && remote_terminal.snapshot_contains("$ ") {
+ if remote_terminal.cursor_position_is(3, 2) && remote_terminal.tip_appears() {
step_is_complete = true;
}
step_is_complete
@@ -1316,7 +1318,7 @@ pub fn mirrored_sessions() {
name: "take snapshot after",
instruction: |remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
- if remote_terminal.cursor_position_is(3, 2)
+ if remote_terminal.cursor_position_is(63, 2)
&& remote_terminal.snapshot_contains("┐┌")
{
// cursor is back in the first tab
@@ -1329,7 +1331,7 @@ pub fn mirrored_sessions() {
name: "take snapshot after",
instruction: |remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
- if remote_terminal.cursor_position_is(3, 2)
+ if remote_terminal.cursor_position_is(63, 2)
&& remote_terminal.snapshot_contains("┐┌")
{
// cursor is back in the first tab
@@ -1592,6 +1594,7 @@ pub fn multiple_users_in_different_tabs() {
let mut step_is_complete = false;
if remote_terminal.cursor_position_is(3, 2)
&& remote_terminal.tip_appears()
+ && remote_terminal.snapshot_contains("Tab #1 [ ]")
&& remote_terminal.snapshot_contains("Tab #2")
&& remote_terminal.status_bar_appears()
{
@@ -1608,7 +1611,7 @@ pub fn multiple_users_in_different_tabs() {
let mut step_is_complete = false;
if remote_terminal.cursor_position_is(3, 2)
&& remote_terminal.tip_appears()
- && remote_terminal.snapshot_contains("Tab #2")
+ && remote_terminal.snapshot_contains("Tab #2 [ ]")
&& remote_terminal.status_bar_appears()
{
// cursor is in the newly opened second tab
@@ -1649,7 +1652,9 @@ pub fn bracketed_paste() {
name: "Send pasted text followed by normal text",
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
- if remote_terminal.status_bar_appears() && remote_terminal.cursor_position_is(3, 2)
+ if remote_terminal.status_bar_appears()
+ && remote_terminal.tab_bar_appears()
+ && remote_terminal.cursor_position_is(3, 2)
{
remote_terminal.send_key(&BRACKETED_PASTE_START);
remote_terminal.send_key(&TAB_MODE);
@@ -1717,7 +1722,9 @@ pub fn toggle_floating_panes() {
name: "Wait for new pane to appear",
instruction: |remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
- if remote_terminal.cursor_position_is(33, 7) && remote_terminal.tip_appears() {
+ if remote_terminal.cursor_position_is(33, 7)
+ && remote_terminal.snapshot_contains("FLOATING PANES VISIBLE")
+ {
// cursor is in the newly opened second pane
step_is_complete = true;
}
diff --git a/src/tests/e2e/remote_runner.rs b/src/tests/e2e/remote_runner.rs
index bafd9df7..e5c7d2ef 100644
--- a/src/tests/e2e/remote_runner.rs
+++ b/src/tests/e2e/remote_runner.rs
@@ -299,11 +299,15 @@ impl RemoteTerminal {
x == self.cursor_x && y == self.cursor_y
}
pub fn tip_appears(&self) -> bool {
- self.last_snapshot.lock().unwrap().contains("Tip:")
+ let snapshot = self.last_snapshot.lock().unwrap();
+ snapshot.contains("Tip:") || snapshot.contains("QuickNav:")
}
pub fn status_bar_appears(&self) -> bool {
self.last_snapshot.lock().unwrap().contains("Ctrl +")
}
+ pub fn tab_bar_appears(&self) -> bool {
+ self.last_snapshot.lock().unwrap().contains("Tab #1")
+ }
pub fn snapshot_contains(&self, text: &str) -> bool {
self.last_snapshot.lock().unwrap().contains(text)
}
@@ -625,6 +629,10 @@ impl RemoteRunner {
}
pub fn run_next_step(&mut self) {
if let Some(next_step) = self.steps.get(self.current_step_index) {
+ println!(
+ "running step: {}, retries left: {}",
+ next_step.name, self.retries_left
+ );
let (cursor_x, cursor_y) = *self.cursor_coordinates.lock().unwrap();
let remote_terminal = RemoteTerminal {
cursor_x,
@@ -650,6 +658,10 @@ impl RemoteRunner {
let mut retries_left = RETRIES;
let instruction = step.instruction;
loop {
+ println!(
+ "taking snapshot: {}, retries left: {}",
+ step.name, retries_left
+ );
if retries_left == 0 {
self.test_timed_out = true;
return self.last_snapshot.lock().unwrap().clone();
@@ -671,6 +683,7 @@ impl RemoteRunner {
}
}
pub fn run_all_steps(&mut self) {
+ println!();
loop {
self.run_next_step();
if !self.steps_left() {