From ebd4e375d99a93edfa65c61c3b56c6d6e83e7945 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 | 28 +++++++++++++++++++++++ .github/workflows/test-with-selenium.yaml | 2 +- README.md | 3 ++- 3 files changed, 31 insertions(+), 2 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..8cd6da9 --- /dev/null +++ b/.github/workflows/test-with-jest.yaml @@ -0,0 +1,28 @@ +name: unit-tests +on: + push: + paths: + - .github/workflows/test-with-jest.yaml + - tests/unit-test/** + pull_request: +jobs: + test-with-selenium: + name: Test with Selenium + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Pull docker images + run: tests/scripts/docker-compose.sh pull + - name: Start test containers + run: tests/scripts/docker-compose.sh up -d + - name: Test selenium hub connection + run: tests/scripts/docker-utils/test-connection.sh http://selenium-hub:4444 + # Start testing + - name: Test default + run: tests/scripts/docker-utils/exec-selenium.sh test_default.py + - name: Test navigation + run: tests/scripts/docker-utils/exec-selenium.sh test_navigation.py + # Clean up + - name: Stop test containers + if: always() + run: tests/scripts/docker-compose.sh shutdown diff --git a/.github/workflows/test-with-selenium.yaml b/.github/workflows/test-with-selenium.yaml index 3f1e7cf..4f1a65f 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: diff --git a/README.md b/README.md index f2859da..2c568d1 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-selenium.yaml?label=end-to-end-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) [![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)