Skip to content

Commit db81b6e

Browse files
authored
Feature/547/improve jest matchers (#549)
* (#547) New matcher toHaveColor that verifies pixel colors on screen * (#547) Updated toShow to support full search parameters, added the possibility to pass a region to directly specify a search region instead of the whole screen * (#547) Expose new matchers * (#547) npm audit fix * (#547) Try to increase node heap space * (#547) Try to increase node heap space * (#547) Get rid of Docker tests * (#547) Addressed some sonar issues * (#547) Don't run coverage report again after the first stage
1 parent 41b7b29 commit db81b6e

19 files changed

+332
-278
lines changed

.build/build.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

.build/run_linux.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

.build/run_osx.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

.build/setup_linux.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

.build/setup_osx.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ jobs:
2020
uses: actions/setup-node@v3
2121
with:
2222
node-version: 18
23-
- name: Setup Docker
24-
run: |
25-
docker pull s1hofmann/nut-ci:latest
26-
docker run -it -d --name nut-ci --shm-size 8gb --user $(id -u):$(id -g) -v ${PWD}:${PWD}:rw s1hofmann/nut-ci:latest bash
2723
- name: Install
2824
run: npm ci
2925
- name: Compile
@@ -34,10 +30,10 @@ jobs:
3430
run: npm run coverage:clean
3531
- name: Generate coverage report
3632
uses: GabrielBB/xvfb-action@v1
33+
env:
34+
NODE_OPTIONS: "--max-old-space-size=8192"
3735
with:
3836
run: npm run coverage -- --coverageDirectory=coverage/unit
39-
- name: Run Docker E2E tests
40-
run: docker exec nut-ci bash -c "bash $PWD/.build/build.sh ${PWD} 14"
4137
- name: Run Electron e2e test subpackage
4238
uses: GabrielBB/xvfb-action@v1
4339
with:
@@ -78,7 +74,7 @@ jobs:
7874
with:
7975
run: |
8076
npx playwright install --with-deps
81-
npm run coverage -- --coverageDirectory=coverage/unit
77+
npm test
8278
- name: Run Electron e2e test subpackage
8379
uses: GabrielBB/xvfb-action@v1
8480
with:

.github/workflows/snapshot_release.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ jobs:
2424
uses: actions/setup-node@v3
2525
with:
2626
node-version: ${{matrix.node}}
27-
- name: Setup Docker
28-
if: ${{matrix.os == 'ubuntu-latest'}}
29-
run: |
30-
docker pull s1hofmann/nut-ci:latest
31-
docker run -it -d --name nut-ci --shm-size 8gb --user $(id -u):$(id -g) -v ${PWD}:${PWD}:rw s1hofmann/nut-ci:latest bash
3227
- name: Install
3328
run: npm ci
3429
- name: Install @nut-tree/libnut@next
@@ -43,9 +38,6 @@ jobs:
4338
run: |
4439
npx playwright install --with-deps
4540
npm test
46-
- name: Run Docker E2E tests
47-
if: ${{matrix.os == 'ubuntu-latest'}}
48-
run: docker exec nut-ci bash -c "bash $PWD/.build/build.sh ${PWD} 14"
4941
- name: Run Electron e2e test subpackage
5042
uses: GabrielBB/xvfb-action@v1
5143
with:

.github/workflows/tagged_release.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ jobs:
1818
uses: actions/setup-node@v3
1919
with:
2020
node-version: ${{matrix.node}}
21-
- name: Setup Docker
22-
if: ${{matrix.os == 'ubuntu-latest'}}
23-
run: |
24-
docker pull s1hofmann/nut-ci:latest
25-
docker run -it -d --name nut-ci --shm-size 8gb --user $(id -u):$(id -g) -v ${PWD}:${PWD}:rw s1hofmann/nut-ci:latest bash
2621
- name: Install
2722
run: npm ci
2823
- name: Compile
@@ -35,9 +30,6 @@ jobs:
3530
run: |
3631
npx playwright install --with-deps
3732
npm test
38-
- name: Run Docker E2E tests
39-
if: ${{matrix.os == 'ubuntu-latest'}}
40-
run: docker exec nut-ci bash -c "bash $PWD/.build/build.sh ${PWD} ${{matrix.node}}"
4133
- name: Run Electron e2e test subpackage
4234
uses: GabrielBB/xvfb-action@v1
4335
with:

lib/clipboard.class.e2e.spec.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

lib/expect/jest.matcher.function.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@ import { toBeAt } from "./matchers/toBeAt.function";
44
import { toBeIn } from "./matchers/toBeIn.function";
55
import { toShow } from "./matchers/toShow.function";
66
import { FindInput } from "../screen.class";
7+
import { RGBA } from "../rgba.class";
8+
import { toHaveColor } from "./matchers/toHaveColor.function";
9+
import { OptionalSearchParameters } from "../optionalsearchparameters.class";
710

811
declare global {
912
namespace jest {
1013
interface Matchers<R> {
1114
toBeAt: (position: Point) => ReturnType<typeof toBeAt>;
1215
toBeIn: (region: Region) => ReturnType<typeof toBeIn>;
1316
// @ts-ignore
14-
toShow: (
17+
toShow: <PROVIDER_DATA>(
1518
needle: FindInput,
16-
confidence?: number
19+
parameters?: OptionalSearchParameters<PROVIDER_DATA>,
1720
) => ReturnType<typeof toShow>;
21+
toHaveColor: (color: RGBA) => ReturnType<typeof toHaveColor>;
1822
}
1923
}
2024
}
@@ -23,4 +27,5 @@ export const jestMatchers = {
2327
toBeAt,
2428
toBeIn,
2529
toShow,
30+
toHaveColor,
2631
};

0 commit comments

Comments
 (0)