-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathtest.sh
executable file
·57 lines (46 loc) · 1.54 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
set -eo pipefail
echo '--- testing rails 6.1.7'
echo '-- setting environment'
export DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export RAILS_ENV=test
export BUNDLE_GEMFILE="$DIR/Gemfile"
cd $DIR
echo '-- bundle install'
bundle --version
bundle config set --local path 'vendor/bundle'
bundle install --quiet --gemfile="$DIR/Gemfile" --retry 2
echo '-- migration'
bundle exec ./bin/rails db:drop || true
bundle exec ./bin/rails db:create db:migrate
echo '-- cypress install'
bundle exec ./bin/rails g cypress_on_rails:install --install_folder=test --framework cypress --install_with=npm --force
rm -vf test/cypress/e2e/rails_examples/using_vcr.cy.js
echo '-- start rails server'
# make sure the server is not running
(kill -9 `cat ../server.pid` || true )
bundle exec ./bin/rails server -p 5017 -e test -P ../server.pid &
sleep 2 # give rails a chance to start up correctly
echo '-- cypress run'
cp -fv ../cypress.config.js test/
cd test
npx cypress install
# if [ -z $CYPRESS_RECORD_KEY ]
# then
# npx cypress run
# else
npx cypress run # --record
# fi
echo '-- playwright install'
cd ..
bundle exec ./bin/rails g cypress_on_rails:install --install_folder=test --framework playwright --install_with=npm --force
rm -vf test/playwright/e2e/rails_examples/using_vcr.cy.js
echo '-- playwright run'
cd test
cp -fv ../../playwright.config.js .
npx playwright install-deps
npx playwright install
npx playwright test test/playwright
# npx playwright show-report
echo '-- stop rails server'
kill -9 `cat ../../server.pid` || true