-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨E2E: add playwright sleepers test in CI (#5177)
- Loading branch information
Showing
11 changed files
with
417 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | ||
# https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-on-travis-ci | ||
set -o errexit # abort on nonzero exitstatus | ||
set -o nounset # abort on unbound variable | ||
set -o pipefail # don't hide errors within pipes | ||
IFS=$'\n\t' | ||
|
||
# in case it's a Pull request, the env are never available, default to itisfoundation to get a maybe not too old version for caching | ||
DOCKER_IMAGE_TAG=$(exec ci/helpers/build_docker_image_tag.bash) | ||
export DOCKER_IMAGE_TAG | ||
|
||
install() { | ||
make devenv | ||
source .venv/bin/activate | ||
pushd tests/e2e-playwright | ||
make install-ci-up-simcore | ||
popd | ||
} | ||
|
||
test() { | ||
source .venv/bin/activate | ||
pushd tests/e2e-playwright | ||
make test-sleepers | ||
popd | ||
} | ||
|
||
dump_docker_logs() { | ||
# get docker logs | ||
# NOTE: Timeout avoids issue with dumping logs that hang! | ||
out_dir=tests/e2e-playwright/test_failures | ||
mkdir --parents "$out_dir" | ||
|
||
for service_id in $(docker service ls -q); do | ||
service_name=$(docker service inspect "$service_id" --format="{{.Spec.Name}}") | ||
echo "Dumping logs for $service_name" | ||
(timeout 30 docker service logs --timestamps --tail=400 --details "$service_id" >"$out_dir/$service_name.log" 2>&1) || true | ||
done | ||
} | ||
|
||
# Check if the function exists (bash specific) | ||
if declare -f "$1" >/dev/null; then | ||
# call arguments verbatim | ||
"$@" | ||
else | ||
# Show a helpful error | ||
echo "'$1' is not a known function name" >&2 | ||
exit 1 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
docker | ||
faker | ||
pydantic[email] | ||
pytest-html | ||
pytest-instafail | ||
pytest-playwright | ||
pytest-runner | ||
pytest-sugar | ||
pyyaml | ||
tenacity |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import pytest | ||
|
||
|
||
def pytest_addoption(parser: pytest.Parser) -> None: | ||
group = parser.getgroup( | ||
"oSparc e2e options", description="oSPARC-e2e specific parameters" | ||
) | ||
group.addoption( | ||
"--num-sleepers", | ||
action="store", | ||
type=int, | ||
default=2, | ||
help="URL pointing to the deployment to be tested", | ||
) | ||
|
||
group.addoption( | ||
"--input-sleep-time", | ||
action="store", | ||
type=int, | ||
default=None, | ||
help="URL pointing to the deployment to be tested", | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def num_sleepers(request: pytest.FixtureRequest) -> int: | ||
num = request.config.getoption("--num-sleepers") | ||
assert isinstance(num, int) | ||
return num | ||
|
||
|
||
@pytest.fixture | ||
def input_sleep_time(request: pytest.FixtureRequest) -> int | None: | ||
sleep_time = request.config.getoption("--input-sleep-time") | ||
return sleep_time |
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
Oops, something went wrong.