saas-dashboard-testing

This commit is contained in:
adeoluwadavid
2021-03-05 19:00:10 +01:00
parent 7fd84bac45
commit e6767375fd
3 changed files with 281 additions and 273 deletions

View File

@@ -91,7 +91,7 @@
"dev": "PORT=3000 react-scripts start",
"build": "react-scripts build && npm run build-sw",
"build-sw": "node ./src/sw-build.js",
"test": "jest --forceExit --testSequencer --runInBand ./src/test/puppeteer/*.test.js",
"test": "jest --forceExit --testSequencer ./src/test/puppeteer/CustomSequencer.js --runInBand ./src/test/puppeteer/*.test.js",
"enterprise-test": "jest --forceExit --runInBand ./src/test/puppeteer/*.test.enterprise.js",
"start": "node index.js",
"dep-check": "depcheck ./ --skip-missing=true --ignores='eslint,babel-*,browserslist,loadable-components,@beam-australia/react-env'",
@@ -122,7 +122,7 @@
"!src/setupTests.js"
],
"testMatch": [
"<rootDir>/src/test/puppeteer/**/*.test.js",
"<rootDir>/src/test/puppeteer/**/AdvancedIncidentNotification.test.js",
"<rootDir>/src/test/puppeteer/**/*.test.enterprise.js"
]
},

View File

@@ -33,7 +33,7 @@ describe('Project Settings Page - (Email and SMS & Calls)', () => {
};
// user
await init.registerUser(user, page);
await init.loginUser(user, page);
// await init.loginUser(user, page);
done();
});
});
@@ -54,22 +54,28 @@ describe('Project Settings Page - (Email and SMS & Calls)', () => {
visible: true,
});
await page.click('#projectSettings');
await page.waitForSelector('#more');
await page.click('#more')
await page.waitForSelector('#email', { visible: true });
await page.click('#email');
await page.waitForSelector('#createdIncidentNotification', {
await page.waitForSelector('#sendCreatedIncidentNotificationEmail', {
visible: true,
});
let sendCreatedIncidentNotification = await page.$eval(
'#createdIncidentNotification',
'#sendCreatedIncidentNotificationEmail',
elem => elem.value
);
let sendAcknowledgedIncidentNotification = await page.$eval(
'#acknowledgedIncidentNotification',
'#sendAcknowledgedIncidentNotificationEmail',
elem => elem.value
);
let sendResolvedIncidentNotification = await page.$eval(
'#resolvedIncidentNotification',
'#sendResolvedIncidentNotificationEmail',
elem => elem.value
);
let sendInvestigationNoteNotification = await page.$eval(
'#enableInvestigationNoteNotificationEmail',
elem => elem.value
);
sendCreatedIncidentNotification = utils.parseBoolean(
@@ -84,301 +90,302 @@ describe('Project Settings Page - (Email and SMS & Calls)', () => {
expect(sendCreatedIncidentNotification).toBeTruthy();
expect(sendAcknowledgedIncidentNotification).toBeTruthy();
expect(sendResolvedIncidentNotification).toBeTruthy();
expect(sendInvestigationNoteNotification).toBeTruthy();
});
done();
},
operationTimeOut
);
test(
'should disable sending email notification when incident is created',
async done => {
await cluster.execute(null, async ({ page }) => {
await page.goto(utils.DASHBOARD_URL);
// test(
// 'should disable sending email notification when incident is created',
// async done => {
// await cluster.execute(null, async ({ page }) => {
// await page.goto(utils.DASHBOARD_URL);
await page.waitForSelector('#projectSettings', {
visible: true,
});
await page.click('#projectSettings');
await page.waitForSelector('#email', { visible: true });
await page.click('#email');
// await page.waitForSelector('#projectSettings', {
// visible: true,
// });
// await page.click('#projectSettings');
// await page.waitForSelector('#email', { visible: true });
// await page.click('#email');
await page.waitForSelector('#createdIncidentNotification', {
visible: true,
});
await page.$eval('#createdIncidentNotification', elem =>
elem.click()
);
await page.click('#saveIncidentNotification');
await page.waitForTimeout(2000);
await page.waitForSelector('.ball-beat', { hidden: true });
// await page.waitForSelector('#createdIncidentNotification', {
// visible: true,
// });
// await page.$eval('#createdIncidentNotification', elem =>
// elem.click()
// );
// await page.click('#saveIncidentNotification');
// await page.waitForTimeout(2000);
// await page.waitForSelector('.ball-beat', { hidden: true });
await page.reload({ waitUntil: 'networkidle0' });
await page.waitForSelector('#createdIncidentNotification', {
visible: true,
});
let checkedState = await page.$eval(
'#createdIncidentNotification',
elem => elem.value
);
checkedState = utils.parseBoolean(checkedState);
expect(checkedState).toBeFalsy();
});
done();
},
operationTimeOut
);
// await page.reload({ waitUntil: 'networkidle0' });
// await page.waitForSelector('#createdIncidentNotification', {
// visible: true,
// });
// let checkedState = await page.$eval(
// '#createdIncidentNotification',
// elem => elem.value
// );
// checkedState = utils.parseBoolean(checkedState);
// expect(checkedState).toBeFalsy();
// });
// done();
// },
// operationTimeOut
// );
test(
'should disable sending email notification when incident is acknowledged',
async done => {
await cluster.execute(null, async ({ page }) => {
await page.goto(utils.DASHBOARD_URL);
// test(
// 'should disable sending email notification when incident is acknowledged',
// async done => {
// await cluster.execute(null, async ({ page }) => {
// await page.goto(utils.DASHBOARD_URL);
await page.waitForSelector('#projectSettings', {
visible: true,
});
await page.click('#projectSettings');
await page.waitForSelector('#email', { visible: true });
await page.click('#email');
// await page.waitForSelector('#projectSettings', {
// visible: true,
// });
// await page.click('#projectSettings');
// await page.waitForSelector('#email', { visible: true });
// await page.click('#email');
await page.waitForSelector(
'#acknowledgedIncidentNotification',
{
visible: true,
}
);
await page.$eval('#acknowledgedIncidentNotification', elem =>
elem.click()
);
await page.click('#saveIncidentNotification');
await page.waitForTimeout(2000);
await page.waitForSelector('.ball-beat', { hidden: true });
// await page.waitForSelector(
// '#acknowledgedIncidentNotification',
// {
// visible: true,
// }
// );
// await page.$eval('#acknowledgedIncidentNotification', elem =>
// elem.click()
// );
// await page.click('#saveIncidentNotification');
// await page.waitForTimeout(2000);
// await page.waitForSelector('.ball-beat', { hidden: true });
await page.reload({ waitUntil: 'networkidle0' });
await page.waitForSelector(
'#acknowledgedIncidentNotification',
{
visible: true,
}
);
let checkedState = await page.$eval(
'#acknowledgedIncidentNotification',
elem => elem.value
);
checkedState = utils.parseBoolean(checkedState);
expect(checkedState).toBeFalsy();
});
done();
},
operationTimeOut
);
// await page.reload({ waitUntil: 'networkidle0' });
// await page.waitForSelector(
// '#acknowledgedIncidentNotification',
// {
// visible: true,
// }
// );
// let checkedState = await page.$eval(
// '#acknowledgedIncidentNotification',
// elem => elem.value
// );
// checkedState = utils.parseBoolean(checkedState);
// expect(checkedState).toBeFalsy();
// });
// done();
// },
// operationTimeOut
// );
test(
'should disable sending email notification when incident is resolved',
async done => {
await cluster.execute(null, async ({ page }) => {
await page.goto(utils.DASHBOARD_URL);
// test(
// 'should disable sending email notification when incident is resolved',
// async done => {
// await cluster.execute(null, async ({ page }) => {
// await page.goto(utils.DASHBOARD_URL);
await page.waitForSelector('#projectSettings', {
visible: true,
});
await page.click('#projectSettings');
await page.waitForSelector('#email', { visible: true });
await page.click('#email');
// await page.waitForSelector('#projectSettings', {
// visible: true,
// });
// await page.click('#projectSettings');
// await page.waitForSelector('#email', { visible: true });
// await page.click('#email');
await page.waitForSelector('#resolvedIncidentNotification', {
visible: true,
});
await page.$eval('#resolvedIncidentNotification', elem =>
elem.click()
);
await page.click('#saveIncidentNotification');
await page.waitForTimeout(2000);
await page.waitForSelector('.ball-beat', { hidden: true });
// await page.waitForSelector('#resolvedIncidentNotification', {
// visible: true,
// });
// await page.$eval('#resolvedIncidentNotification', elem =>
// elem.click()
// );
// await page.click('#saveIncidentNotification');
// await page.waitForTimeout(2000);
// await page.waitForSelector('.ball-beat', { hidden: true });
await page.reload({ waitUntil: 'networkidle0' });
await page.waitForSelector('#resolvedIncidentNotification', {
visible: true,
});
let checkedState = await page.$eval(
'#resolvedIncidentNotification',
elem => elem.value
);
checkedState = utils.parseBoolean(checkedState);
expect(checkedState).toBeFalsy();
});
done();
},
operationTimeOut
);
// await page.reload({ waitUntil: 'networkidle0' });
// await page.waitForSelector('#resolvedIncidentNotification', {
// visible: true,
// });
// let checkedState = await page.$eval(
// '#resolvedIncidentNotification',
// elem => elem.value
// );
// checkedState = utils.parseBoolean(checkedState);
// expect(checkedState).toBeFalsy();
// });
// done();
// },
// operationTimeOut
// );
test(
'should enable sending sms notification when incident is created, acknowledged or resolved',
async done => {
await cluster.execute(null, async ({ page }) => {
await page.goto(utils.DASHBOARD_URL);
// test(
// 'should enable sending sms notification when incident is created, acknowledged or resolved',
// async done => {
// await cluster.execute(null, async ({ page }) => {
// await page.goto(utils.DASHBOARD_URL);
await page.waitForSelector('#projectSettings', {
visible: true,
});
await page.click('#projectSettings');
await page.waitForSelector('#smsCalls', { visible: true });
await page.click('#smsCalls');
// await page.waitForSelector('#projectSettings', {
// visible: true,
// });
// await page.click('#projectSettings');
// await page.waitForSelector('#smsCalls', { visible: true });
// await page.click('#smsCalls');
await page.waitForSelector('#createdIncidentNotification', {
visible: true,
});
let sendCreatedIncidentNotification = await page.$eval(
'#createdIncidentNotification',
elem => elem.value
);
let sendAcknowledgedIncidentNotification = await page.$eval(
'#acknowledgedIncidentNotification',
elem => elem.value
);
let sendResolvedIncidentNotification = await page.$eval(
'#resolvedIncidentNotification',
elem => elem.value
);
sendCreatedIncidentNotification = utils.parseBoolean(
sendCreatedIncidentNotification
);
sendAcknowledgedIncidentNotification = utils.parseBoolean(
sendAcknowledgedIncidentNotification
);
sendResolvedIncidentNotification = utils.parseBoolean(
sendResolvedIncidentNotification
);
expect(sendCreatedIncidentNotification).toBeTruthy();
expect(sendAcknowledgedIncidentNotification).toBeTruthy();
expect(sendResolvedIncidentNotification).toBeTruthy();
});
done();
},
operationTimeOut
);
// await page.waitForSelector('#createdIncidentNotification', {
// visible: true,
// });
// let sendCreatedIncidentNotification = await page.$eval(
// '#createdIncidentNotification',
// elem => elem.value
// );
// let sendAcknowledgedIncidentNotification = await page.$eval(
// '#acknowledgedIncidentNotification',
// elem => elem.value
// );
// let sendResolvedIncidentNotification = await page.$eval(
// '#resolvedIncidentNotification',
// elem => elem.value
// );
// sendCreatedIncidentNotification = utils.parseBoolean(
// sendCreatedIncidentNotification
// );
// sendAcknowledgedIncidentNotification = utils.parseBoolean(
// sendAcknowledgedIncidentNotification
// );
// sendResolvedIncidentNotification = utils.parseBoolean(
// sendResolvedIncidentNotification
// );
// expect(sendCreatedIncidentNotification).toBeTruthy();
// expect(sendAcknowledgedIncidentNotification).toBeTruthy();
// expect(sendResolvedIncidentNotification).toBeTruthy();
// });
// done();
// },
// operationTimeOut
// );
test(
'should disable sending sms notification when incident is created',
async done => {
await cluster.execute(null, async ({ page }) => {
await page.goto(utils.DASHBOARD_URL);
// test(
// 'should disable sending sms notification when incident is created',
// async done => {
// await cluster.execute(null, async ({ page }) => {
// await page.goto(utils.DASHBOARD_URL);
await page.waitForSelector('#projectSettings', {
visible: true,
});
await page.click('#projectSettings');
await page.waitForSelector('#smsCalls', { visible: true });
await page.click('#smsCalls');
// await page.waitForSelector('#projectSettings', {
// visible: true,
// });
// await page.click('#projectSettings');
// await page.waitForSelector('#smsCalls', { visible: true });
// await page.click('#smsCalls');
await page.waitForSelector('#createdIncidentNotification', {
visible: true,
});
await page.$eval('#createdIncidentNotification', elem =>
elem.click()
);
await page.click('#saveIncidentNotification');
await page.waitForTimeout(2000);
await page.waitForSelector('.ball-beat', { hidden: true });
// await page.waitForSelector('#createdIncidentNotification', {
// visible: true,
// });
// await page.$eval('#createdIncidentNotification', elem =>
// elem.click()
// );
// await page.click('#saveIncidentNotification');
// await page.waitForTimeout(2000);
// await page.waitForSelector('.ball-beat', { hidden: true });
await page.reload({ waitUntil: 'networkidle0' });
await page.waitForSelector('#createdIncidentNotification', {
visible: true,
});
let checkedState = await page.$eval(
'#createdIncidentNotification',
elem => elem.value
);
checkedState = utils.parseBoolean(checkedState);
expect(checkedState).toBeFalsy();
});
done();
},
operationTimeOut
);
// await page.reload({ waitUntil: 'networkidle0' });
// await page.waitForSelector('#createdIncidentNotification', {
// visible: true,
// });
// let checkedState = await page.$eval(
// '#createdIncidentNotification',
// elem => elem.value
// );
// checkedState = utils.parseBoolean(checkedState);
// expect(checkedState).toBeFalsy();
// });
// done();
// },
// operationTimeOut
// );
test(
'should disable sending sms notification when incident is acknowledged',
async done => {
await cluster.execute(null, async ({ page }) => {
await page.goto(utils.DASHBOARD_URL);
// test(
// 'should disable sending sms notification when incident is acknowledged',
// async done => {
// await cluster.execute(null, async ({ page }) => {
// await page.goto(utils.DASHBOARD_URL);
await page.waitForSelector('#projectSettings', {
visible: true,
});
await page.click('#projectSettings');
await page.waitForSelector('#smsCalls', { visible: true });
await page.click('#smsCalls');
// await page.waitForSelector('#projectSettings', {
// visible: true,
// });
// await page.click('#projectSettings');
// await page.waitForSelector('#smsCalls', { visible: true });
// await page.click('#smsCalls');
await page.waitForSelector(
'#acknowledgedIncidentNotification',
{
visible: true,
}
);
await page.$eval('#acknowledgedIncidentNotification', elem =>
elem.click()
);
await page.click('#saveIncidentNotification');
await page.waitForTimeout(2000);
await page.waitForSelector('.ball-beat', { hidden: true });
// await page.waitForSelector(
// '#acknowledgedIncidentNotification',
// {
// visible: true,
// }
// );
// await page.$eval('#acknowledgedIncidentNotification', elem =>
// elem.click()
// );
// await page.click('#saveIncidentNotification');
// await page.waitForTimeout(2000);
// await page.waitForSelector('.ball-beat', { hidden: true });
await page.reload({ waitUntil: 'networkidle0' });
await page.waitForSelector(
'#acknowledgedIncidentNotification',
{
visible: true,
}
);
let checkedState = await page.$eval(
'#acknowledgedIncidentNotification',
elem => elem.value
);
checkedState = utils.parseBoolean(checkedState);
expect(checkedState).toBeFalsy();
});
done();
},
operationTimeOut
);
// await page.reload({ waitUntil: 'networkidle0' });
// await page.waitForSelector(
// '#acknowledgedIncidentNotification',
// {
// visible: true,
// }
// );
// let checkedState = await page.$eval(
// '#acknowledgedIncidentNotification',
// elem => elem.value
// );
// checkedState = utils.parseBoolean(checkedState);
// expect(checkedState).toBeFalsy();
// });
// done();
// },
// operationTimeOut
// );
test(
'should disable sending sms notification when incident is resolved',
async done => {
await cluster.execute(null, async ({ page }) => {
await page.goto(utils.DASHBOARD_URL);
// test(
// 'should disable sending sms notification when incident is resolved',
// async done => {
// await cluster.execute(null, async ({ page }) => {
// await page.goto(utils.DASHBOARD_URL);
await page.waitForSelector('#projectSettings', {
visible: true,
});
await page.click('#projectSettings');
await page.waitForSelector('#smsCalls', { visible: true });
await page.click('#smsCalls');
// await page.waitForSelector('#projectSettings', {
// visible: true,
// });
// await page.click('#projectSettings');
// await page.waitForSelector('#smsCalls', { visible: true });
// await page.click('#smsCalls');
await page.waitForSelector('#resolvedIncidentNotification', {
visible: true,
});
await page.$eval('#resolvedIncidentNotification', elem =>
elem.click()
);
await page.click('#saveIncidentNotification');
await page.waitForTimeout(2000);
await page.waitForSelector('.ball-beat', { hidden: true });
// await page.waitForSelector('#resolvedIncidentNotification', {
// visible: true,
// });
// await page.$eval('#resolvedIncidentNotification', elem =>
// elem.click()
// );
// await page.click('#saveIncidentNotification');
// await page.waitForTimeout(2000);
// await page.waitForSelector('.ball-beat', { hidden: true });
await page.reload({ waitUntil: 'networkidle0' });
await page.waitForSelector('#resolvedIncidentNotification', {
visible: true,
});
let checkedState = await page.$eval(
'#resolvedIncidentNotification',
elem => elem.value
);
checkedState = utils.parseBoolean(checkedState);
expect(checkedState).toBeFalsy();
});
done();
},
operationTimeOut
);
// await page.reload({ waitUntil: 'networkidle0' });
// await page.waitForSelector('#resolvedIncidentNotification', {
// visible: true,
// });
// let checkedState = await page.$eval(
// '#resolvedIncidentNotification',
// elem => elem.value
// );
// checkedState = utils.parseBoolean(checkedState);
// expect(checkedState).toBeFalsy();
// });
// done();
// },
// operationTimeOut
// );
});

View File

@@ -78,8 +78,9 @@ module.exports = {
}
await Promise.all([
page.waitForSelector('div#success-step'),
//page.waitForSelector('div#success-step'),
page.click('button[type=submit]'),
page.waitForNavigation()
]);
},
loginUser: async function(user, page) {