Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-04-30 20:34:04 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-04-30 20:34:39 -0700
commit1eda0dafd539b6a259fe1ad4609419c8f04c49c7 (patch)
tree574a44e8bb574d947e5114046c550965874f4df5
parentfcb205ba0b5e958c39100e1eef57317fbf3c20d1 (diff)
Fix test; add some scripts
-rwxr-xr-xnode4
-rwxr-xr-xnpm3
-rw-r--r--package.json2
-rwxr-xr-xrun-test8
-rw-r--r--test/integration/page.test.js4
5 files changed, 11 insertions, 10 deletions
diff --git a/node b/node
new file mode 100755
index 0000000..aab7db9
--- /dev/null
+++ b/node
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+
+docker run --rm --init -it -v $PWD:/usr/src/app btroops node $@
+
diff --git a/npm b/npm
new file mode 100755
index 0000000..3f0936f
--- /dev/null
+++ b/npm
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+docker run --rm --init -it -v $PWD:/usr/src/app btroops npm $@
diff --git a/package.json b/package.json
index f437438..63b3fba 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
},
"scripts": {
"start": "node dev-server.cjs",
- "test:integ": "jest --config jest.config.integ.cjs",
+ "test:integ": "node --trace-warnings ./node_modules/.bin/jest --detectOpenHandles --config jest.config.integ.cjs",
"test": "jest"
}
}
diff --git a/run-test b/run-test
index 1c162ba..0430cf7 100755
--- a/run-test
+++ b/run-test
@@ -1,11 +1,5 @@
#!/usr/bin/env bash
NPM_COMMAND="npm run test:integ"
-CONTAINER_NAME=$(docker container ls --all --filter=ancestor=btroops --format "{{.Names}}")
-if [[ -z "${CONTAINER_NAME}" ]]
-then
- docker run --rm -it -v $PWD:/usr/src/app btroops $NPM_COMMAND
-else
- docker exec -it $CONTAINER_NAME $NPM_COMMAND
-fi
+docker run --rm --init -it -v $PWD:/usr/src/app btroops $NPM_COMMAND
diff --git a/test/integration/page.test.js b/test/integration/page.test.js
index 003f9db..c18beb9 100644
--- a/test/integration/page.test.js
+++ b/test/integration/page.test.js
@@ -16,10 +16,10 @@ it('loads the page', async () => {
expect(await driver.getTitle()).toEqual('Infantry Combat Solo Basic');
});
-it('selects a trooper by clicking on their counter', async () => {
+it('selects an off-board soldier', async () => {
await driver.switchTo().frame(driver.findElement(By.css('object')));
- const selector = '.counter[data-allegiance="liao"][data-number="1"]',
+ const selector = '.counter[data-allegiance="attacker"][data-number="1"]',
svg = await driver.findElement(By.css('svg')),
counter = await driver.findElement(By.css(selector), svg);