-
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import {selectedConfigs, deploymentConfigs} from "./setup-test-environments"; | ||
// const { test, expect } = require('@playwright/test'); | ||
import {test, expect, } from '@playwright/test'; | ||
|
||
// Tests --------------------------------------------------------------------------------------------------------------- | ||
let timeout = 20000; | ||
|
||
// todo temp: toggle comment for development | ||
// for (const envName of ['dev']) { | ||
for (const envName in selectedConfigs) { | ||
|
||
const appUrl = deploymentConfigs[envName]; | ||
|
||
test('N3C Recommended', async ({ page }) => { | ||
await page.goto(appUrl); | ||
await page.goto(appUrl + '/OMOPConceptSets'); | ||
|
||
await page.getByTestId('Help / About').click(); | ||
await page.getByRole('link', { name: 'N3C Recommended', exact: true }).click(); | ||
// TODO: make some assertions | ||
}); | ||
|
||
test('N3C Recommended comparison', async ({ page }) => { | ||
await page.goto(appUrl); | ||
await page.goto(appUrl + '/OMOPConceptSets'); | ||
|
||
await page.getByTestId('Help / About').click(); | ||
await page.getByRole('link', { name: 'N3C Recommended comparison' }).click(); | ||
// todo: maybe try to dynamically select whatever row it is that has changes, rather than static case | ||
await page.getByRole('row', { name: 'Expand Row CARDIOMYOPATHIES' }).getByTestId('expander-button-undefined').click(); | ||
// TODO: how to select the table dynamically? I want to assert that it shows rows are removed an added | ||
// - but the selector id is really weird: <div class="sc-jXbUNg cyUjzM rdt_ExpanderRow">. has another <div>, then | ||
// another <p>, then a <table id="n3ccompdiff"> | ||
// Ahhh! We need unique IDs. It should be something like "n3ccompdiff-removed-CARDIOMYOPATHIES" (or whatever the | ||
// cset ID for that is). | ||
// TODO: After solving the above, assert rows added/removed | ||
|
||
// TODO: Next, find some way to dynamically select the hyperink in the rightmost column | ||
// TODO: What do I expect to happen next? it says "downloading..." | ||
await page.getByRole('link', { name: '12 removed , 12 added' }).click(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// UTILS | ||
/* Used to convert input to be same as graphology serialization (all strings). */ | ||
function convertToArrayOfStrings(matrix) { | ||
var stringMatrix = []; | ||
for (var i = 0; i < matrix.length; i++) { | ||
var stringRow = []; | ||
for (var j = 0; j < matrix[i].length; j++) { | ||
stringRow.push(matrix[i][j].toString()); | ||
} | ||
stringMatrix.push(stringRow); | ||
} | ||
return stringMatrix; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,20 @@ test-frontend-e2e-dev: | |
test-frontend-e2e-prod: | ||
(cd frontend; \ | ||
ENVIRONMENTS=prod ${TEST_FRONTEND_CMD}) | ||
## - codegen: "codeless" Playwright generation of UI tests by recording browser interaction | ||
## You don't need to use 'local' necessarily if you want to write the tests for local. Any of these commands can work | ||
## 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 commentThe reason will be displayed to describe this comment to others. Learn more. New "codeless test generation" commandsI added some documentation on how to use them and what they are in the These are basically a wrapper for: |
||
(cd frontend; \ | ||
yarn playwright codegen https://localhost:3000) | ||
codegen-dev: | ||
(cd frontend; \ | ||
yarn playwright codegen https://icy-ground-0416a040f.2.azurestaticapps.net) | ||
codegen-prod: | ||
(cd frontend; \ | ||
yarn playwright codegen https://purple-plant-0f4023d0f.2.azurestaticapps.net) | ||
|
||
# QC | ||
fetch-missing-csets: | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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