Skip to content

Commit

Permalink
Simplify e2e scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed May 1, 2024
1 parent ba3c7e7 commit c255321
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 168 deletions.
38 changes: 0 additions & 38 deletions .idea/runConfigurations/JS_Debug_App.xml

This file was deleted.

35 changes: 0 additions & 35 deletions .idea/runConfigurations/Run_App.xml

This file was deleted.

16 changes: 0 additions & 16 deletions .idea/runConfigurations/calendar.xml

This file was deleted.

16 changes: 0 additions & 16 deletions .idea/runConfigurations/demo.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/runConfigurations/e2e_test.xml

This file was deleted.

17 changes: 17 additions & 0 deletions .idea/runConfigurations/open_e2e.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions .idea/runConfigurations/rails.xml

This file was deleted.

16 changes: 0 additions & 16 deletions .idea/runConfigurations/repro.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations/src_build.xml

This file was deleted.

17 changes: 17 additions & 0 deletions .idea/runConfigurations/test_e2e.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,24 @@ enabled ASAP.

Run `npm -i` or (`pnpm -i` if `pnpm` is installed).

You can sequentially run all the e2e tests with:
You can run all the e2e tests in parallel with:

```shell
<local-pagy-dir>/e2e $ npm run test-all
<local-pagy-dir>/e2e $ ./test-e2e
```

or limit the e2e test to a specific APP:
Notice the exit status and the last message in order to check if and which test failed, and search the details in the output.

You can limit the e2e test to a specific APP:

```shell
<local-pagy-dir>/e2e $ APP=demo PORT=8080 npm run test
<local-pagy-dir>/e2e $ ./test-e2e repro
```

You can also run the e2e test interactively (on one APP/file at the time):

```shell
<local-pagy-dir>/e2e $ APP=demo PORT=8080 npm run test-open
<local-pagy-dir>/e2e $ ./test-e2e-open demo
```
---

Expand Down
5 changes: 1 addition & 4 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
"start-server-and-test": "2.0.3"
},
"scripts": {
"lint-fix": "eslint --fix cypress --ext .ts",
"test": "start-test \"bundle exec pagy $APP -p $PORT\" http://0.0.0.0:$PORT \"cypress run --config baseUrl=http://0.0.0.0:$PORT --spec cypress/e2e/$APP.cy.ts\"",
"test-all": "for app in repro rails calendar demo; do APP=$app PORT=8080 npm run test; done",
"test-open": "start-test \"bundle exec pagy $APP -p $PORT\" http://0.0.0.0:$PORT \"cypress open\""
"lint-fix": "eslint --fix cypress --ext .ts"
}
}
27 changes: 27 additions & 0 deletions e2e/test-e2e
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -e

app=$1
port=${2:-8080}

cd -- "$(dirname "$0")"

test () {
start-test "bundle exec pagy $app -p $port -q" http://0.0.0.0:$port "cypress run --quiet --config baseUrl=http://0.0.0.0:$port --spec cypress/e2e/$app.cy.ts"
}

if [[ -z $app ]]
then
for app in demo repro rails calendar
do
port=$[port+1]
test &
done
for p in $(jobs -p)
do
wait "$p" || { echo ">>> Test job $p failed! (check above for failures)" >&2; exit 1; }
done
else
test
fi
10 changes: 10 additions & 0 deletions e2e/test-e2e-open
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e

app=$1
port=${2:-8080}

cd -- "$(dirname "$0")"

start-test "bundle exec pagy $app -p $port" http://0.0.0.0:$port "cypress open"
1 change: 0 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
}
},
"scripts": {
"build": "./build.sh",
"lint-fix": "eslint . --fix --ext .ts"
}
}

0 comments on commit c255321

Please sign in to comment.