-
Notifications
You must be signed in to change notification settings - Fork 10
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
'Codeless' UI test generation #884
Conversation
termhub-vocab
Outdated
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.
IDK how/why this got committed again
## to write tests that are theoretically compatible in any environment (as long as the UI is the same). The only | ||
## difference is that when the test code is written, the first line will hard-code the URL to that environment. So | ||
## after recording, the code should be repuprosed in the style of frontend/tests/. | ||
codegen-local: |
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.
New "codeless test generation" commands
I added some documentation on how to use them and what they are in the makefile
.
These are basically a wrapper for:
yarn playwright codegen URL
@@ -0,0 +1,13 @@ | |||
// UTILS | |||
/* Used to convert input to be same as graphology serialization (all strings). */ | |||
function convertToArrayOfStrings(matrix) { |
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.
Refactored this func into a tests/utils.js
file
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.
New tests: WIP
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.
General findings for "Codeless UI test generation"
It's not perfect. For example, I want to select something by ID or position... but when I click it using the recording feature, it gives me things like this instead:
await page.getByRole('row', { name: 'Expand Row CARDIOMYOPATHIES' })
await page.getByRole('link', { name: '12 removed , 12 added' }).click();
There are also some other caveats:
- When you copy/paste the code it generates into your test file, you should change the hard-coded URL to
appUrl
instead:await page.goto(appUrl);
- It doesn't write assertions for you. You have to do that yourself.
- As shown above, oftentimes what you want (select things by ID, position) is not what it does.
0608456
to
57b9bf4
Compare
- Add: Makefile commands to use 'playright codegen' - Add: New test file for N3C recommended (WIP) - Add: frontend/tests/utils.js (refactored func into here from another file)
57b9bf4
to
9b718e1
Compare
Changes
'Codeless' UI test generation