-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: use test-ui.sh to run the tests
Use one single script called `./tools/test-ui.sh` to trigger all the different UI tests: - `COVERAGE=1` or `-c` to enable the code coverage - `COVE_VERSION` to set the vscode-extension-tester parameter (e.g `max` or `min`) - `MOCK_LIGHTSPEED_API` (`1` or ``): set it to `1` to dynamically start the mocked server and set `TEST_LIGHTSPEED_URL`
- Loading branch information
Showing
6 changed files
with
82 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -eux | ||
set -o pipefail | ||
|
||
cleanup() | ||
{ | ||
pkill -P $$ | ||
wait | ||
} | ||
|
||
trap "cleanup" HUP INT ABRT BUS TERM EXIT | ||
|
||
|
||
CODE_VERSION="${CODE_VERSION:-max}" | ||
TEST_LIGHTSPEED_URL="${TEST_LIGHTSPEED_URL:-}" | ||
COVERAGE="${COVERAGE:-}" | ||
EXTEST=./node_modules/.bin/extest | ||
START_SERVER_WITHTEST="npx start-server-and-test" | ||
MOCK_LIGHTSPEED_API="${MOCK_LIGHTSPEED_API:-}" | ||
|
||
|
||
|
||
OPTSTRING=":c" | ||
|
||
while getopts ${OPTSTRING} opt; do | ||
case ${opt} in | ||
c) | ||
echo "Coverage enabled" | ||
COVERAGE="1" | ||
;; | ||
?) | ||
echo "Invalid option: -${OPTARG}." | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
if [[ -n $COVERAGE ]]; then | ||
COVERAGE_ARG="--coverage" | ||
fi | ||
|
||
|
||
|
||
|
||
if [[ "$MOCK_LIGHTSPEED_API" != "" ]]; then | ||
if [[ -n "${TEST_LIGHTSPEED_URL}" ]]; then | ||
echo "the existing TEST_LIGHTSPEED_URL envvar will be ignored!" | ||
fi | ||
mkdir -p out/log | ||
TEST_LIGHTSPEED_ACCESS_TOKEN=dummy | ||
(DEBUG='express:*' node ./out/client/test/mockLightspeedServer/server.js >>out/log/express.log 2>&1 ) & | ||
sleep 5 | ||
TEST_LIGHTSPEED_URL=$(sed -n 's,.*Listening on port \([0-9]\+\) at \([.0-9]\+\).*,http://\2:\1,p' out/log/express.log|tail -n1) | ||
fi | ||
|
||
|
||
# Start the mock Lightspeed server and run UI tests with the new VS Code | ||
|
||
${EXTEST} get-vscode -c "${CODE_VERSION}" -s out/test-resources | ||
${EXTEST} get-chromedriver -c "${CODE_VERSION}" -s out/test-resources | ||
if [[ "$COVERAGE" == "" ]]; then | ||
${EXTEST} install-vsix -f ansible-*.vsix -e out/ext -s out/test-resources | ||
fi | ||
${EXTEST} install-from-marketplace redhat.vscode-yaml ms-python.python -e out/ext -s out/test-resources | ||
|
||
|
||
export TEST_LIGHTSPEED_URL | ||
export TEST_LIGHTSPEED_ACCESS_TOKEN | ||
|
||
${EXTEST} run-tests "${COVERAGE_ARG}" -s out/test-resources -e out/ext --code_settings test/testFixtures/settings.json out/client/test/ui-test/allTestsSuite.js |