Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Playwright test for project creation workflow #1700

Merged
merged 65 commits into from
Aug 1, 2024

Conversation

NSUWAL123
Copy link
Contributor

@NSUWAL123 NSUWAL123 commented Jul 24, 2024

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation
  • πŸ§‘β€πŸ’» Refactor
  • βœ… Test
  • πŸ€– Build or CI
  • ❓ Other (please specify)

Related Issue

Describe this PR

This PR contains works to test create project workflow.

Screenshots

Screencast.from.24-7-24.01.18.24.+0545.webm

Comment

From @spwoodcock: added multiple variants of running the tests:

    "test:e2e": "CI=1 playwright test",
    "test:e2e-report": "playwright test",
    "test:e2e-debug": "playwright test --debug",
    "test:e2e-interactive": "playwright open http://fmtm.dev.test",
  • test:e2e is the standard test that runs until completion, without starting the report UI.
  • test:e2e-report starts the report UI afterwards to see the test output and traces.
  • test:e2e-debug runs the browser in --headful mode (i.e. with a browser), allowing us to step through the test and see what it actually does in the UI.
  • test:e2e-interactive also starts a web browser, but this time with a recording option, allowing us to write tests by recording the clicks we make on the UI.

All test also produce a trace.zip, which is a very helpful functionality to debug why a test may have failed:

  • Go to a failed workflow: https://github.com/hotosm/fmtm/actions/runs/10198097237
  • Download the artifact playwright-report.zip.
  • Open the index.html file to view the report.
  • Extract the .zip file under data to get the traces.
  • Go to https://trace.playwright.dev and uploaded the extracted traces.
  • Step through the tests, with screenshots of the UI at a given point, plus logs of the network tab and console logs!

image

@NSUWAL123 NSUWAL123 requested a review from spwoodcock July 24, 2024 07:36
@github-actions github-actions bot added frontend Related to frontend code devops Related to deployment or configuration contrib labels Jul 24, 2024
@NSUWAL123
Copy link
Contributor Author

@spwoodcock, have a look on this create project test. Please comment if there more assertions are to be made in this workflow. This test only test one flow.

@spwoodcock spwoodcock changed the title Feat/create project test Add Playwright test for project creation workflow Jul 24, 2024
@spwoodcock spwoodcock force-pushed the feat/create-project-test branch 2 times, most recently from 6ed561f to d828d70 Compare July 25, 2024 15:04
@spwoodcock
Copy link
Member

It rebased this with development.

@NSUWAL123 please:

  • Stash any changes you may have made since: git stash -u
  • Reset the branch to current state: `git reset --hard origin/feat/create-project-test
  • Continue working on the branch πŸ‘

@spwoodcock
Copy link
Member

spwoodcock commented Jul 25, 2024

I updated the docker networking and vars for this to work better.

You should be able to run:

just --unstable test frontend
# To see the browser and do interactive test recording
just --unstable test frontend-interactive

Alternatively the direct command is:

docker compose \
    -f docker-compose.yml \
    -f contrib/playwright/docker-compose.yml \
  run --rm --service-ports ui-test

Note that the test data used generates 2376 features.
Wrote 2376 entities for project (3)
We should probably reduce this to about 20 or 30 features if possible?
Possibly with a smaller AOI if needed?
The test runs once per browser, so it will take forever otherwise!

@spwoodcock
Copy link
Member

I just need to update so this works in the CI now πŸ‘

@spwoodcock spwoodcock merged commit 2afc4d0 into development Aug 1, 2024
9 checks passed
@spwoodcock spwoodcock deleted the feat/create-project-test branch August 1, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend code devops Related to deployment or configuration frontend Related to frontend code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants