-
Notifications
You must be signed in to change notification settings - Fork 4
[WIP] PEPPER-733-kit-upload-test-for-rgp #2088
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8ec90b4
PEPPER-733-kit-upload-test-for-rgp
Rinchan20 77664f0
Update kitUpload-page.ts
Rinchan20 b966c18
added needed stuff to get to kit upload page
Rinchan20 8d73544
changed selector to use xpath
Rinchan20 93bc1e1
Update kitUpload-page.ts
Rinchan20 25b7333
implementing feedback
Rinchan20 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
3 changes: 2 additions & 1 deletion
3
playwright-e2e/lib/component/dsm/navigation/enums/mainMenu.enum.ts
This file contains hidden or 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export enum MainMenu { | ||
STUDY = 'Study', | ||
SELECTED_STUDY = 'Selected study', | ||
MISCELLANEOUS = 'Miscellaneous' | ||
MISCELLANEOUS = 'Miscellaneous', | ||
SAMPLES = 'Samples' | ||
} |
22 changes: 22 additions & 0 deletions
22
playwright-e2e/lib/component/dsm/navigation/enums/samplesNav.enum.ts
This file contains hidden or 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,22 @@ | ||
export enum SamplesMenu { | ||
UNSENT_KITS_OVERVIEW = 'Unsent Kits Overview', | ||
REPORT = 'Report', | ||
SUMMARY = 'Summary', | ||
KITS_WITHOUT_LABELS = 'Kits without Labels', | ||
QUEUE = 'Queue', | ||
ERROR = 'Error', | ||
INITIAL_SCAN = 'Initial Scan', | ||
TRACKING_SCAN = 'Tracking Scan', | ||
FINAL_SCAN = 'Final Scan', | ||
RGP_FINAL_SCAN = 'RGP Final Scan', | ||
DISCARD_SAMPLE = 'Discard Sample', | ||
SENT = 'Sent', | ||
RECEIVED = 'Received', | ||
SENT_RECEIVED_OVERVIEW = 'Sent/Received Overview', | ||
DEACTIVATED = 'Deactivated', | ||
SEARCH = 'Search', | ||
KIT_UPLOAD = 'Kit Upload', | ||
STOOL_SAMPLE_UPLOAD = 'Stool Sample Upload', | ||
LABEL_SETTINGS = 'Label Settings', | ||
CLINICAL_ORDERS = 'Clinical Orders' | ||
} |
This file contains hidden or 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
6 changes: 6 additions & 0 deletions
6
playwright-e2e/lib/component/dsm/samples/enums/kitType.enum.ts
This file contains hidden or 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,6 @@ | ||
//Inputting the various kit types that can be uploaded in DSM | ||
//todo Update as needed as more kit upload tests are created | ||
export enum KitType { | ||
BLOOD = 'BLOOD', | ||
BLOOD_AND_RNA = 'BLOOD & RNA' | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,15 @@ | ||
import { Page } from '@playwright/test'; | ||
import PageBase from 'pages/page-base'; | ||
|
||
/** | ||
* Data Study Manager (DSM) page base | ||
*/ | ||
export abstract class DSMPageBase extends PageBase { | ||
protected constructor(page: Page) { | ||
const { DSM_BASE_URL } = process.env; | ||
if (DSM_BASE_URL == null) { | ||
throw Error(`Invalid DSM base URL: process.env.DSM_BASE_URL=${DSM_BASE_URL}`); | ||
} | ||
super(page, DSM_BASE_URL); | ||
} | ||
} |
This file contains hidden or 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 hidden or 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,64 @@ | ||
import { expect, Locator, Page } from '@playwright/test'; | ||
import { KitType } from 'lib/component/dsm/samples/enums/kitType.enum' | ||
|
||
export default class KitUploadPage { | ||
private readonly PAGE_TITLE: string = 'Kit Upload'; | ||
constructor(private readonly page: Page) {} | ||
|
||
public getPageTitle(): Locator { | ||
return this.page.getByRole('heading', { name: this.PAGE_TITLE}); | ||
} | ||
|
||
public getKitTypeOption(kitType: KitType): Locator { | ||
const kitOption = this.page.locator(`//mat-checkbox/label[span[normalize-space(text()) = '${kitType}']]`); | ||
return kitOption; | ||
} | ||
|
||
//This option only appears to some study admins based on permissions - so I have a getter here | ||
//so I can use it to verify display of option and also select option later | ||
public getSkipAddressValidationOption(): Locator { | ||
return this.page.locator('label').filter({ hasText: 'Skip address validation on upload' }); | ||
} | ||
|
||
//todo add assertion for display of button | ||
public getBrowseButton(): Locator { | ||
return this.page.getByText('Browse...'); | ||
} | ||
|
||
//todo add assertion for display of button | ||
private getUploadButton(): Locator { | ||
return this.page.getByRole('button', { name: 'Upload Kits' }); | ||
} | ||
|
||
public async selectKitUploadButton(): Promise<void> { | ||
const kitUploadButton = this.getUploadButton(); | ||
await kitUploadButton.click(); | ||
} | ||
|
||
//todo maybe add assertion for the webelements of the popup | ||
public getKitUploadConfirmationPopUp(): Locator { | ||
return this.page.locator('app-modal div').filter({ hasText: 'Please select the participant for which you want to upload a new one'}).nth(3); | ||
} | ||
|
||
public async selectAddNewKitForParticipantOption(guid: string, shortID: string, firstName: string, lastName: string): Promise<void> { | ||
const participantKit = this.page.getByText(`Participant already has a kit. '${guid}' '${shortID}' '${firstName}' '${lastName}'`); | ||
await participantKit.check(); | ||
} | ||
|
||
public async closeKitConfirmationPopUp(): Promise<void> { | ||
const closeButton = this.page.getByRole('button', { name: 'Close' }); | ||
await closeButton.click(); | ||
} | ||
|
||
public async confirmKitUpload(): Promise<void> { | ||
const updateKitsButton = this.page.getByRole('button', { name: 'Upload Kit', exact: true}); | ||
await updateKitsButton.click(); | ||
} | ||
|
||
public async assertKitUploadConfirmationMessage(): Promise<void> { | ||
const verficationMessage = this.page.getByRole('heading', { name: 'All participants were uploaded.'}); | ||
await expect(verficationMessage).toBeVisible(); | ||
} | ||
|
||
//to-do add screenshot verification for the kit upload instructions | ||
} |
This file contains hidden or 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,58 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
import { login } from 'authentication/auth-dsm'; | ||
import HomePage from 'pages/dsm/home-page'; | ||
import { Navigation } from 'lib/component/dsm/navigation/navigation'; | ||
import { WelcomePage } from 'pages/dsm/welcome-page'; | ||
import { Study } from 'lib/component/dsm/navigation/enums/selectStudyNav.enum'; | ||
import KitUploadPage from 'pages/dsm/kitUpload-page'; | ||
import { SamplesMenu } from 'lib/component/dsm/navigation/enums/samplesNav.enum'; | ||
import { KitType } from 'lib/component/dsm/samples/enums/kitType.enum' | ||
import { Titles } from 'pages/dsm/home-page'; | ||
|
||
|
||
test.describe.serial('RGP Kit Upload', () => { | ||
let welcomePage: WelcomePage; | ||
let homePage: HomePage; | ||
let navigation: Navigation; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await login(page); | ||
welcomePage = new WelcomePage(page); | ||
homePage = new HomePage(page); | ||
navigation = new Navigation(page); | ||
}); | ||
|
||
//Test the Kit Upload page protion of the the process | ||
test('Can upload a Blood & RNA kit via Kit Upload page @functional @rgp', async ({ page }) => { | ||
//Go to DSM in order to do a kit upload (type: "BLOOD & RNA") | ||
await welcomePage.selectStudy(Study.RGP); | ||
|
||
const welcomeTitle = homePage.welcomeTitle; | ||
const studySelection = homePage.studySelectionTitle; | ||
const rgpStudySelectionText = homePage.getStudySelectionText('RGP'); | ||
|
||
//DSM homepage assertions | ||
await expect(welcomeTitle).toHaveText(Titles.WELCOME); | ||
await expect(studySelection).toHaveText(rgpStudySelectionText); | ||
|
||
//Kit Upload page navigation: (Samples -> Kit Upload) | ||
const kitUploadPage = await navigation.selectFromSamples<KitUploadPage>(SamplesMenu.KIT_UPLOAD); | ||
const kitUploadPageTitle = kitUploadPage.getPageTitle(); | ||
await expect(kitUploadPageTitle).toBeVisible(); | ||
|
||
//Select the "Blood and RNA" kit type | ||
const bloodRNAKit = kitUploadPage.getKitTypeOption(KitType.BLOOD_AND_RNA); | ||
await bloodRNAKit.check(); | ||
await expect(bloodRNAKit).toBeChecked(); | ||
|
||
const skipAddressValidationOption = kitUploadPage.getSkipAddressValidationOption(); | ||
|
||
//This test is with a study admin who has permissions to see the skip address validation option | ||
//This test is also using a valid address - so the option will not be selected here | ||
//todo add test to ensure invalid address is accepted if address validation is skipped | ||
await expect(skipAddressValidationOption).toBeVisible(); | ||
|
||
const browseButton = kitUploadPage.getBrowseButton(); | ||
await expect(browseButton).toBeVisible(); | ||
}) | ||
}) |
2 changes: 2 additions & 0 deletions
2
playwright-e2e/utils/templates/kitUploadTemplates/kit-upload-template-one-participant.txt
This file contains hidden or 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,2 @@ | ||
participantId shortId firstName lastName street1 street2 city postalCode state country | ||
family_account_guid family_member_subject_id family_member_first_name family_member_last_name address_line_one optional_address_line_two city_of_residence zipcode_of_residence state_or_province_of_residence country_of_residence |
This file contains hidden or 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
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.
I think we want the assertions to live inside the tests, but use the page classes to return values. So maybe have the home page return the study title or the welcome title, and then make the assertion in this file.