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 tests for mapper flow #1766

Merged
merged 13 commits into from
Sep 11, 2024

Conversation

NSUWAL123
Copy link
Contributor

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 the following works:

  • Status not showing issue on task popup
  • Mapper flow test
  • Entity Feature map

Screenshots

image_720

@github-actions github-actions bot added enhancement New feature or request frontend Related to frontend code tests Related to automated code tests labels Sep 3, 2024
Copy link
Member

@spwoodcock spwoodcock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

A few other things to check could be:

  • Adding a comment works
  • Reading the comment on the tab

In future I am wondering if it's possible to make a mock form submission too, so we can do the next round of tests (check the submission download, validator workflow, etc) - a future PR

(Update: to do the above we can replicate something like this https://forum.getodk.org/t/creating-fake-odk-data/26144/3
using JavaScript instead of Python. We simply need to POST some pre-generated XML data to the ODK Central submission API)

@@ -0,0 +1,68 @@
import { test, expect } from '@playwright/test';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was checking the test ordering for Playwright
https://playwright.dev/docs/next/test-parallel#control-test-order

It seems they simply run in alphabetical order of the files, so with that in mind I think we should append numbers to some tests like:

  • 0-project-create.spec.ts
  • 1-mapper-workflow.spec.ts

This should mean that the project is created first, then the project page can be viewed and tests carried out there

});
await expect(page.getByRole('heading', { name: 'Feature:' })).toBeVisible();
await expect(page.getByRole('button', { name: 'MAP FEATURE IN ODK' })).toBeEnabled();
await page.getByRole('button', { name: 'MAP FEATURE IN ODK' }).click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this click I think we should expect a console warning that the redirect to protocol odkcollect:// failed (it attempts to open the link via mobile intent).

We could set a console listener via playwright and check this warning is displayed (it's not a user facing thing, but it helps check the button works as intended)

@spwoodcock spwoodcock changed the title Feat/mapper flow test Add Playwright tests for mapper flow Sep 11, 2024
@spwoodcock spwoodcock merged commit 315d369 into hotosm:development Sep 11, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend Related to frontend code tests Related to automated code tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants