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
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9970b84
suppressed notification test
brian-tidepool May 31, 2024
f4fe319
removed credentials,environment url and added them to environment var…
brian-tidepool May 31, 2024
914dbef
addressing moving assertion outsitde of custom commands and various u…
brian-tidepool Jun 5, 2024
e138f92
comments added to suppressed notifiication functions, environment var…
brian-tidepool Jun 6, 2024
888e22f
fix error due to captureElementScreenshot.js
brian-tidepool Jun 10, 2024
71b141c
add parallel tag to clinicianPageFunctional and suppressedNotificatio…
brian-tidepool Jun 11, 2024
de2bd52
rpm stats file comparison test
brian-tidepool Jun 12, 2024
5d8ace0
Updated config.yml
brian-tidepool Jun 12, 2024
0bcb695
Added first set of tests for rpm stats
brian-tidepool Jun 25, 2024
2d90b57
fix eslint errors
brian-tidepool Jul 18, 2024
0a30235
Merge branch 'main' into supressednotificationstest
ginnyyadav Jul 19, 2024
0d8b84c
Update package.json
ginnyyadav Jul 19, 2024
dde8728
eslint config and fixes
ginnyyadav Jul 19, 2024
0679588
Update Patient Tag header reference
ginnyyadav Jul 19, 2024
8155932
fix clinician list selectors and increase timeout
ginnyyadav Jul 19, 2024
d4eabfd
Update nightwatch.conf.js
ginnyyadav Jul 19, 2024
828e471
Update nightwatch.conf.js
ginnyyadav Jul 19, 2024
9434c11
Update nightwatch.conf.js
ginnyyadav Jul 19, 2024
07ff831
add quit commands after all tests to avoid timeout
ginnyyadav Jul 19, 2024
2d92e89
handle exception fter suppressed notification request
ginnyyadav Jul 19, 2024
cac0cbc
update environment variables on prd
ginnyyadav Jul 19, 2024
70405eb
add prd command for suppressed notifications
ginnyyadav Jul 19, 2024
e1710d9
remove extra screenshots
ginnyyadav Jul 19, 2024
e2b08d4
added custom commands path
ginnyyadav Jul 19, 2024
6db4615
Merge branch 'supressednotificationstest' into rpmstats
brian-tidepool Aug 2, 2024
0631838
package.json fix error
brian-tidepool Aug 2, 2024
d0fa319
fix eslintrc.js error
brian-tidepool Aug 2, 2024
b4e9c76
class-methods-use-this warn
brian-tidepool Aug 2, 2024
5002a54
revert to testParallel
brian-tidepool Aug 2, 2024
7f8d61f
Update checkFileContents.js
brian-tidepool Aug 2, 2024
bae15b7
Update checkRPMExportSufficiency.js
brian-tidepool Aug 2, 2024
322895b
date string creation moved to function createDatesLong and createDate…
brian-tidepool Aug 5, 2024
0f4324d
clinicPatientListPage comments removed
brian-tidepool Aug 6, 2024
d80c48d
add rpm.csv to .gitignore
brian-tidepool Aug 6, 2024
321052e
Merge pull request #35 from tidepool-org/rpmstats
brian-tidepool Aug 6, 2024
fdf2c3f
add try catch suppressednotifaction
brian-tidepool Aug 6, 2024
4a8c625
add waitForElementVisible for dateselector
brian-tidepool Aug 7, 2024
0a1cdc4
add idletimeout to prdchrome section nightwatchconf.js
brian-tidepool Aug 7, 2024
cc79a17
troubleshoot timeout 1
brian-tidepool Aug 7, 2024
f4fe1f3
add try catch file exists
brian-tidepool Aug 7, 2024
7b37b5e
return error checkfileexists
brian-tidepool Aug 7, 2024
6b8831a
troubleshoot2
brian-tidepool Aug 7, 2024
c2f9005
increase idle timeout
brian-tidepool Aug 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 35 additions & 38 deletions custom_commands/suppressedNotificationsTrue.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,47 @@
const axios = require('axios');

module.exports = {
command: async function () {

command: async function (clinicianUsername, clinicianPassword, environment) {
const auth = btoa(`${clinicianUsername}:${clinicianPassword}`);


const getToken = async () => {
const response = await axios.post(
'https://qa2.development.tidepool.org/auth/login',
const getToken = async () => {
const response = await axios.post(
`${environment}/auth/login`,
'',
{
headers: {
'Authorization': 'Basic YnJpYW4rdXBsb2FkNzg2d2ViMTMyN2NsaW5pYzM1YUB0aWRlcG9vbC5vcmc6dGlkZXBvb2w=',
'Content-Type': 'application/x-www-form-urlencoded'
}
})
return response.headers['x-tidepool-session-token']
}


headers: {
Authorization: `Basic ${auth}`,
'Content-Type': 'application/x-www-form-urlencoded',
},
},
);
return response.headers['x-tidepool-session-token'];
};

const setNotification = async () => {
const token = await getToken();
response = await axios.post(
const setNotification = async () => {
const token = await getToken();
response = await axios.post(
'https://qa2.development.tidepool.org/v1/clinics/62419f38f85189a39ac4b68d/suppressed_notifications',
// '{\n "suppressedNotifications": {\n "patientClinicInvitation": true\n }\n}',
{
'suppressedNotifications': {
'patientClinicInvitation': true
}
suppressedNotifications: {
patientClinicInvitation: true,
},
},
{
headers: {
'X-Tidepool-Session-Token': token,
'Content-Type': 'application/json'
}
}
)
return response.status
}
const setNotificationRun = async () => {
const data = await setNotification()
this.assert.strictEqual(data, 200, '/suppressed_notification set to true returned 200 ')
//console.log("status: " + data)
}
setNotificationRun()
;
}
};
headers: {
'X-Tidepool-Session-Token': token,
'Content-Type': 'application/json',
},
},
);
return response.status;
};
const setNotificationRun = async () => {
const data = await setNotification();
this.assert.strictEqual(data, 200, '/suppressed_notification set to true returned 200 ');
// console.log("status: " + data)
};
setNotificationRun();
},
};
122 changes: 59 additions & 63 deletions custom_commands/suppressedNotificationsTrueCheck.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,66 @@
const axios = require('axios');

module.exports = {
command: async function () {

const getToken = async () => {
const response = await axios.post(
'https://qa2.development.tidepool.org/auth/login',
'',
{
headers: {
'Authorization': 'Basic YnJpYW4rdXBsb2FkNzg2d2ViMTMyN2NsaW5pYzM1YUB0aWRlcG9vbC5vcmc6dGlkZXBvb2w=',
'Content-Type': 'application/x-www-form-urlencoded'
}
})
return response.headers['x-tidepool-session-token']
}
command: async function (clinicianUsername, clinicianPassword, environment) {
const auth = btoa(`${clinicianUsername}:${clinicianPassword}`);
const getToken = async () => {
const response = await axios.post(
`${environment}/auth/login`,
'',
{
headers: {
Authorization: `Basic ${auth}`,
'Content-Type': 'application/x-www-form-urlencoded',
},
},
);
return response.headers['x-tidepool-session-token'];
};

const clinicData = async () => {
const token = await getToken();
response = await axios.get('https://qa2.development.tidepool.org/v1/clinicians/4ae71760b6/clinics', {

const clinicData = async () => {

const token = await getToken();
response = await axios.get('https://qa2.development.tidepool.org/v1/clinicians/4ae71760b6/clinics', {
params: {
limit: '1000',
offset: '0',
},
headers: {
authority: 'qa2.development.tidepool.org',
accept: '*/*',
'accept-language': 'en-US,en;q=0.9',
cookie: '_ga=GA1.1.516068539.1692684735; _ga_RWXQ3R57PB=GS1.1.1694192507.4.0.1694192507.0.0.0',
referer: 'https://qa2.development.tidepool.org/',
'sec-ch-ua': '"Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36',
'x-tidepool-session-token': token,
'x-tidepool-trace-session': '92df086f-917e-4df5-b32d-cb30d15df795',
},
});
return response.data;
};

params: {
'limit': '1000',
'offset': '0'
},
headers: {
'authority': 'qa2.development.tidepool.org',
'accept': '*/*',
'accept-language': 'en-US,en;q=0.9',
'cookie': '_ga=GA1.1.516068539.1692684735; _ga_RWXQ3R57PB=GS1.1.1694192507.4.0.1694192507.0.0.0',
'referer': 'https://qa2.development.tidepool.org/',
'sec-ch-ua': '"Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36',
'x-tidepool-session-token': token,
'x-tidepool-trace-session': '92df086f-917e-4df5-b32d-cb30d15df795'
}
});
return response.data;
const clinicDataRun = async () => {
let found = false;
const data = await clinicData();
for (let i = 0; i < data.length; i++) {
if (data[i].clinic.id == '62419f38f85189a39ac4b68d') {
if (data[i].clinic.suppressedNotifications.patientClinicInvitation == true) {
this.assert.strictEqual(true, true, '/suppressed_notification status is true in clinic object ');
found = true;
break;
}
}

const clinicDataRun = async () => {
var found = false;
const data = await clinicData()
for (var i = 0; i < data.length; i++) {
if (data[i]["clinic"]["id"] == '62419f38f85189a39ac4b68d') {
if (data[i]["clinic"]["suppressedNotifications"]["patientClinicInvitation"] == true) {
this.assert.strictEqual(true, true, '/suppressed_notification status is true in clinic object ')
found = true;
break;
}
}
}
if (found == false) {
this.assert.strictEqual(false, true, '/suppressed_notification status is true in clinic object ')
}

}
clinicDataRun()


}
};
}
if (found == false) {
this.assert.strictEqual(false, true, '/suppressed_notification status is true in clinic object ');
}
};
clinicDataRun();
},
};
10 changes: 7 additions & 3 deletions tests/e2e/suppressedNotificationsFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ module.exports = {
const loginPage = browser.page.loginPage();
const clinicianUsername = browser.globals.clinicianUsername;
const clinicianPassword = browser.globals.clinicianPassword;
const environment = browser.launch_url;
loginPage.loadPage();
loginPage.userLogin(clinicianUsername, clinicianPassword);
browser.suppressedNotificationsTrue();
browser.suppressedNotificationsTrueCheck();
browser.suppressedNotificationsTrue(clinicianUsername, clinicianPassword, environment);
browser.suppressedNotificationsTrueCheck(clinicianUsername, clinicianPassword, environment);
},
'Clinic workspace selection'(browser) {
const clinicWorkspacePage = browser.page.clinicWorkspacePage();
Expand All @@ -33,13 +34,16 @@ module.exports = {
clinicPatientList.waitForElementVisible('@city', browser.globals.elementTimeout);
},
'Clinic workspace settings apply changes and check suppressed notifications status'(browser) {
const clinicianUsername = browser.globals.clinicianUsername;
const clinicianPassword = browser.globals.clinicianPassword;
const environment = browser.launch_url;
const clinicPatientListPage = browser.page.clinicPatientListPage();
const clinicPatientList = clinicPatientListPage.section.patientList;
clinicPatientList.waitForElementVisible('@city', browser.globals.elementTimeout);
clinicPatientList.setValue('@city', 'new');
clinicPatientList.click('@clinicProfileSubmit');
clinicPatientList.waitForElementNotVisible('@city', browser.globals.elementTimeout);
browser.suppressedNotificationsTrueCheck();
browser.suppressedNotificationsTrueCheck(clinicianUsername, clinicianPassword, environment);
},

};