@pager/pgr-e2e v1.3.1
Pager E2E CLI
pgr-e2e is a command-line interface made with the purpose to run the automation suites in your local machine or integrate inside of a CI/CD pipeline
Installation
Before installing this package, be aware that you need to log in to the terminal with your npm session or have the secret key of Pager.
$ npm install @pager/pgr-e2e
Browser containers
Before running the tests, make sure to launch the docker-compose.grid.yml
to set up the Selenium Grid set of services. It can be launched with docker-compose -f docker-compose.grid.yml up
.
The containers can also be accessed through VNC so that they can be monitored. They listen for VNC connections on port 5900 within their network, but it's mapped to a dynamic one on the host machine, so that port is the one that should be used. To find out this port, you can use docker ps
.
The password to connect via VNC for all containers is secret
.
Options
Command | Shorcut | Type | Description |
---|---|---|---|
--version | -v | Boolean | Get your current version |
--env | -e | String | Specify the environment where you want to run the tests (localhost, sdx or stg) |
--org | -o | String | Specify the organization where you want to run the tests (sura, journi or horizon) |
--name | -n | String | Specify the name of the test user (soon!) |
--headless | -l | Boolean | Specify is you want to run the test in headless mode |
--publish | -p | Boolean | Is a flag to specify if you want to publish the results in TestRail (soon!) |
--feature | -f | String | Specify the feature that you want to run (soon!) |
--help | -h | Boolean | Show options |
Documentation
Command Center
panels
appointment
selectAppointmentButton(page)
This function selects the appointment button.
- page Playwright Page: The page where you are working on.
enterAppointmentDetails(page, options)
This funtion is to set the appoinment detail
- page Playwright Page: The page where you are working on.
botScript
searchScripts(page, scriptProcessObject)
Get the Patient row based on patient name displayed on the patient Queue
- page Playwright Page: The page where you are working on.
- script_process_object object: Object contqining 4 keys: 'patientName', 'searchString', 'scriptName', 'startScript'. Object Mock:
{ 'patientName':'qaautomation T', 'searchString':'back pain', 'scriptName':'[A] Back Pain - M', 'startScript': true }
endChat
fillEndChat(page, options)
Fill the End chat information based on object provided by user
- page Playwright Page: The page where you are working on.
isChatCovidRelatedCheckboxVisible(page)
Check if the Covid chat is visible.
- page Playwright Page: The page where you are working on.
insurance
suraInsuranceDetail(page)
This function returns sura insurance details.
- page Playwright Page: The page where you are working on.
members
getMembersDisplayedStatus(page)
This function returns the boolean depending on whether members are listed.
- page Playwright Page: The page where you are working on.
getMemberNameList(page)
This function returns all the member names in a list.
- page Playwright Page: The page where you are working on.
panel
openPanel(page, panelName)
This function will select any right side panel in CC.
- page Playwright Page: The page where you are working on.
- panelName string: This is the name of the panel.
closePanel(page)
This function will close any opened right side panel in CC.
- page Playwright Page: The page where you are working on.
teamHandoff
performHandoff(page, teamName, note, leaveChat)
This function will handoff a patient to another role.
- page Playwright Page: The page where you are working on.
adminOverview
getOverviewElement(page)
The method will get the admin overview object.
- page Playwright Page: The page where you are working on.
getOverviewHeader(page)
The method will get the admin overview header
- page Playwright Page: The page where you are working on.
getOverviewTeamObject(page)
The method will get the admin overview object
- page Playwright Page: The page where you are working on.
condensedView
expandOrCollapsePatientQueue(page, actionItem)
This Function click the arrow button in patient queue either to expand or collapse it. This Function verify whether the Patient queue is in expand or collapse view. Accordingly returns true OR false.
- page Playwright Page: The page where you are working on.
- actionItem string: 'collapse' OR 'expand'. By default collapse
verifyExpandOrCollapsePatientQueue(page, verifyView)
This Function verify whether the Patient queue is in expand or collapse view. Accordingly returns true OR false.
- page Playwright Page: The page where you are working on.
- actionItem string: 'collapse' OR 'expand'. By default collapse
getExpandCollapseButtonVisibleStatus(page)
This Function verify whether the expand or collapse arrow button is available in page and accordingly returns true OR False .
- page Playwright Page: The page where you are working on.
- actionItem string: 'collapse' OR 'expand'. By default collapse
getPatientRow(page, patientName, waitTime)
Get the Patient row based on patient name displayed on the patient Queue.
- page Playwright Page: The page where you are working on.
- patientName string: Name of the Patient.
selectNewChatButton(page, region)
To select a new patient or existing patient from the queue.
- page Playwright Page: The page where you are working on.
- region string: 'NYC' or 'RALEIGH'.
selectPatient(page, patientObject)
This Function select a patient from the queue, if PT is not available, it wil lselect from new chat button untill the PT displays in the queue.
- page Playwright Page: The page where you are working on.
selectFilterQueue(page, filterQueueName, snooze)
Select Filter tabs "All Chats", "My Chats", "Follow-ups".
- page Playwright Page: The page where you are working on.
- filterQueueName string: "All Chats", OR "My Chats" OR "Follow-ups".
getCardStatus(page, patient)
This method will get the Card status and return a object.
- page Playwright Page: The page where you are working on.
getHoverText(page, patient)
This method will get the hover text of an element.
- page Playwright Page: The page where you are working on.
patientQueue
getPatientRow(page, patient)
Get the Patient row based on patient name displayed on the patient Queue.
- page Playwright Page: The page where you are working on.
- patient string: patient id as string.
getPatientDetails(page, requireDetail, patient)
Get the Patient row details 'chatStatus', 'patientName', 'org', 'queue', 'patientList'.
- page Playwright Page: The page where you are working on.
- requireDetail object: which information need to get
- patient string: patient id as string.
selectPatient(page, patientObject, patient)
To select a new patient or existing patient from the queue.
- page Playwright Page: The page where you are working on.
- patientObject Object containing 3 keys: 'patientName', 'newPatient', 'patientRegion'.
- patient string: patient id as string.
getFilter(page, snooze)
Get Filter tabs "All Chats", "My Chats", "Follow-ups"
- page Playwright Page: The page where you are working on.
- snooze number: Number of miliseconds wants to asynch wait.
selectFilter(page, filterName, snooze)
This method will Select Filter tabs "All Chats", "My Chats", "Follow-ups"
- page Playwright Page: The page where you are working on.
- filterName string: pass the filter name which want to select.
- snooze number: Number of miliseconds wants to asynch wait.
selectSuraAdditionalFilter(page, filterName, snooze)
Select Sura additional Filter tabs "New", "New - Priority", "Severe", "Unread", "Other", "Other - Priority".
- filterName string: pass the filter name which want to select.
- snooze number: Number of miliseconds wants to asynch wait.
header
selectHeaderButton(page, buttonName)
To select any header buttons like Join.
- page Playwright Page: The page where you are working on.
- buttonName string: the button name you want to select.
logoutCC(page)
To Logout from Command Center.
- page Playwright Page: The page where you are working on.
login
ccLoginNew(page, user)
This method login with a new user into command center.
- page Playwright Page: The page where you are working on.
- user Object: User retrieved from the Automation API.
verifyCCLoginPage(page)
This method verify if in the specified page an user is logged in.
- page Playwright Page: The page where you are working on.
patientChat
sendChat(page, messageString)
This function sends a message from Command center to SDK.
- page Playwright Page: The page where you are working on.
- messageString string: Message to be sent to SDK.
getPreviousSentChats(page)
This function returns an array of chat messages available in chat history.
- page Playwright Page: The page where you are working on.
getLastSentChat(page, previousSentChatList)
This function returns the last chat message listed chat history in the CC.
- page Playwright Page: The page where you are working on.
- previousSentChatList Array: List of Messages listed chat history in the CC.
getLastNthChatList(page, lastNthIndex, selector)
This function returns the list of chat messages from the index till the last chat message listed chat history in the CC.
- page Playwright Page: The page where you are working on.
- lastNthIndex number: This is the index from bottom of the chat list from where, you want to get the chat list.
getMessageDisplayStatus(page, message, lastNthIndex, meta)
This function returns true / false if the message available in last few chats based on the index provided.
- page Playwright Page: The page where you are working on.
- message string: This is message that need to be verified.
- lastNthIndex number: This is the index from bottom of the chat list from where you want to get the chat list.
leaveChat(page)
This function select the leave chat in button.
- page Playwright Page: The page where you are working on.
initiateRecomendation(page, recomendationLink)
This function select the recomendation link in the chat history.
- page Playwright Page: The page where you are working on.
- recomendationLink string: Recomendation link in the chat history which need to be selected.
getLastAnnouncementMessage(page)
This function returns the last announcement message in the chat history.
- page Playwright Page: The page where you are working on.
postFollowUp
getPostFollowupBannerMessage(page)
This function returns a String from the post follow up page like: In order to chat with this user, you'll need to join the conversation first.
- page Playwright Page: The page where you are working on.
getPostFollowupHeaderList(page)
This function returns an Array from the post follow up page like: 'DETAILS', 'MESSAGE'
- page Playwright Page: The page where you are working on.
`getPostFollowupMessageObject(page)
This function returns an object from the post follow up page.
- page Playwright Page: The page where you are working on.
Web SDK
welcome
webSdkLogin(page)
To login inside webSDK
- page Playwright Page: The page where you are working on.
login
`getIntentFor(roleName)
Returns the triage object depending of the role and the enviornment
- roleName string: name of the role.
orgAuthenticate(page, authCode, authData)
Type the authentication info for patients login
- page Playwright Page: The page where you are working on.
playgroundWebSdk(page, triage, patient)
Function to login inside Web SDK
- page Playwright Page: The page where you are working on.
- triage Playwright Page: name of the role you want to create the intent.
- patient Object: the patient information retrieved from the API.
chat
getFrame(page)
This method will get a websdk frame and retrun the frame object
- page Playwright Page: The page where you are working on.
sendChat(page, message)
This method will select a method from the websdk
- page Playwright Page: The page where you are working on.
- message string: you want to send.
uploadImage(page, imageName)
This method will select a method from the websdk
- page Playwright Page: The page where you are working on.
- imageName string: you want to upload.
getChatHistory(page)
This method will get websdk chat history
- page Playwright Page: The page where you are working on.
`waitForNewElementInChat(page)
Waits to a new element to be show it, highly recommended to use it in parallel when you expect to receive a new message.
- page Playwright Page: The page where you are working on.
selectWidgetButton(page, buttonName)
This method will select the widget buttons in the websdk that is able to select and it will skip the button that is disabled.
- page Playwright Page: The page where you are working on.
submitWidgetDialog(page)
This method will submit button widget is open up
- page Playwright Page: The page where you are working on.
selectBotScriptOptions(page, optionName, submit)
This method will select a widget and selection a options when widget open up
- page Playwright Page: The page where you are working on.
Environment
getCCEnvNew()
This method creates and returns a new web page opening the command center.
getWebSdkEnvNew()
This method creates and returns a new web page opening the Web SDK.
Miscellaneous
Those methods are the methods that you can use for different purposes.
getOrgData(organization, patient)
Returns the patient data depending of the organization.
- organization string: the current organization.
- patient Object: the patient information retrieved from the API.
getApiConfig(organization, patient)
Returns the config object to make a request to retrieve the patient information.
- organization string: the current organization.
- patient Object: the patient information retrieved from the API.
getPatientInformation(patient)
Returns all the information of a patient
- patient Object: the patient information retrieved from the API.
endChat(patient)
This function clean all the chat the patient has opened.
- patient Object: the patient information retrieved from the API.
getCalendar(numOfDaysToAdd, options)
Retrieves an object with the year, month and date.
- numOfDaysToAdd number: if you want to add more days to the current date.
getCurrentTime(options)
Retrieves the current date in an object with hours, minutes, seconds and meridiem.
Extended Page
Page object is an extension of the Playwright's Page object, it has the following methods:
click(selector, snooze)
A safe way to click on an element.
- selector string: Should be a string with the selector of the element that you want to click.
- snooze number: It's optional, this is the maximum time in Millis that you want to wait until the element gets visible. The default value is 3000.
typeText(text, selector, snooze)
To type text inside an element.
- text string: the text to be typed.
- selector string: the selector of the element that you want to type in.
- snooze number: It's optional, this is the maximum time in Millis that you want to wait until the element gets visible. The default value is 3000.
loadUrl(url)
Safe way to go to an URL
- url string: url that you want to go.
getText(selector, snooze)
This function returns the text content inside an element.
- selector string: the selector of the element that you want to get the text.
- snooze number: It's optional, this is the maximum time in Millis that you want to wait until the element gets visible. The default value is 3000.
getCount(selector, snooze)
This function returns the number of elements for the specific selector.
- selector string: the selector of the elements that you want to get the number of instances it has.
- snooze number: It's optional, this is the maximum time in Millis that you want to wait until the element gets visible. The default value is 3000.
waitForText(selector, content, snooze)
Function to wait for an element until the element has the text specified.
- selector string: the selector of the element that ypu want to wait.
- content string: text content that you want to wait inside the element.
- snooze number: It's optional, this is the maximum time in Millis that you want to wait until the element gets visible. The default value is 3000.
pressKey(key, snooze)
Function to simulate a press of a key of the keyboard.
- key string: Key that you want to simulate.
- snooze number: It's optional, this is the maximum time in Millis that you want to wait until the element gets visible. The default value is 3000.
findByLinkText(linkString)
This function find in all the anchor one who has the value that you are specifing
- linkString string: text of the link.
getElementByText(selector, textContent, snooze)
This function returns an element by the specified text
- selector string: the selector of the element that you want to check.
- textContent string: text content that you want to wait inside the element.
- snooze number: It's optional, this is the maximum time in Millis that you want to wait until the element gets visible. The default value is 3000.
getElementVisibleStatus(selector, snooze)
This function waits until the element gets visible and returns true or false.
- selector string: the selector of the element that you want to check.
- snooze number: It's optional, this is the maximum time in Millis that you want to wait until the element gets visible. The default value is 3000.
getElementIndexByText(selector, textContent)
This function returns the number of index checking by text, highly recommended when you need to check the position of elements inside a list.
- selector string: the selector of the element that you want to check.
- textContent string: text content that you want to check.
getDropdownOptionIndex(selector, textContent)
This method is pretty much the same as getElementIndexByText(selector, textContent)
but it check inside field text.
- selector string: the selector of the element that you want to check.
- textContent string: text content that you want to check.
getElement(selector, target, snooze)
This function is a safe way to get an element.
- selector string: the selector of the element that you want to retrieve.
- target string: Optional value to identitfy the object that you're retrieving.
- snooze number: It's optional, this is the maximum time in Millis that you want to wait until the element gets visible. The default value is 3000.
getElements(selector, target)
It's almost the same as getElement(selector, target, snooze)
but this function returns an array of element.
- selector string: the selector of the element that you want to retrieve.
- target string: Optional value to identitfy the object that you're retrieving.
elementExist(selector)
A safe way to check if a element exists.
- selector string: the selector of the element that you want to check.
hoverElement(element, selector)
This method will hover on element and get the inner text of tooltip
- element Playwright Object: element who has the tooltip.
- selector string: selector to check the tooltip.
waitForResponseByUrl(params)
This function waits until an API service responded.
- params.response Playwright request: It has all the request information (you can get it using the Playwright's method
waitForResponse
) - params.uri [string | string]: URI that you want to check.
- params.method string:
GET
|POST
|PATCH
|PUT
. - params.status number: Expected status code.
selectOption(selector, text)
This function checks inside the options and selects the one who has the text specified.
- selector string: the selector of the element that you want to check.
- text string: the text of the option that you want to select.
waitForLoadState(state)
This function waits until the load state specified, please check the Playwright's documentation.
Development
Want to contribute? Great!
Install dependencies:
$ npm install
Configure the env variables: |Variable|Values|Purpose| |-|-|-| |ENVIRONMENT|STG / SDX / LOCALHOST|Specify the environment you want to run the tests. |ORGANIZATION|SURA / JOURNI / HORIZON|Specify the organization where you want to run the tests.
Link CLI to npm (this step just need to run once):
$ npm link
Run the command
$ npm test