Skip to content
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

Supressednotificationstest #34

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open

Conversation

brian-tidepool
Copy link
Contributor

Tests when editing a profile suppressed notifications are preserved.

(see related ticket: https://tidepool.atlassian.net/browse/BACK-3031 )

Would appreciate coding tips as well (i added some api calls in custom commands which doesn't seem typical for nightwatch js, but it seems usefu)

tests when a user modifies the clinic profile, the supressednotification setting is preserved (true)
Copy link
Contributor

@vojtech-cerveny vojtech-cerveny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't comment same thing from last PR, but I added some new. Let me know what do you think about that.

'',
{
headers: {
'Authorization': 'Basic YnJpYW4rdXBsb2FkNzg2d2ViMTMyN2NsaW5pYzM1YUB0aWRlcG9vbC5vcmc6dGlkZXBvb2w=',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: If we hide credentials into environment variables, we should do that for tokens as well. Or you can create this token from credentials, it should be possible. WDYT?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a token, those are base64 encoded credentials - consider rotating the password.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I wrote it wrong 🤝 We can generated it from credentials saved in env and it should be enough, we don't need to rotate passwords IMHO

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular password has now been exposed to the entire world, given how this is a public repo. It may already be in https://archiveprogram.github.com/arctic-vault/ 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've changed the password for this account just now. ill look into rotation.




const setNotification = async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (if-minor): Some comment for this function would be cool.

Also you should specify, that it returns response.status, because it is kinda strange to see const data = await setNotification() === 200

Not ideal suggestion would be getNotificationStatus🤔 Not sure what it the best naming here :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-added comments to function

see commit e138f92

)
return response.status
}
const setNotificationRun = async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick (non-blocking): Name of function - you are asserting the notification status, so it should be clear from the function, what you do. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-clarification for function added in code comments
see commit e138f92

clinicPatientList.setValue('@city', 'new');
clinicPatientList.click('@clinicProfileSubmit');
clinicPatientList.waitForElementNotVisible('@city', browser.globals.elementTimeout);
browser.suppressedNotificationsTrueCheck();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: IMHO this is not good pattern. I am not fan of hiding assertion into function. If you will check the code in future, you will not see what you are checking, what is the assertion - you need to make the extra step to check the assertion. So I would rewrite it into this:

const isSuppresedNotificationPresent = browser.suppressedNotificationsTrueCheck(); // function needs to be rewritten
expect(isSuppresedNotificationPresent).to.be.true;

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've pushed a new commit 914dbef to address the above. the custom commands are refactored such that they return a result and the calling test checks the assertion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vojtech-cerveny lmk if the changes look ok

'',
{
headers: {
'Authorization': 'Basic YnJpYW4rdXBsb2FkNzg2d2ViMTMyN2NsaW5pYzM1YUB0aWRlcG9vbC5vcmc6dGlkZXBvb2w=',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not include credentials in PRs that are public to the world. This should come from injected environment variable at run-time (i.e. in the CI).

Copy link
Member

@tjotala tjotala May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, the URL should also come from an environment variable as well, to make this code re-usable in other deployment environments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed the password for this account for now. will look into injecting credentials into the environment variable.

…iables

replaced credentials and environment url  with environment variables that are read in at runtime

(hardcoded values replaced in suppressedNotificationsTrueCheck.js, suppressedNotificationsTrue.js)
Copy link
Member

@ginnyyadav ginnyyadav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've scheduled some time to go throught this with you so I have context. I'm so excited you are taking the initiative here.

…pdates

-renamed custom commands files
-refactored so that returned a result and moved assertion to calling test
-added @ROLE=button to various page objects
-replaced === in various comparisons
…iables added

-js doc style comments added for each sub function inside suppressed notification functions
-hard coded values for clinic id and clinician id moved to global variables in nightwatch.conf.js
-
@vojtech-cerveny
Copy link
Contributor

vojtech-cerveny commented Jun 7, 2024

modifed file import in captureScreenshot.js so that it loads correctly
@brian-tidepool
Copy link
Contributor Author

@vojtech-cerveny added commit 888e22f to address due to error thrown by captureElementScreenshot.js

brian-tidepool and others added 16 commits June 11, 2024 10:44
…nsFunctional

add parallel tag to clinicianPageFunctional and suppressedNotificationsFunctional
first test for rpm stats file comparison test
Added functions for filters, rpm export button, and checks if sufficiency column meets criteria.
Automated tests implemented checked as completed in test strategy spreadsheet: https://docs.google.com/spreadsheets/d/1gv5q_o5ghR_KMENYvsFmFxGVjKz020O9/edit?usp=sharing&ouid=117042773141856291352&rtpof=true&sd=true

fix to start date and end date out of range click

added logic to click previous month button if start date or end date was out of range in calendar view

additional tests for filters last2days, last14days,  last30days, today, and allranges

split tests rpmStatsFunctionality file into multiple conditions
fixed all es lint errors excluding class-methods-use-this since it results in a nighwatch error
@ginnyyadav
Copy link
Member

LGTM

@ginnyyadav ginnyyadav self-requested a review September 3, 2024 16:20
Copy link
Member

@ginnyyadav ginnyyadav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@clintonium-119 clintonium-119 removed their request for review January 23, 2025 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants