mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2024-11-26 03:15:58 +03:00
Merge pull request #77 from mCaptcha/nighwatch
Integration testing using Nighwatch (firefox + chromium)
This commit is contained in:
commit
78de0b266f
3 changed files with 48 additions and 0 deletions
6
.github/workflows/linux.yml
vendored
6
.github/workflows/linux.yml
vendored
|
@ -104,6 +104,9 @@ jobs:
|
|||
profile: minimal
|
||||
override: true
|
||||
|
||||
- name: install nightwatch dep
|
||||
run: sudo apt-get install xvfb
|
||||
|
||||
- name: Run migrations
|
||||
run: make migrate
|
||||
env:
|
||||
|
@ -128,6 +131,9 @@ jobs:
|
|||
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
|
||||
MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}"
|
||||
|
||||
- name: run integration tests
|
||||
run: make test.integration
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/mCaptcha'
|
||||
uses: docker/login-action@v1
|
||||
|
|
3
Makefile
3
Makefile
|
@ -123,6 +123,9 @@ test: frontend-test frontend ## Run all available tests
|
|||
cargo test --no-fail-fast
|
||||
# ./scripts/tests.sh
|
||||
|
||||
test.integration: ## run integration tests with nightwatch.js
|
||||
./scripts/integration.sh
|
||||
|
||||
xml-test-coverage: migrate ## Generate code coverage report in XML format
|
||||
$(call cache_bust)
|
||||
cargo tarpaulin -t 1200 --out Xml
|
||||
|
|
39
scripts/integration.sh
Executable file
39
scripts/integration.sh
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -Eeuo pipefail
|
||||
trap cleanup SIGINT SIGTERM ERR EXIT
|
||||
|
||||
readonly PROJECT_ROOT=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
|
||||
source $PROJECT_ROOT/scripts/lib.sh
|
||||
|
||||
is_ci(){
|
||||
if [ -z ${CI+x} ];
|
||||
then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
docker-compose down -v --remove-orphans || true
|
||||
docker-compose up -d
|
||||
cd $(mktemp -d)
|
||||
pwd
|
||||
find
|
||||
git clone https://github.com/mCaptcha/integration .
|
||||
|
||||
if is_ci
|
||||
then
|
||||
yarn install
|
||||
xvfb-run --auto-servernum npm run test.chrome
|
||||
xvfb-run --auto-servernum npm run test.firefox
|
||||
else
|
||||
yarn install
|
||||
npx nightwatch ./test/mCaptcha.ts
|
||||
fi
|
||||
|
||||
cd $PROJECT_ROOT
|
||||
docker-compose down -v --remove-orphans || true
|
Loading…
Reference in a new issue