-
Notifications
You must be signed in to change notification settings - Fork 5
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 tests for the AOI feature specification #1216
Conversation
on how to run the tests
✅ Deploy Preview for veda-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hi @stephenkilbourn 👋 Thanks for setting up playwright and the basic functionality to test the explore page! It was very useful! |
|
||
test('User selects a pre-defined AOI', async ({ page }) => { | ||
// When I select the "Analyze an area" tool (Dropdown menu) | ||
const toolbar = page.getByTestId('preset-selector'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can update the explorePage.ts to use this better locator
app/scripts/components/exploration/components/map/analysis-message-control.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great @AliceR ! I'm happy that they are proving useful and you're brave enough to be the first one to take this on.
I added a few suggestions. I got it passing locally with getting the testid rendering in the analysis message and tweaking the assertion. If anything is confusing, let me know and I can chat via slack.
make steps appear in report, use better locators and validators, add expectations verbose, ...
@@ -14,7 +14,7 @@ export default class ExplorePage { | |||
this.mapboxCanvas = this.page.getByLabel('Map', { exact: true }); | |||
this.firstDatasetItem = this.page.getByRole('article'); | |||
this.closeFeatureTourButton = this.page.getByRole('button', { name: 'Close feature tour' }); | |||
this.presetSelector = this.page.locator('#preset-selector'); | |||
this.presetSelector = this.page.getByTestId('preset-selector'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was having to set this to get the parent for it to run.
const toolbar = page.locator('#preset-selector');
otherwise, the test would fail for me. I'd prefer to use your test Id if it is working for you, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any issues with using the test id. What exactly is the problem that you are seeing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests always fails unless I switch to locating by ID. I've attached the trace from what I see after syncing with origin and deleting and re-installing node_modules to try minimizing a chance of mismatch.
the only data-testid I see is on the analysis message
the select has the id, but no data-testid.
This is the test run with yarn playwright test exploreAoi.spec.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d like to go ahead and merge this PR now, if it works for you @stephenkilbourn. |
## 🎉 Features * Card image/description independent of hero image/description by @dzole0311 in #1244 ## 🚀 Improvements * Cookie consent code cleanup by @snmln in #1199 , and @hanbyul-here in #1240 , and @hanbyul-here in #1241 * Add ADR about design system change by @j08lue in #890 * Update condition to run playwright tests on release branches by @dzole0311 in #1228 * Update STYLE_GUIDE.md by @AliceR in #1227 * Fix lint configuration by @AliceR in #1219 * Add tests for the AOI feature specification by @AliceR in #1216 * Set data catalog filters to be closed by default by @vgeorge in #1243 * Update tsconfig and make nav interfaces exposable for consumption by @sandrahoang686 in #1223 ## 🐛 Fixes * Hotfix to hide the external link badge from cards by @dzole0311 in #1231 ## New Contributors * @vgeorge made their first contribution in #1243 **Full Changelog**: v5.9.0...v5.10.0
Related Ticket: #1207
Description of Changes
So far, added a first test for the scenario "User selects a pre-defined AOI". I'm adding some
data-testid
properties to relevant dom elements in order to select them in the test.Also, added some documentation on how to run the tests. @hanbyul-here if you want to try that on your machine, and let me know if it works?
Notes & Questions About Changes
more tests to be added
Validation / Testing
Follow the instructions added to the SETUP.md guide to run the tests locally. See if they pass!