From f33309bd7dc8aa57d770ca6dc3d60efe0f6b59d0 Mon Sep 17 00:00:00 2001 From: Johnson Sun Date: Sun, 4 Aug 2024 18:16:56 +0800 Subject: [PATCH] ci: Add jest unit tests --- .github/workflows/test-with-jest.yaml | 25 +++++++++++++++++++++++ .github/workflows/test-with-selenium.yaml | 5 +++-- README.md | 3 ++- 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/test-with-jest.yaml diff --git a/.github/workflows/test-with-jest.yaml b/.github/workflows/test-with-jest.yaml new file mode 100644 index 0000000..0c8bc70 --- /dev/null +++ b/.github/workflows/test-with-jest.yaml @@ -0,0 +1,25 @@ +name: unit-tests +on: + push: + paths: + - .github/workflows/test-with-jest.yaml + - tests/testcases/** + - tests/unit-test/** + pull_request: +jobs: + test-with-jest: + name: Unit Test with Jest + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Pull docker images + run: docker compose -f tests/unit-test/compose.yml pull + - name: Start test containers + run: docker compose -f tests/unit-test/compose.yml up -d + # Start testing + - name: Test navigation + run: docker exec -t unit-test-jest-tests-1 /app/tests/unit-test/install-and-run.sh + # Clean up + - name: Stop test containers + if: always() + run: docker compose -f tests/unit-test/compose.yml down diff --git a/.github/workflows/test-with-selenium.yaml b/.github/workflows/test-with-selenium.yaml index 3f1e7cf..93ea822 100644 --- a/.github/workflows/test-with-selenium.yaml +++ b/.github/workflows/test-with-selenium.yaml @@ -1,4 +1,4 @@ -name: tests +name: end-to-end-tests on: push: paths: @@ -6,11 +6,12 @@ on: - chrome/** - firefox/** - tests/scripts/** + - tests/testcases/** - tests/end-to-end-test/** pull_request: jobs: test-with-selenium: - name: Test with Selenium + name: End-to-end Test with Selenium runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index f2859da..f292328 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # arxiv-utils -[![tests](https://img.shields.io/github/actions/workflow/status/j3soon/arxiv-utils/test-with-selenium.yaml?label=tests)](https://github.com/j3soon/arxiv-utils/actions/workflows/test-with-selenium.yaml) +[![tests](https://img.shields.io/github/actions/workflow/status/j3soon/arxiv-utils/test-with-jest.yaml?label=unit-tests)](https://github.com/j3soon/arxiv-utils/actions/workflows/test-with-jest.yaml) +[![tests](https://img.shields.io/github/actions/workflow/status/j3soon/arxiv-utils/test-with-selenium.yaml?label=end-to-end-tests)](https://github.com/j3soon/arxiv-utils/actions/workflows/test-with-selenium.yaml) [![build](https://img.shields.io/github/actions/workflow/status/j3soon/arxiv-utils/build-and-publish.yaml)](https://github.com/j3soon/arxiv-utils/actions/workflows/build-and-publish.yaml) [![](https://img.shields.io/chrome-web-store/v/mnhdpeipjhhkmlhlcljdjpgmilbmehij.svg)](https://chrome.google.com/webstore/detail/arxiv-utils/mnhdpeipjhhkmlhlcljdjpgmilbmehij)