Skip to content

Commit

Permalink
Run ui script from e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmicu committed Jul 18, 2023
1 parent b9c9f4e commit 278054b
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 6 deletions.
42 changes: 41 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,50 @@ jobs:
- name: Run e2e test
run: timeout 2400 bats "e2e/$E2E_TEST"

ui_test:
runs-on: ${{ matrix.os }}
needs: [build_dfx]
strategy:
matrix:
os: [macos-11, ubuntu-20.04]
rust: ['1.60.0']
steps:
- name: Checking out repo
uses: actions/checkout@v2
- name: Setting up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Installing playwright
run: |
pip install playwright==1.35.0
playwright install
- name: Download dfx binary
uses: actions/download-artifact@v2
with:
name: dfx-${{ matrix.os }}-rs-${{ matrix.rust }}
path: /usr/local/bin
- name: Setup dfx binary
run: chmod +x /usr/local/bin/dfx
- name: Deploy default dfx project
run: |
dfx new e2e_project
cd e2e_project
dfx start --background --clean
dfx deploy 2>&1 | tee deploy.log
echo FRONTEND_URL=$(grep "_frontend:" deploy.log | grep -Eo "(http|https)://[a-zA-Z0-9./?=_&%:-]*") >> $GITHUB_ENV
echo CANDID_URL=$(grep "_backend:" deploy.log | grep -Eo "(http|https)://[a-zA-Z0-9./?=_&%:-]*") >> $GITHUB_ENV
- name: Running the Python script
run: |
python scripts/test-uis.py \
--frontend_url "$FRONTEND_URL" \
--candid_url "$CANDID_URL" \
--browser chromium firefox webkit
aggregate:
name: e2e:required
if: ${{ always() }}
needs: [test, smoke]
needs: [test, smoke, ui_test]
runs-on: ubuntu-latest
steps:
- name: check smoke test result
Expand Down
27 changes: 22 additions & 5 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,37 @@ validate_default_project() {
export hello_world_frontend_url="http://localhost:$webserver_port/?canisterId=$hello_world_frontend_canister_id"
export candid_ui_url="http://localhost:$webserver_port/?canisterId=$candid_ui_id&id=$application_canister_id"

pip install playwright==1.35.0

echo
echo "=================================================="
echo "dfx project directory: $(pwd)"
echo "frontend URL: $hello_world_frontend_url"
echo "candid URL: $candid_ui_url"
echo "=================================================="
echo
echo "Verify the Python script output."
echo "[1/4] Verify 'hello' functionality in a browser."
echo " - Open this URL in your web browser with empty cache or 'Private Browsing' mode"
echo " - Type a name and verify the response."
echo
echo " $hello_world_frontend_url"
echo
wait_for_response 'frontend UI passes'
echo
echo "[2/4] Verify there are no errors in the console by opening the Developer Tools."
echo
wait_for_response 'no errors on console'
echo
echo "[3/4] Verify the Candid UI."
echo
echo " - Open this URL in your web browser with empty cache or 'Private Browsing' mode"
echo " - Verify UI loads, then test the greet function by entering text and clicking *Call* or clicking *Lucky*"
echo
echo " $candid_ui_url"
echo
wait_for_response 'candid UI passes'
echo
python3 scripts/test-uis.py --frontend_url "$hello_world_frontend_url" --candid_url "$candid_ui_url" --browsers chromium firefox webkit
echo "[4/4] Verify there are no errors in the console by opening the Developer Tools."
echo
wait_for_response 'Python script logs are ok'
wait_for_response 'no errors on console'
echo

dfx stop
Expand Down

0 comments on commit 278054b

Please sign in to comment.