From 100f2416f9de1476b6d745e15730223f58e942a6 Mon Sep 17 00:00:00 2001 From: Ben Bachem <10088265+bezbac@users.noreply.github.com> Date: Tue, 7 Jan 2025 16:29:30 +0100 Subject: [PATCH] wip --- tests/.gitignore | 2 ++ tests/Dockerfile | 4 ++-- tests/example.test.js | 7 +++++++ tests/expect.sh | 3 --- tests/integration_test.sh | 2 +- tests/package.json | 6 ++++++ 6 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 tests/.gitignore create mode 100644 tests/example.test.js delete mode 100755 tests/expect.sh create mode 100644 tests/package.json diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..00954c5 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,2 @@ +.tui-test/ +node_modules/ diff --git a/tests/Dockerfile b/tests/Dockerfile index 7aa09c1..35c61c4 100644 --- a/tests/Dockerfile +++ b/tests/Dockerfile @@ -5,8 +5,8 @@ RUN apt update # Install curl RUN apt install curl -y -# Install expect -RUN apt install expect -y +# Install Node.js and npm +RUN apt install -y nodejs npm # Install zsh RUN apt install zsh -y diff --git a/tests/example.test.js b/tests/example.test.js new file mode 100644 index 0000000..a41ace4 --- /dev/null +++ b/tests/example.test.js @@ -0,0 +1,7 @@ +import { test, expect } from "@microsoft/tui-test"; + +test.use({ program: { file: "zellij" } }); + +test("shows current pane", async ({ terminal }) => { + await expect(terminal.getByText("Pane #1", { full: true })).toBeVisible(); +}); diff --git a/tests/expect.sh b/tests/expect.sh deleted file mode 100755 index 2ccc0d3..0000000 --- a/tests/expect.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/expect - -spawn "/bin/zellij attach -c main" diff --git a/tests/integration_test.sh b/tests/integration_test.sh index 6a9d71f..61f501f 100755 --- a/tests/integration_test.sh +++ b/tests/integration_test.sh @@ -11,4 +11,4 @@ cd .. docker build -t zellij:test -f ./tests/Dockerfile . # Run the expect script inside the docker container -docker run -v ./tests/expect.sh:/expect.sh -t zellij:test -c "/expect.sh" +docker run -v ./tests/package.json:/tests/package.json -v ./tests/example.test.js:/tests/example.test.js -t zellij:test -c "cd /tests && npm install && ./node_modules/.bin/tui-test" diff --git a/tests/package.json b/tests/package.json new file mode 100644 index 0000000..bcc1427 --- /dev/null +++ b/tests/package.json @@ -0,0 +1,6 @@ +{ + "type": "module", + "dependencies": { + "@microsoft/tui-test": "0.0.1-rc.5" + } +}