-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add E2E tests for chromium and firefox (#1121)
* feat: add E2E tests for chromium and firefox * fix: do not use arrow functions in mocha * feat: create a workflow for running e2e tests * chore: apply review comments * chore: support override of firefox image * fix(test): await async destroy operation * chore: address review comments - replace fixed delays with exponential backoff - make download-release-artifacts.sh work even if build dir already exists - document how to run e2e tests locally - delete user/group if it already exists during release build in docker - make it easier to add new e2e test cases in the future * chore: allow overriding access control settings through env * Update docs/DEVELOPER-NOTES.md Co-authored-by: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Co-authored-by: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com>
- Loading branch information
Showing
11 changed files
with
491 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: e2e | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
firefox-version: | ||
description: The version of selenium/standalone-firefox image to use | ||
default: latest | ||
required: true | ||
chromium-version: | ||
description: The version of selenium/standalone-chrome image to use | ||
default: latest | ||
required: true | ||
kubo-version: | ||
description: The version of ipfs/kubo image to use | ||
default: latest | ||
required: true | ||
ipfs-companion-version: | ||
description: The version of ipfs-companion extension to use (defaults to building the extension from source) | ||
default: '' | ||
required: false | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repo | ||
uses: actions/checkout@v3 | ||
- name: Set up node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Download ipfs-companion | ||
if: inputs.ipfs-companion-version != '' | ||
run: ./ci/download-release-artifacts.sh | ||
env: | ||
IPFS_COMPANION_VERSION: ${{ inputs.ipfs-companion-version }} | ||
- name: Build ipfs-companion | ||
if: inputs.ipfs-companion-version == '' | ||
run: npm run release-build | ||
- name: Prepare E2E env | ||
run: npm run compose:e2e:prepare | ||
env: | ||
FIREFOX_VERSION: ${{ inputs.firefox-version }} | ||
CHROMIUM_VERSION: ${{ inputs.chromium-version }} | ||
KUBO_VERSION: ${{ inputs.kubo-version }} | ||
- name: Start E2E env | ||
run: npm run compose:e2e:up | ||
env: | ||
FIREFOX_VERSION: ${{ inputs.firefox-version }} | ||
CHROMIUM_VERSION: ${{ inputs.chromium-version }} | ||
KUBO_VERSION: ${{ inputs.kubo-version }} | ||
- name: Wait for E2E env set up to complete | ||
run: sleep 60 | ||
- name: Run E2E tests | ||
run: npm run compose:e2e:test | ||
env: | ||
IPFS_COMPANION_VERSION: ${{ inputs.ipfs-companion-version }} | ||
- name: Stop E2E env | ||
run: npm run compose:e2e:down |
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,5 @@ | ||
#!/bin/sh | ||
set -ex | ||
|
||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "${ACCESS_CONTROL_ALLOW_ORIGIN:-[\"*\"]}" | ||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "${ACCESS_CONTROL_ALLOW_METHODS:-[\"*\"]}" |
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,15 @@ | ||
#!/bin/sh | ||
set -ex | ||
|
||
IPFS_COMPANION_VERSION=${IPFS_COMPANION_VERSION:-$(jq -r '.version' ./add-on/manifest.common.json)} | ||
|
||
id="$(curl --retry 5 --no-progress-meter "https://api.github.com/repos/ipfs/ipfs-companion/releases/tags/v$IPFS_COMPANION_VERSION" | jq '.id')" | ||
assets="$(curl --retry 5 --no-progress-meter --location "https://api.github.com/repos/ipfs/ipfs-companion/releases/$id/assets" | jq -r '.[].name')" | ||
|
||
if [[ ! -d build ]]; then | ||
mkdir build | ||
fi | ||
|
||
for asset in $assets; do | ||
curl --retry 5 --no-progress-meter --location --output "build/$asset" "https://github.com/ipfs/ipfs-companion/releases/download/v$IPFS_COMPANION_VERSION/$asset" | ||
done |
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,39 @@ | ||
version: "3.9" | ||
services: | ||
firefox: | ||
image: ${FIREFOX_IMAGE:-selenium/standalone-firefox}:${FIREFOX_VERSION:-latest} | ||
shm_size: 2g | ||
ports: | ||
- 4444 | ||
- 7900 | ||
chromium: | ||
# WARN: `standalone-chrome` does NOT work on ARM-based machines; | ||
# see https://github.com/SeleniumHQ/docker-selenium#experimental-mult-arch-aarch64armhfamd64-images; | ||
# try using `seleniarm/standalone-chromium` instead | ||
# export CHROMIUM_IMAGE=seleniarm/standalone-chromium | ||
image: ${CHROMIUM_IMAGE:-selenium/standalone-chrome}:${CHROMIUM_VERSION:-latest} | ||
shm_size: 2g | ||
ports: | ||
- 4444 | ||
- 7900 | ||
kubo: | ||
image: ipfs/kubo:${KUBO_VERSION:-latest} | ||
ports: | ||
- 4001 | ||
- 5001 | ||
- 8080 | ||
volumes: | ||
- ./ci/access-control-allow-all.sh:/container-init.d/001-access-control-allow-all.sh | ||
e2e: | ||
build: | ||
dockerfile: ./Dockerfile | ||
environment: | ||
- SELENIUM_REMOTE_CHROMIUM_URL=http://chromium:4444 | ||
- SELENIUM_REMOTE_FIREFOX_URL=http://firefox:4444 | ||
- IPFS_API_URL=http://kubo:5001 | ||
- CUSTOM_GATEWAY_URL=http://kubo:8080 | ||
- TEST_E2E=true | ||
- TEST_HEADLESS=${TEST_HEADLESS:-false} | ||
- IPFS_COMPANION_VERSION=${IPFS_COMPANION_VERSION} | ||
volumes: | ||
- ./build:/home/node/app/build |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.