Skip to content

Commit

Permalink
fix: make examples use submit
Browse files Browse the repository at this point in the history
Signed-off-by: Chapman Pendery <[email protected]>
  • Loading branch information
cpendery committed Mar 9, 2024
1 parent ba9d3f0 commit 7ad11fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ npx @microsoft/tui-test

### Multi-platform / Multi-shell • No more "it works in my shell"

**Multi-platform**. TUI Test supports testing on macOS, Linux, and Windows with a wide range of shells when installed: `cmd`, `windows powershell`, `powershell`, `bash`, `git-bash`, `fish`, and `zsh`.
**Multi-platform**. TUI Test supports testing on macOS, Linux, and Windows with a wide range of shells when installed: `cmd`, `windows powershell`, `powershell`, `bash`, `git-bash`, `fish`, `zsh`, and `xonsh`.

**Wide-support**. TUI Test uses [xterm.js](https://xtermjs.org/) to render the terminal, which is a widely used terminal emulator in projects like [VSCode](https://github.com/microsoft/vscode) and [Hyper](https://github.com/vercel/hyper).

Expand Down Expand Up @@ -96,7 +96,7 @@ This code snippet shows how to use rich assertions of the terminal.
import { test, expect } from "@microsoft/tui-test";

test("make a regex assertion", async ({ terminal }) => {
terminal.write("ls -l\r")
terminal.submit("ls -l")

await expect(terminal.getByText(/total [0-9]{3}/g)).toBeVisible();
});
Expand Down
8 changes: 4 additions & 4 deletions examples/assertions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ import { test, expect, Shell } from "@microsoft/tui-test";
test.use({ shell: Shell.Powershell });

test("make a regex assertion", async ({ terminal }) => {
terminal.write("dir | measure\r");
terminal.submit("dir | measure");

await expect(terminal.getByText(/Count\s*:\s*[0-9]{2}/g)).toBeVisible();
});

test("make a text assertion", async ({ terminal }) => {
terminal.write("echo 1\r");
terminal.submit("echo 1");

await expect(terminal.getByText("1")).toBeVisible();
});

test("make a negative text assertion", async ({ terminal }) => {
terminal.write("echo 1\r");
terminal.submit("echo 1");
await expect(terminal.getByText("1")).toBeVisible();

terminal.write("clear\r");
terminal.submit("clear");
await expect(terminal.getByText("clear")).not.toBeVisible();
});

0 comments on commit 7ad11fe

Please sign in to comment.