mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 23:30:10 +00:00
fix lint,
This commit is contained in:
parent
1b4521a99d
commit
89a80c1565
@ -716,7 +716,10 @@ router.delete(
|
||||
}
|
||||
);
|
||||
|
||||
router.get('/:projectId/slug/:slug', getUser, isAuthorized, async function(req, res) {
|
||||
router.get('/:projectId/slug/:slug', getUser, isAuthorized, async function(
|
||||
req,
|
||||
res
|
||||
) {
|
||||
try {
|
||||
const { slug } = req.params;
|
||||
const scheduledEvent = await ScheduledEventService.findOneBy({
|
||||
|
@ -1154,7 +1154,10 @@ router.get('/:projectId/probes', checkUser, async function(req, res) {
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/:statusPageSlug/probes/statusPage', checkUser, async function(req, res) {
|
||||
router.get('/:statusPageSlug/probes/statusPage', checkUser, async function(
|
||||
req,
|
||||
res
|
||||
) {
|
||||
try {
|
||||
const skip = req.query.skip || 0;
|
||||
const limit = req.query.limit || 0;
|
||||
|
@ -437,4 +437,4 @@ const ScheduleModel = require('../models/schedule');
|
||||
const EscalationService = require('../services/escalationService');
|
||||
const ErrorService = require('../services/errorService');
|
||||
const generate = require('nanoid/generate');
|
||||
const slugify = require('slugify');
|
||||
const slugify = require('slugify');
|
||||
|
@ -39,7 +39,6 @@ const TeamMemberSelector = ({
|
||||
form[policyIndex].teams[teamIndex].teamMembers
|
||||
);
|
||||
|
||||
|
||||
const allowedOptionsForDropdown =
|
||||
renderType === 'team'
|
||||
? [
|
||||
|
@ -57,13 +57,12 @@ const ApplicationSecurityView = ({
|
||||
{
|
||||
projectId,
|
||||
applicationSecurityId,
|
||||
name: ' Application Security'
|
||||
name: ' Application Security',
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const handleEdit = ({
|
||||
projectId,
|
||||
componentId,
|
||||
|
@ -92,7 +92,9 @@ export const NEXT_PAGE = 'NEXT_PAGE';
|
||||
export const PREV_PAGE = 'PREV_PAGE';
|
||||
|
||||
// fetch scheduled event by slug
|
||||
export const FETCH_SCHEDULED_EVENT_REQUEST_SLUG = 'FETCH_SCHEDULED_EVENT_REQUEST_SLUG';
|
||||
export const FETCH_SCHEDULED_EVENT_SUCCESS_SLUG = 'FETCH_SCHEDULED_EVENT_SUCCESS_SLUG';
|
||||
export const FETCH_SCHEDULED_EVENT_FAILURE_SLUG = 'FETCH_SCHEDULED_EVENT_FAILURE_SLUG';
|
||||
|
||||
export const FETCH_SCHEDULED_EVENT_REQUEST_SLUG =
|
||||
'FETCH_SCHEDULED_EVENT_REQUEST_SLUG';
|
||||
export const FETCH_SCHEDULED_EVENT_SUCCESS_SLUG =
|
||||
'FETCH_SCHEDULED_EVENT_SUCCESS_SLUG';
|
||||
export const FETCH_SCHEDULED_EVENT_FAILURE_SLUG =
|
||||
'FETCH_SCHEDULED_EVENT_FAILURE_SLUG';
|
||||
|
@ -10,75 +10,75 @@ const password = '1234567890';
|
||||
|
||||
const user = {
|
||||
email,
|
||||
password
|
||||
password,
|
||||
};
|
||||
describe('Alert Warning', () => {
|
||||
const operationTimeOut = 1000000;
|
||||
|
||||
beforeAll(async done => {
|
||||
jest.setTimeout(2000000);
|
||||
jest.setTimeout(2000000);
|
||||
|
||||
browser = await puppeteer.launch(utils.puppeteerLaunchConfig);
|
||||
page = await browser.newPage();
|
||||
await page.setUserAgent(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
|
||||
);
|
||||
|
||||
await init.registerUser(user, page);
|
||||
done();
|
||||
);
|
||||
|
||||
await init.registerUser(user, page);
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async done => {
|
||||
await browser.close();
|
||||
done();
|
||||
});
|
||||
|
||||
test(
|
||||
'Should show a warning alert if call and sms alerts are disabled',
|
||||
async (done) => {
|
||||
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings',{visible:true});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#billing',{visible:true});
|
||||
await page.click('#billing');
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', { visible: true });
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#billing', { visible: true });
|
||||
await page.click('#billing');
|
||||
|
||||
const element = await page.waitForSelector('#alertWarning',{visible:true});
|
||||
expect(element).toBeDefined();
|
||||
done();
|
||||
|
||||
const element = await page.waitForSelector('#alertWarning', {
|
||||
visible: true,
|
||||
});
|
||||
expect(element).toBeDefined();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
|
||||
test(
|
||||
'Should not show any warning alert if call and sms alerts are enabled',
|
||||
async (done) => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings',{visible:true});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#billing',{visible:true});
|
||||
await page.click('#billing a');
|
||||
await page.waitForSelector('#alertEnable',{visible:true});
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', { visible: true });
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#billing', { visible: true });
|
||||
await page.click('#billing a');
|
||||
await page.waitForSelector('#alertEnable', { visible: true });
|
||||
|
||||
const rowLength = await page.$$eval(
|
||||
'#alertOptionRow > div.bs-Fieldset-row',
|
||||
rows => rows.length
|
||||
);
|
||||
const rowLength = await page.$$eval(
|
||||
'#alertOptionRow > div.bs-Fieldset-row',
|
||||
rows => rows.length
|
||||
);
|
||||
|
||||
if (rowLength === 1) {
|
||||
// enable sms and call alerts
|
||||
// check the box
|
||||
await page.evaluate(() => {
|
||||
document.querySelector('#alertEnable').click();
|
||||
document.querySelector('#alertOptionSave').click();
|
||||
});
|
||||
}
|
||||
const element = await page.waitForSelector('#alertWarning', {
|
||||
hidden: true,
|
||||
if (rowLength === 1) {
|
||||
// enable sms and call alerts
|
||||
// check the box
|
||||
await page.evaluate(() => {
|
||||
document.querySelector('#alertEnable').click();
|
||||
document.querySelector('#alertOptionSave').click();
|
||||
});
|
||||
expect(element).toBeNull();
|
||||
done();
|
||||
}
|
||||
const element = await page.waitForSelector('#alertWarning', {
|
||||
hidden: true,
|
||||
});
|
||||
expect(element).toBeNull();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
|
@ -11,82 +11,75 @@ const password = '1234567890';
|
||||
|
||||
const user = {
|
||||
email,
|
||||
password
|
||||
password,
|
||||
};
|
||||
|
||||
describe('BreadCrumb Component test', () => {
|
||||
const operationTimeOut = 500000;
|
||||
|
||||
beforeAll(async (done) => {
|
||||
beforeAll(async done => {
|
||||
jest.setTimeout(500000);
|
||||
|
||||
|
||||
browser = await puppeteer.launch(utils.puppeteerLaunchConfig);
|
||||
page = await browser.newPage();
|
||||
await page.setUserAgent(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
|
||||
);
|
||||
// user
|
||||
await init.registerUser(user, page);
|
||||
done();
|
||||
|
||||
);
|
||||
// user
|
||||
await init.registerUser(user, page);
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async (done) => {
|
||||
afterAll(async done => {
|
||||
await browser.close();
|
||||
done();
|
||||
});
|
||||
|
||||
test(
|
||||
'Should navigate between pages from the breadcrumbs',
|
||||
async (done) => {
|
||||
async done => {
|
||||
const componentName = utils.generateRandomString();
|
||||
const monitorName = utils.generateRandomString();
|
||||
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await init.addMonitorToComponent(
|
||||
componentName,
|
||||
monitorName,
|
||||
page
|
||||
);
|
||||
|
||||
const monitorBreadcrumb = await page.waitForSelector(
|
||||
`#cb${monitorName}`,
|
||||
{
|
||||
visible: true,
|
||||
}
|
||||
);
|
||||
const componentBreadcrumb = await page.waitForSelector(
|
||||
'#cbMonitors'
|
||||
);
|
||||
expect(monitorBreadcrumb).toBeDefined();
|
||||
expect(componentBreadcrumb).toBeDefined();
|
||||
await page.click('#cbMonitors');
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await init.addMonitorToComponent(componentName, monitorName, page);
|
||||
|
||||
const monitorTitle = await page.waitForSelector(
|
||||
`#monitor-title-${monitorName}`,
|
||||
{ visible: true }
|
||||
);
|
||||
expect(monitorTitle).toBeDefined();
|
||||
done();
|
||||
|
||||
const monitorBreadcrumb = await page.waitForSelector(
|
||||
`#cb${monitorName}`,
|
||||
{
|
||||
visible: true,
|
||||
}
|
||||
);
|
||||
const componentBreadcrumb = await page.waitForSelector(
|
||||
'#cbMonitors'
|
||||
);
|
||||
expect(monitorBreadcrumb).toBeDefined();
|
||||
expect(componentBreadcrumb).toBeDefined();
|
||||
await page.click('#cbMonitors');
|
||||
|
||||
const monitorTitle = await page.waitForSelector(
|
||||
`#monitor-title-${monitorName}`,
|
||||
{ visible: true }
|
||||
);
|
||||
expect(monitorTitle).toBeDefined();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
|
||||
test(
|
||||
'Should not go to the landing page when the project breadcrumb item is clicked',
|
||||
async (done) => {
|
||||
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#cbUnnamedProject',{visible:true});
|
||||
await page.click('#cbUnnamedProject');
|
||||
let currentPage = await page.waitForSelector(
|
||||
'#cbUnnamedProject',{visible:true}
|
||||
);
|
||||
currentPage = await currentPage.getProperty('innerText');
|
||||
currentPage = await currentPage.jsonValue();
|
||||
expect(currentPage).toBe('Unnamed Project');
|
||||
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#cbUnnamedProject', { visible: true });
|
||||
await page.click('#cbUnnamedProject');
|
||||
let currentPage = await page.waitForSelector('#cbUnnamedProject', {
|
||||
visible: true,
|
||||
});
|
||||
currentPage = await currentPage.getProperty('innerText');
|
||||
currentPage = await currentPage.jsonValue();
|
||||
expect(currentPage).toBe('Unnamed Project');
|
||||
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
|
@ -9,7 +9,7 @@ const email = utils.generateRandomBusinessEmail();
|
||||
const password = '1234567890';
|
||||
const user = {
|
||||
email,
|
||||
password
|
||||
password,
|
||||
};
|
||||
|
||||
describe('Project API', () => {
|
||||
@ -17,15 +17,15 @@ describe('Project API', () => {
|
||||
|
||||
beforeAll(async done => {
|
||||
jest.setTimeout(200000);
|
||||
|
||||
|
||||
browser = await puppeteer.launch(utils.puppeteerLaunchConfig);
|
||||
page = await browser.newPage();
|
||||
await page.setUserAgent(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
|
||||
);
|
||||
// user
|
||||
await init.registerUser(user, page);
|
||||
|
||||
);
|
||||
// user
|
||||
await init.registerUser(user, page);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,7 @@ const email = utils.generateRandomBusinessEmail();
|
||||
const password = '1234567890';
|
||||
const user = {
|
||||
email,
|
||||
password
|
||||
password,
|
||||
};
|
||||
const incidentFieldText = {
|
||||
fieldName: 'textField',
|
||||
@ -22,7 +22,7 @@ const incidentFieldText = {
|
||||
|
||||
describe('Incident Custom Field', () => {
|
||||
const operationTimeOut = 500000;
|
||||
|
||||
|
||||
beforeAll(async done => {
|
||||
jest.setTimeout(360000);
|
||||
|
||||
@ -30,28 +30,28 @@ describe('Incident Custom Field', () => {
|
||||
page = await browser.newPage();
|
||||
await page.setUserAgent(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
|
||||
);
|
||||
// user
|
||||
await init.registerUser(user, page);
|
||||
);
|
||||
// user
|
||||
await init.registerUser(user, page);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async done => {
|
||||
await browser.close();
|
||||
done();
|
||||
});
|
||||
|
||||
test(
|
||||
'should configure incident custom field in a project',
|
||||
async done => {
|
||||
await init.addCustomField(page, incidentFieldText, 'incident');
|
||||
async done => {
|
||||
await init.addCustomField(page, incidentFieldText, 'incident');
|
||||
|
||||
const firstCustomField = await page.waitForSelector(
|
||||
`#customfield_${incidentFieldText.fieldName}`,
|
||||
{ visible: true }
|
||||
);
|
||||
expect(firstCustomField).toBeDefined();
|
||||
const firstCustomField = await page.waitForSelector(
|
||||
`#customfield_${incidentFieldText.fieldName}`,
|
||||
{ visible: true }
|
||||
);
|
||||
expect(firstCustomField).toBeDefined();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
@ -59,50 +59,50 @@ describe('Incident Custom Field', () => {
|
||||
|
||||
test(
|
||||
'should update a incident custom field in a project',
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#more');
|
||||
await page.click('#more');
|
||||
await page.waitForSelector('#incidentSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#incidentSettings');
|
||||
await page.reload({
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await init.gotoTab(6, page);
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#more');
|
||||
await page.click('#more');
|
||||
await page.waitForSelector('#incidentSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#incidentSettings');
|
||||
await page.reload({
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await init.gotoTab(6, page);
|
||||
|
||||
await page.waitForSelector('#editCustomField_0', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#editCustomField_0');
|
||||
await page.waitForSelector('#customFieldForm', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#fieldName', { clickCount: 3 });
|
||||
await page.type('#fieldName', incidentFieldNumber.fieldName);
|
||||
await init.selectByText(
|
||||
'#fieldType',
|
||||
incidentFieldNumber.fieldType,
|
||||
page
|
||||
);
|
||||
await page.waitForSelector('#updateCustomField', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#updateCustomField');
|
||||
await page.waitForSelector('#updateCustomField', {
|
||||
hidden: true,
|
||||
});
|
||||
await page.waitForSelector('#editCustomField_0', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#editCustomField_0');
|
||||
await page.waitForSelector('#customFieldForm', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#fieldName', { clickCount: 3 });
|
||||
await page.type('#fieldName', incidentFieldNumber.fieldName);
|
||||
await init.selectByText(
|
||||
'#fieldType',
|
||||
incidentFieldNumber.fieldType,
|
||||
page
|
||||
);
|
||||
await page.waitForSelector('#updateCustomField', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#updateCustomField');
|
||||
await page.waitForSelector('#updateCustomField', {
|
||||
hidden: true,
|
||||
});
|
||||
|
||||
const updatedField = await page.waitForSelector(
|
||||
`#customfield_${incidentFieldNumber.fieldName}`,
|
||||
{ visible: true }
|
||||
);
|
||||
expect(updatedField).toBeDefined();
|
||||
const updatedField = await page.waitForSelector(
|
||||
`#customfield_${incidentFieldNumber.fieldName}`,
|
||||
{ visible: true }
|
||||
);
|
||||
expect(updatedField).toBeDefined();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
@ -110,41 +110,41 @@ describe('Incident Custom Field', () => {
|
||||
|
||||
test(
|
||||
'should delete a incident custom field in a project',
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#more');
|
||||
await page.click('#more');
|
||||
await page.waitForSelector('#incidentSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#incidentSettings');
|
||||
await page.reload({
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await init.gotoTab(6, page);
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#more');
|
||||
await page.click('#more');
|
||||
await page.waitForSelector('#incidentSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#incidentSettings');
|
||||
await page.reload({
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await init.gotoTab(6, page);
|
||||
|
||||
await page.waitForSelector('#deleteCustomField_0', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#deleteCustomField_0');
|
||||
await page.waitForSelector('#deleteCustomFieldModalBtn', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#deleteCustomFieldModalBtn');
|
||||
await page.waitForSelector('#deleteCustomFieldModalBtn', {
|
||||
hidden: true,
|
||||
});
|
||||
await page.waitForSelector('#deleteCustomField_0', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#deleteCustomField_0');
|
||||
await page.waitForSelector('#deleteCustomFieldModalBtn', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#deleteCustomFieldModalBtn');
|
||||
await page.waitForSelector('#deleteCustomFieldModalBtn', {
|
||||
hidden: true,
|
||||
});
|
||||
|
||||
const noCustomFields = await page.waitForSelector(
|
||||
'#noCustomFields',
|
||||
{ visible: true }
|
||||
);
|
||||
expect(noCustomFields).toBeDefined();
|
||||
|
||||
const noCustomFields = await page.waitForSelector(
|
||||
'#noCustomFields',
|
||||
{ visible: true }
|
||||
);
|
||||
expect(noCustomFields).toBeDefined();
|
||||
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
|
@ -11,128 +11,127 @@ const user = {
|
||||
|
||||
describe('Custom Tutorial With SubProjects', () => {
|
||||
const operationTimeOut = 500000;
|
||||
|
||||
beforeAll(async (done) => {
|
||||
|
||||
beforeAll(async done => {
|
||||
jest.setTimeout(500000);
|
||||
|
||||
browser = await puppeteer.launch(utils.puppeteerLaunchConfig);
|
||||
page = await browser.newPage();
|
||||
await page.setUserAgent(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
|
||||
);
|
||||
|
||||
await init.registerUser(user, page);
|
||||
);
|
||||
|
||||
await init.registerUser(user, page);
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async (done) => {
|
||||
afterAll(async done => {
|
||||
await browser.close();
|
||||
done();
|
||||
});
|
||||
// User is automatically route to dashboard after registration.
|
||||
test(
|
||||
'Should show indicator on how to create component, on visiting component page, it should also appear',
|
||||
async (done) => {
|
||||
const customTutorialType = 'component';
|
||||
// Navigate to home page
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
const componentBoxElement = await page.waitForSelector(
|
||||
`#info-${customTutorialType}`
|
||||
);
|
||||
expect(componentBoxElement).toBeDefined();
|
||||
async done => {
|
||||
const customTutorialType = 'component';
|
||||
// Navigate to home page
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
const componentBoxElement = await page.waitForSelector(
|
||||
`#info-${customTutorialType}`
|
||||
);
|
||||
expect(componentBoxElement).toBeDefined();
|
||||
|
||||
// click on component section
|
||||
await page.waitForSelector('#components');
|
||||
await page.click('#components');
|
||||
// click on component section
|
||||
await page.waitForSelector('#components');
|
||||
await page.click('#components');
|
||||
|
||||
// find that same tutorial box on component page
|
||||
const newComponentBoxElement = await page.waitForSelector(
|
||||
`#info-${customTutorialType}`
|
||||
);
|
||||
expect(newComponentBoxElement).toBeDefined();
|
||||
|
||||
// find that same tutorial box on component page
|
||||
const newComponentBoxElement = await page.waitForSelector(
|
||||
`#info-${customTutorialType}`
|
||||
);
|
||||
expect(newComponentBoxElement).toBeDefined();
|
||||
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
test(
|
||||
'Should show indicator on how to create component, and after closing, quick tip for component should appear',
|
||||
async (done) => {
|
||||
const customTutorialType = 'component';
|
||||
// Navigate to home page
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
|
||||
const componentBoxElement = await page.waitForSelector(
|
||||
`#info-${customTutorialType}`
|
||||
);
|
||||
expect(componentBoxElement).toBeDefined();
|
||||
async done => {
|
||||
const customTutorialType = 'component';
|
||||
// Navigate to home page
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
|
||||
// click on component section
|
||||
await page.waitForSelector('#components');
|
||||
await page.click('#components');
|
||||
const componentBoxElement = await page.waitForSelector(
|
||||
`#info-${customTutorialType}`
|
||||
);
|
||||
expect(componentBoxElement).toBeDefined();
|
||||
|
||||
// find that same tutorial box on component page
|
||||
const newComponentBoxElement = await page.waitForSelector(
|
||||
`#info-${customTutorialType}`
|
||||
);
|
||||
expect(newComponentBoxElement).toBeDefined();
|
||||
// click on the call to action button
|
||||
await page.waitForSelector(`#close-${customTutorialType}`);
|
||||
await page.click(`#close-${customTutorialType}`);
|
||||
// find component quick tip and confirm it shows
|
||||
const componentQuickTip = await page.waitForSelector(
|
||||
`#quick-tip-${customTutorialType}`
|
||||
);
|
||||
expect(componentQuickTip).toBeDefined();
|
||||
done();
|
||||
|
||||
// click on component section
|
||||
await page.waitForSelector('#components');
|
||||
await page.click('#components');
|
||||
|
||||
// find that same tutorial box on component page
|
||||
const newComponentBoxElement = await page.waitForSelector(
|
||||
`#info-${customTutorialType}`
|
||||
);
|
||||
expect(newComponentBoxElement).toBeDefined();
|
||||
// click on the call to action button
|
||||
await page.waitForSelector(`#close-${customTutorialType}`);
|
||||
await page.click(`#close-${customTutorialType}`);
|
||||
// find component quick tip and confirm it shows
|
||||
const componentQuickTip = await page.waitForSelector(
|
||||
`#quick-tip-${customTutorialType}`
|
||||
);
|
||||
expect(componentQuickTip).toBeDefined();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
test(
|
||||
'Should show indicator on how to create monitor, and after closing, it should not reapprear',
|
||||
async (done) => {
|
||||
const customTutorialType = 'monitor';
|
||||
// Navigate to home page
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
|
||||
const componentBoxElement = await page.waitForSelector(
|
||||
`#info-${customTutorialType}`
|
||||
);
|
||||
expect(componentBoxElement).toBeDefined();
|
||||
async done => {
|
||||
const customTutorialType = 'monitor';
|
||||
// Navigate to home page
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
|
||||
const componentBoxElement = await page.waitForSelector(
|
||||
`#info-${customTutorialType}`
|
||||
);
|
||||
expect(componentBoxElement).toBeDefined();
|
||||
|
||||
// click on the call to action button
|
||||
await page.waitForSelector(`#close-${customTutorialType}`);
|
||||
await page.click(`#close-${customTutorialType}`);
|
||||
|
||||
// click on the call to action button
|
||||
await page.waitForSelector(`#close-${customTutorialType}`);
|
||||
await page.click(`#close-${customTutorialType}`);
|
||||
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
test(
|
||||
'Should show indicator on how to invite team member, and after closing, it should not reapprear',
|
||||
async (done) => {
|
||||
const customTutorialType = 'teamMember';
|
||||
// Navigate to home page
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
|
||||
const componentBoxElement = await page.waitForSelector(
|
||||
`#info-${customTutorialType}`
|
||||
);
|
||||
expect(componentBoxElement).toBeDefined();
|
||||
async done => {
|
||||
const customTutorialType = 'teamMember';
|
||||
// Navigate to home page
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
|
||||
const componentBoxElement = await page.waitForSelector(
|
||||
`#info-${customTutorialType}`
|
||||
);
|
||||
expect(componentBoxElement).toBeDefined();
|
||||
|
||||
// click on the call to action button
|
||||
await page.waitForSelector(`#close-${customTutorialType}`);
|
||||
await page.click(`#close-${customTutorialType}`);
|
||||
|
||||
// click on the call to action button
|
||||
await page.waitForSelector(`#close-${customTutorialType}`);
|
||||
await page.click(`#close-${customTutorialType}`);
|
||||
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
|
@ -19,166 +19,177 @@ describe('API test', () => {
|
||||
|
||||
let cluster;
|
||||
|
||||
beforeAll(async (done) => {
|
||||
beforeAll(async done => {
|
||||
jest.setTimeout(500000);
|
||||
|
||||
browser = await puppeteer.launch(utils.puppeteerLaunchConfig);
|
||||
page = await browser.newPage();
|
||||
await page.setUserAgent(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
|
||||
);
|
||||
);
|
||||
|
||||
// Register user
|
||||
await init.registerUser(user, page);
|
||||
await init.logout(page);
|
||||
await init.registerUser(member, page);
|
||||
await init.logout(page);
|
||||
await init.loginUser(user, page);
|
||||
|
||||
// Register user
|
||||
await init.registerUser(user, page);
|
||||
await init.logout(page);
|
||||
await init.registerUser(member, page);
|
||||
await init.logout(page);
|
||||
await init.loginUser(user, page);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async (done) => {
|
||||
afterAll(async done => {
|
||||
await browser.close();
|
||||
done();
|
||||
});
|
||||
|
||||
test(
|
||||
'Should render the API page',
|
||||
async (done) => {
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
|
||||
await page.waitForSelector('#projectSettings', {visible: true});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#api', {visible: true});
|
||||
await page.click('#api a');
|
||||
let elementHandle = await page.$('#boxTitle', {
|
||||
visible: true,
|
||||
});
|
||||
elementHandle = await elementHandle.getProperty('innerText');
|
||||
elementHandle = await elementHandle.jsonValue();
|
||||
elementHandle.should.be.exactly('API Documentation');
|
||||
|
||||
done();
|
||||
await page.waitForSelector('#projectSettings', { visible: true });
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#api', { visible: true });
|
||||
await page.click('#api a');
|
||||
let elementHandle = await page.$('#boxTitle', {
|
||||
visible: true,
|
||||
});
|
||||
elementHandle = await elementHandle.getProperty('innerText');
|
||||
elementHandle = await elementHandle.jsonValue();
|
||||
elementHandle.should.be.exactly('API Documentation');
|
||||
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
|
||||
test(
|
||||
'Should display the API key when clicked',
|
||||
async (done) => {
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
|
||||
await page.waitForSelector('#projectSettings', {visible: true});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#api', {visible: true});
|
||||
await page.click('#api a');
|
||||
let label = await page.$('#apiKey', { visible: true });
|
||||
label = await label.getProperty('innerText');
|
||||
label = await label.jsonValue();
|
||||
await page.waitForSelector('#projectSettings', { visible: true });
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#api', { visible: true });
|
||||
await page.click('#api a');
|
||||
let label = await page.$('#apiKey', { visible: true });
|
||||
label = await label.getProperty('innerText');
|
||||
label = await label.jsonValue();
|
||||
|
||||
await page.click('#apiKey');
|
||||
let newLabel = await page.$('#apiKey', { visible: true });
|
||||
newLabel = await newLabel.getProperty('innerText');
|
||||
newLabel = await newLabel.jsonValue();
|
||||
expect(label).not.toEqual(newLabel);
|
||||
await page.click('#apiKey');
|
||||
let newLabel = await page.$('#apiKey', { visible: true });
|
||||
newLabel = await newLabel.getProperty('innerText');
|
||||
newLabel = await newLabel.jsonValue();
|
||||
expect(label).not.toEqual(newLabel);
|
||||
|
||||
done();
|
||||
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
|
||||
test(
|
||||
'Should reset the API Key',
|
||||
async (done) => {
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
|
||||
await page.waitForSelector('#projectSettings', {visible: true});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#api', {visible: true});
|
||||
await page.click('#api a');
|
||||
await page.waitForSelector('#projectSettings', { visible: true });
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#api', { visible: true });
|
||||
await page.click('#api a');
|
||||
|
||||
await page.click('#apiKey');
|
||||
let oldApiKey = await page.$('#apiKey', { visible: true });
|
||||
oldApiKey = await oldApiKey.getProperty('innerText');
|
||||
oldApiKey = await oldApiKey.jsonValue();
|
||||
await page.click('#apiKey');
|
||||
let oldApiKey = await page.$('#apiKey', { visible: true });
|
||||
oldApiKey = await oldApiKey.getProperty('innerText');
|
||||
oldApiKey = await oldApiKey.jsonValue();
|
||||
|
||||
await page.click('button[id=resetApiKey]', { delay: 100 });
|
||||
await page.waitForSelector('button[id=resetApiKeySave]', {visible: true});
|
||||
await page.click('button[id=resetApiKeySave]');
|
||||
await page.waitForSelector('button[id=resetApiKeySave]', {hidden:true});
|
||||
await page.click('button[id=resetApiKey]', { delay: 100 });
|
||||
await page.waitForSelector('button[id=resetApiKeySave]', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('button[id=resetApiKeySave]');
|
||||
await page.waitForSelector('button[id=resetApiKeySave]', {
|
||||
hidden: true,
|
||||
});
|
||||
|
||||
let newApiKey = await page.$('#apiKey', { visible: true });
|
||||
newApiKey = await newApiKey.getProperty('innerText');
|
||||
newApiKey = await newApiKey.jsonValue();
|
||||
let newApiKey = await page.$('#apiKey', { visible: true });
|
||||
newApiKey = await newApiKey.getProperty('innerText');
|
||||
newApiKey = await newApiKey.jsonValue();
|
||||
|
||||
expect(oldApiKey).not.toEqual(newApiKey);
|
||||
expect(oldApiKey).not.toEqual(newApiKey);
|
||||
|
||||
done();
|
||||
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
|
||||
test(
|
||||
'Should not access API settings if user is a member on a project',
|
||||
async (done) => {
|
||||
async done => {
|
||||
const projectName = 'Project1';
|
||||
const role = 'Member';
|
||||
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
// Rename project
|
||||
await page.waitForSelector('#projectSettings', {visible: true});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('input[name=project_name]', {visible: true});
|
||||
await page.click('input[name=project_name]', { clickCount: 3 });
|
||||
await page.type('input[name=project_name]', projectName);
|
||||
await page.waitForSelector('button[id=btnCreateProject]', {visible: true});
|
||||
await page.click('button[id=btnCreateProject]');
|
||||
|
||||
// Invite member on the project
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#teamMembers', {visible: true});
|
||||
await page.click('#teamMembers');
|
||||
await page.waitForSelector(`#btn_${projectName}`, {visible: true});
|
||||
await page.click(`#btn_${projectName}`);
|
||||
await page.waitForSelector('input[name=emails]', {visible: true});
|
||||
await page.click('input[name=emails]');
|
||||
await page.type('input[name=emails]', member.email);
|
||||
await page.waitForSelector(`#${role}_${projectName}`, {visible: true});
|
||||
await page.click(`#${role}_${projectName}`);
|
||||
await page.waitForSelector('button[type=submit]', {visible: true});
|
||||
await page.click('button[type=submit]');
|
||||
await page.waitForSelector('button[type=submit]', {hidden: true});
|
||||
await init.logout(page);
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
// Rename project
|
||||
await page.waitForSelector('#projectSettings', { visible: true });
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('input[name=project_name]', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('input[name=project_name]', { clickCount: 3 });
|
||||
await page.type('input[name=project_name]', projectName);
|
||||
await page.waitForSelector('button[id=btnCreateProject]', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('button[id=btnCreateProject]');
|
||||
|
||||
// Login as member
|
||||
await init.loginUser(member, page);
|
||||
await init.switchProject(projectName, page);
|
||||
await page.waitForSelector('#projectSettings', {visible: true});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#api', {visible: true});
|
||||
await page.click('#api a');
|
||||
let elementHandle = await page.$('#boxTitle', {
|
||||
visible: true,
|
||||
});
|
||||
expect(elementHandle).toEqual(null);
|
||||
// Invite member on the project
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#teamMembers', { visible: true });
|
||||
await page.click('#teamMembers');
|
||||
await page.waitForSelector(`#btn_${projectName}`, {
|
||||
visible: true,
|
||||
});
|
||||
await page.click(`#btn_${projectName}`);
|
||||
await page.waitForSelector('input[name=emails]', { visible: true });
|
||||
await page.click('input[name=emails]');
|
||||
await page.type('input[name=emails]', member.email);
|
||||
await page.waitForSelector(`#${role}_${projectName}`, {
|
||||
visible: true,
|
||||
});
|
||||
await page.click(`#${role}_${projectName}`);
|
||||
await page.waitForSelector('button[type=submit]', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('button[type=submit]');
|
||||
await page.waitForSelector('button[type=submit]', { hidden: true });
|
||||
await init.logout(page);
|
||||
|
||||
elementHandle = await page.$('#errorMessage', {
|
||||
visible: true,
|
||||
});
|
||||
expect(elementHandle).not.toBe(null);
|
||||
done();
|
||||
|
||||
// Login as member
|
||||
await init.loginUser(member, page);
|
||||
await init.switchProject(projectName, page);
|
||||
await page.waitForSelector('#projectSettings', { visible: true });
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#api', { visible: true });
|
||||
await page.click('#api a');
|
||||
let elementHandle = await page.$('#boxTitle', {
|
||||
visible: true,
|
||||
});
|
||||
expect(elementHandle).toEqual(null);
|
||||
|
||||
elementHandle = await page.$('#errorMessage', {
|
||||
visible: true,
|
||||
});
|
||||
expect(elementHandle).not.toBe(null);
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
|
@ -9,7 +9,7 @@ const email = utils.generateRandomBusinessEmail();
|
||||
const password = '1234567890';
|
||||
const user = {
|
||||
email,
|
||||
password
|
||||
password,
|
||||
};
|
||||
const incidentRequest = {
|
||||
name: 'pyInt',
|
||||
@ -30,66 +30,63 @@ describe('Incoming HTTP Request', () => {
|
||||
page = await browser.newPage();
|
||||
await page.setUserAgent(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
|
||||
);
|
||||
// user
|
||||
await init.registerUser(user, page);
|
||||
);
|
||||
// user
|
||||
await init.registerUser(user, page);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async done => {
|
||||
await browser.close();
|
||||
done();
|
||||
});
|
||||
|
||||
test(
|
||||
'should configure incoming http request to create incident in a project',
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#integrations', { visible: true });
|
||||
await page.click('#integrations');
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#integrations', { visible: true });
|
||||
await page.click('#integrations');
|
||||
|
||||
await page.waitForSelector('#addIncomingRequestBtn', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#addIncomingRequestBtn');
|
||||
await page.waitForSelector('#name', { visible: true });
|
||||
await page.click('#name');
|
||||
await page.type('#name', incidentRequest.name);
|
||||
await page.$eval('#createIncident', elem => elem.click());
|
||||
await page.waitForSelector('#isDefault', { visible: true });
|
||||
await page.$eval('#isDefault', elem => elem.click());
|
||||
await page.click('#advancedOptionsBtn');
|
||||
await page.waitForSelector('#incidentTitle', { visible: true });
|
||||
await page.click('#incidentTitle');
|
||||
await page.type(
|
||||
'#incidentTitle',
|
||||
incidentRequest.incidentTitle
|
||||
);
|
||||
await page.click('#incidentDescription');
|
||||
await page.type(
|
||||
'#incidentDescription',
|
||||
incidentRequest.incidentDescription
|
||||
);
|
||||
await page.waitForSelector('#addIncomingRequestBtn', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#addIncomingRequestBtn');
|
||||
await page.waitForSelector('#name', { visible: true });
|
||||
await page.click('#name');
|
||||
await page.type('#name', incidentRequest.name);
|
||||
await page.$eval('#createIncident', elem => elem.click());
|
||||
await page.waitForSelector('#isDefault', { visible: true });
|
||||
await page.$eval('#isDefault', elem => elem.click());
|
||||
await page.click('#advancedOptionsBtn');
|
||||
await page.waitForSelector('#incidentTitle', { visible: true });
|
||||
await page.click('#incidentTitle');
|
||||
await page.type('#incidentTitle', incidentRequest.incidentTitle);
|
||||
await page.click('#incidentDescription');
|
||||
await page.type(
|
||||
'#incidentDescription',
|
||||
incidentRequest.incidentDescription
|
||||
);
|
||||
|
||||
await page.click('#createIncomingRequest');
|
||||
await page.waitForSelector('#createIncomingRequest', {
|
||||
hidden: true,
|
||||
});
|
||||
await page.waitForSelector('#requestOkBtn', { visible: true });
|
||||
await page.click('#requestOkBtn');
|
||||
await page.waitForSelector('#requestOkBtn', { hidden: true });
|
||||
await page.click('#createIncomingRequest');
|
||||
await page.waitForSelector('#createIncomingRequest', {
|
||||
hidden: true,
|
||||
});
|
||||
await page.waitForSelector('#requestOkBtn', { visible: true });
|
||||
await page.click('#requestOkBtn');
|
||||
await page.waitForSelector('#requestOkBtn', { hidden: true });
|
||||
|
||||
const firstIncomingHttpRequest = await page.waitForSelector(
|
||||
'#copyIncomingRequestBtn_0',
|
||||
{ visible: true }
|
||||
);
|
||||
expect(firstIncomingHttpRequest).toBeDefined();
|
||||
|
||||
const firstIncomingHttpRequest = await page.waitForSelector(
|
||||
'#copyIncomingRequestBtn_0',
|
||||
{ visible: true }
|
||||
);
|
||||
expect(firstIncomingHttpRequest).toBeDefined();
|
||||
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
@ -97,33 +94,33 @@ describe('Incoming HTTP Request', () => {
|
||||
|
||||
test(
|
||||
'should update an incoming http request in a project',
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#integrations', { visible: true });
|
||||
await page.click('#integrations');
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#integrations', { visible: true });
|
||||
await page.click('#integrations');
|
||||
|
||||
await page.waitForSelector('#editIncomingRequestBtn_0', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#editIncomingRequestBtn_0');
|
||||
await page.waitForSelector('#name', { visible: true });
|
||||
await page.click('#name', { clickCount: 3 });
|
||||
// change the name of the incoming http request
|
||||
await page.type('#name', 'newName');
|
||||
await page.click('#editIncomingRequest');
|
||||
await page.waitForSelector('#editIncomingRequest', {
|
||||
hidden: true,
|
||||
});
|
||||
await page.waitForSelector('#editIncomingRequestBtn_0', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#editIncomingRequestBtn_0');
|
||||
await page.waitForSelector('#name', { visible: true });
|
||||
await page.click('#name', { clickCount: 3 });
|
||||
// change the name of the incoming http request
|
||||
await page.type('#name', 'newName');
|
||||
await page.click('#editIncomingRequest');
|
||||
await page.waitForSelector('#editIncomingRequest', {
|
||||
hidden: true,
|
||||
});
|
||||
|
||||
const updatedRequest = await page.waitForSelector(
|
||||
'#incomingRequest_newName',
|
||||
{ visible: true }
|
||||
);
|
||||
expect(updatedRequest).toBeDefined();
|
||||
const updatedRequest = await page.waitForSelector(
|
||||
'#incomingRequest_newName',
|
||||
{ visible: true }
|
||||
);
|
||||
expect(updatedRequest).toBeDefined();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
@ -131,32 +128,32 @@ describe('Incoming HTTP Request', () => {
|
||||
|
||||
test(
|
||||
'should delete an incoming http request in a project',
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#integrations', { visible: true });
|
||||
await page.click('#integrations');
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#integrations', { visible: true });
|
||||
await page.click('#integrations');
|
||||
|
||||
await page.waitForSelector('#deleteIncomingRequestBtn_0', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#deleteIncomingRequestBtn_0');
|
||||
await page.waitForSelector('#deleteIncomingRequestBtn', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#deleteIncomingRequestBtn');
|
||||
await page.waitForSelector('#deleteIncomingRequestBtn', {
|
||||
hidden: true,
|
||||
});
|
||||
await page.waitForSelector('#deleteIncomingRequestBtn_0', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#deleteIncomingRequestBtn_0');
|
||||
await page.waitForSelector('#deleteIncomingRequestBtn', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#deleteIncomingRequestBtn');
|
||||
await page.waitForSelector('#deleteIncomingRequestBtn', {
|
||||
hidden: true,
|
||||
});
|
||||
|
||||
const noIncomingRequest = await page.waitForSelector(
|
||||
'#noIncomingRequest',
|
||||
{ visible: true }
|
||||
);
|
||||
expect(noIncomingRequest).toBeDefined();
|
||||
const noIncomingRequest = await page.waitForSelector(
|
||||
'#noIncomingRequest',
|
||||
{ visible: true }
|
||||
);
|
||||
expect(noIncomingRequest).toBeDefined();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
|
@ -16,8 +16,8 @@ const monitorFieldText = {
|
||||
fieldType: 'number',
|
||||
};
|
||||
const user = {
|
||||
email,
|
||||
password
|
||||
email,
|
||||
password,
|
||||
};
|
||||
|
||||
describe('Monitor Custom Field', () => {
|
||||
@ -26,33 +26,33 @@ describe('Monitor Custom Field', () => {
|
||||
let cluster;
|
||||
beforeAll(async done => {
|
||||
jest.setTimeout(360000);
|
||||
|
||||
|
||||
browser = await puppeteer.launch(utils.puppeteerLaunchConfig);
|
||||
page = await browser.newPage();
|
||||
await page.setUserAgent(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
|
||||
);
|
||||
);
|
||||
// user
|
||||
await init.registerUser(user, page);
|
||||
await init.registerUser(user, page);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async done => {
|
||||
await browser.close();
|
||||
done();
|
||||
});
|
||||
|
||||
test(
|
||||
'should configure monitor custom field in a project',
|
||||
async done => {
|
||||
await init.addCustomField(page, monitorFieldText, 'monitor');
|
||||
async done => {
|
||||
await init.addCustomField(page, monitorFieldText, 'monitor');
|
||||
|
||||
const firstCustomField = await page.waitForSelector(
|
||||
`#customfield_${monitorFieldText.fieldName}`,
|
||||
{ visible: true }
|
||||
);
|
||||
expect(firstCustomField).toBeDefined();
|
||||
const firstCustomField = await page.waitForSelector(
|
||||
`#customfield_${monitorFieldText.fieldName}`,
|
||||
{ visible: true }
|
||||
);
|
||||
expect(firstCustomField).toBeDefined();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
@ -60,45 +60,45 @@ describe('Monitor Custom Field', () => {
|
||||
|
||||
test(
|
||||
'should update a monitor custom field in a project',
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#more', {visible:true});
|
||||
await page.click('#more');
|
||||
await page.waitForSelector('#monitor', { visible: true });
|
||||
await page.click('#monitor');
|
||||
await page.reload({
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await init.gotoTab(2, page);
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#more', { visible: true });
|
||||
await page.click('#more');
|
||||
await page.waitForSelector('#monitor', { visible: true });
|
||||
await page.click('#monitor');
|
||||
await page.reload({
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await init.gotoTab(2, page);
|
||||
|
||||
await page.waitForSelector('#editCustomField_0', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#editCustomField_0');
|
||||
await page.waitForSelector('#customFieldForm', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#fieldName', { clickCount: 3 });
|
||||
await page.type('#fieldName', monitorFieldNumber.fieldName);
|
||||
await init.selectByText(
|
||||
'#fieldType',
|
||||
monitorFieldNumber.fieldType,
|
||||
page
|
||||
);
|
||||
await page.click('#updateCustomField');
|
||||
await page.waitForSelector('#updateCustomField', {
|
||||
hidden: true,
|
||||
});
|
||||
await page.waitForSelector('#editCustomField_0', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#editCustomField_0');
|
||||
await page.waitForSelector('#customFieldForm', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#fieldName', { clickCount: 3 });
|
||||
await page.type('#fieldName', monitorFieldNumber.fieldName);
|
||||
await init.selectByText(
|
||||
'#fieldType',
|
||||
monitorFieldNumber.fieldType,
|
||||
page
|
||||
);
|
||||
await page.click('#updateCustomField');
|
||||
await page.waitForSelector('#updateCustomField', {
|
||||
hidden: true,
|
||||
});
|
||||
|
||||
const updatedField = await page.waitForSelector(
|
||||
`#customfield_${monitorFieldNumber.fieldName}`,
|
||||
{ visible: true }
|
||||
);
|
||||
expect(updatedField).toBeDefined();
|
||||
const updatedField = await page.waitForSelector(
|
||||
`#customfield_${monitorFieldNumber.fieldName}`,
|
||||
{ visible: true }
|
||||
);
|
||||
expect(updatedField).toBeDefined();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
@ -106,38 +106,38 @@ describe('Monitor Custom Field', () => {
|
||||
|
||||
test(
|
||||
'should delete a monitor custom field in a project',
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#more', {visible:true});
|
||||
await page.click('#more');
|
||||
await page.waitForSelector('#monitor', { visible: true });
|
||||
await page.click('#monitor');
|
||||
await page.reload({
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await init.gotoTab(2, page);
|
||||
async done => {
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#projectSettings', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#projectSettings');
|
||||
await page.waitForSelector('#more', { visible: true });
|
||||
await page.click('#more');
|
||||
await page.waitForSelector('#monitor', { visible: true });
|
||||
await page.click('#monitor');
|
||||
await page.reload({
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await init.gotoTab(2, page);
|
||||
|
||||
await page.waitForSelector('#deleteCustomField_0', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#deleteCustomField_0');
|
||||
await page.waitForSelector('#deleteCustomFieldModalBtn', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#deleteCustomFieldModalBtn');
|
||||
await page.waitForSelector('#deleteCustomFieldModalBtn', {
|
||||
hidden: true,
|
||||
});
|
||||
await page.waitForSelector('#deleteCustomField_0', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#deleteCustomField_0');
|
||||
await page.waitForSelector('#deleteCustomFieldModalBtn', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#deleteCustomFieldModalBtn');
|
||||
await page.waitForSelector('#deleteCustomFieldModalBtn', {
|
||||
hidden: true,
|
||||
});
|
||||
|
||||
const noCustomFields = await page.waitForSelector(
|
||||
'#noCustomFields',
|
||||
{ visible: true }
|
||||
);
|
||||
expect(noCustomFields).toBeDefined();
|
||||
const noCustomFields = await page.waitForSelector(
|
||||
'#noCustomFields',
|
||||
{ visible: true }
|
||||
);
|
||||
expect(noCustomFields).toBeDefined();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
|
@ -9,7 +9,7 @@ const email = utils.generateRandomBusinessEmail();
|
||||
const password = '1234567890';
|
||||
const user = {
|
||||
email,
|
||||
password
|
||||
password,
|
||||
};
|
||||
describe('Enterprise Monitor SubProject API', () => {
|
||||
const operationTimeOut = 500000;
|
||||
@ -21,10 +21,10 @@ describe('Enterprise Monitor SubProject API', () => {
|
||||
page = await browser.newPage();
|
||||
await page.setUserAgent(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
|
||||
);
|
||||
);
|
||||
// user
|
||||
await init.registerEnterpriseUser(user, page);
|
||||
|
||||
await init.registerEnterpriseUser(user, page);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
@ -36,48 +36,48 @@ describe('Enterprise Monitor SubProject API', () => {
|
||||
test(
|
||||
'Should create a monitor in sub-project for valid `admin`',
|
||||
async done => {
|
||||
|
||||
const subProjectName = utils.generateRandomString();
|
||||
const componentName = utils.generateRandomString();
|
||||
const subProjectMonitorName = utils.generateRandomString();
|
||||
|
||||
await init.adminLogout(page);
|
||||
await init.loginUser(user, page);
|
||||
//SubProject is only available for 'Growth Plan and above'
|
||||
await init.growthPlanUpgrade(page);
|
||||
await page.reload({
|
||||
waitUntil : 'networkidle0'
|
||||
});
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
|
||||
// add sub-project
|
||||
await init.addSubProject(subProjectName, page);
|
||||
await init.adminLogout(page);
|
||||
await init.loginUser(user, page);
|
||||
//SubProject is only available for 'Growth Plan and above'
|
||||
await init.growthPlanUpgrade(page);
|
||||
await page.reload({
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
|
||||
// Create Component first
|
||||
// Redirects automatically component to details page
|
||||
await init.addComponent(componentName, page);
|
||||
// add sub-project
|
||||
await init.addSubProject(subProjectName, page);
|
||||
|
||||
// switch to invited project for new user
|
||||
await page.waitForSelector('#monitors', {visible:true});
|
||||
await page.waitForSelector('#form-new-monitor', {visible:true});
|
||||
await page.click('input[id=name]');
|
||||
await page.type('input[id=name]', subProjectMonitorName);
|
||||
await page.click('[data-testId=type_url]');
|
||||
await page.waitForSelector('#url', {visible:true});
|
||||
await page.click('#url');
|
||||
await page.type('#url', 'https://google.com');
|
||||
await page.click('button[type=submit]');
|
||||
// Create Component first
|
||||
// Redirects automatically component to details page
|
||||
await init.addComponent(componentName, page);
|
||||
|
||||
let spanElement = await page.waitForSelector(
|
||||
`#monitor-title-${subProjectMonitorName}`, {visible:true}
|
||||
);
|
||||
// switch to invited project for new user
|
||||
await page.waitForSelector('#monitors', { visible: true });
|
||||
await page.waitForSelector('#form-new-monitor', { visible: true });
|
||||
await page.click('input[id=name]');
|
||||
await page.type('input[id=name]', subProjectMonitorName);
|
||||
await page.click('[data-testId=type_url]');
|
||||
await page.waitForSelector('#url', { visible: true });
|
||||
await page.click('#url');
|
||||
await page.type('#url', 'https://google.com');
|
||||
await page.click('button[type=submit]');
|
||||
|
||||
let spanElement = await page.waitForSelector(
|
||||
`#monitor-title-${subProjectMonitorName}`,
|
||||
{ visible: true }
|
||||
);
|
||||
|
||||
spanElement = await spanElement.getProperty('innerText');
|
||||
spanElement = await spanElement.jsonValue();
|
||||
expect(spanElement).toBe(subProjectMonitorName);
|
||||
|
||||
spanElement = await spanElement.getProperty('innerText');
|
||||
spanElement = await spanElement.jsonValue();
|
||||
expect(spanElement).toBe(subProjectMonitorName);
|
||||
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
|
@ -9,26 +9,26 @@ const email = utils.generateRandomBusinessEmail();
|
||||
const password = '1234567890';
|
||||
const user = {
|
||||
email,
|
||||
password
|
||||
password,
|
||||
};
|
||||
describe('New Monitor API', () => {
|
||||
const operationTimeOut = 500000;
|
||||
|
||||
let cluster;
|
||||
beforeAll(async (done) => {
|
||||
beforeAll(async done => {
|
||||
jest.setTimeout(360000);
|
||||
|
||||
|
||||
browser = await puppeteer.launch(utils.puppeteerLaunchConfig);
|
||||
page = await browser.newPage();
|
||||
await page.setUserAgent(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
|
||||
);
|
||||
// user
|
||||
await init.registerUser(user, page);
|
||||
);
|
||||
// user
|
||||
await init.registerUser(user, page);
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async done => {
|
||||
await browser.close();
|
||||
done();
|
||||
});
|
||||
@ -36,44 +36,44 @@ describe('New Monitor API', () => {
|
||||
test(
|
||||
"should show upgrade modal if the current monitor count of a project equals it's monitor limit (Startup plan => 5 Monitors/User)",
|
||||
async done => {
|
||||
const componentName = utils.generateRandomString();
|
||||
// create a component
|
||||
// Redirects automatically component to details page
|
||||
await init.addComponent(componentName, page);
|
||||
const componentName = utils.generateRandomString();
|
||||
// create a component
|
||||
// Redirects automatically component to details page
|
||||
await init.addComponent(componentName, page);
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const monitorName = utils.generateRandomString();
|
||||
|
||||
await init.addNewMonitorToComponent(
|
||||
page,
|
||||
componentName,
|
||||
monitorName
|
||||
);
|
||||
await page.waitForSelector('.ball-beat', { hidden: true });
|
||||
}
|
||||
// try to add more monitor
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const monitorName = utils.generateRandomString();
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#components', { visible: true });
|
||||
await page.click('#components');
|
||||
await page.waitForSelector('#component0', { visible: true });
|
||||
await page.click(`#more-details-${componentName}`);
|
||||
await page.waitForSelector('#form-new-monitor', { visible: true });
|
||||
await page.waitForSelector('input[id=name]', { visible: true });
|
||||
await page.click('input[id=name]');
|
||||
await page.type('input[id=name]', monitorName);
|
||||
// Added new URL-Montior
|
||||
await page.click('[data-testId=type_url]');
|
||||
await page.waitForSelector('#url', { visible: true });
|
||||
await page.click('#url');
|
||||
await page.type('#url', 'https://google.com');
|
||||
await page.click('button[type=submit]');
|
||||
|
||||
const pricingPlanModal = await page.waitForSelector(
|
||||
'#pricingPlanModal',
|
||||
{ visible: true }
|
||||
await init.addNewMonitorToComponent(
|
||||
page,
|
||||
componentName,
|
||||
monitorName
|
||||
);
|
||||
expect(pricingPlanModal).toBeTruthy();
|
||||
await page.waitForSelector('.ball-beat', { hidden: true });
|
||||
}
|
||||
// try to add more monitor
|
||||
const monitorName = utils.generateRandomString();
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#components', { visible: true });
|
||||
await page.click('#components');
|
||||
await page.waitForSelector('#component0', { visible: true });
|
||||
await page.click(`#more-details-${componentName}`);
|
||||
await page.waitForSelector('#form-new-monitor', { visible: true });
|
||||
await page.waitForSelector('input[id=name]', { visible: true });
|
||||
await page.click('input[id=name]');
|
||||
await page.type('input[id=name]', monitorName);
|
||||
// Added new URL-Montior
|
||||
await page.click('[data-testId=type_url]');
|
||||
await page.waitForSelector('#url', { visible: true });
|
||||
await page.click('#url');
|
||||
await page.type('#url', 'https://google.com');
|
||||
await page.click('button[type=submit]');
|
||||
|
||||
const pricingPlanModal = await page.waitForSelector(
|
||||
'#pricingPlanModal',
|
||||
{ visible: true }
|
||||
);
|
||||
expect(pricingPlanModal).toBeTruthy();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
@ -83,45 +83,45 @@ describe('New Monitor API', () => {
|
||||
"should show upgrade modal if the current monitor count of a project equals it's monitor limit (Growth plan => 10 Monitors/User)",
|
||||
async done => {
|
||||
const projectName = utils.generateRandomString();
|
||||
const componentName = utils.generateRandomString();
|
||||
await init.addGrowthProject(projectName, page);
|
||||
// create a component
|
||||
// Redirects automatically component to details page
|
||||
await init.addComponent(componentName, page);
|
||||
const componentName = utils.generateRandomString();
|
||||
await init.addGrowthProject(projectName, page);
|
||||
// create a component
|
||||
// Redirects automatically component to details page
|
||||
await init.addComponent(componentName, page);
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const monitorName = utils.generateRandomString();
|
||||
|
||||
await init.addNewMonitorToComponent(
|
||||
page,
|
||||
componentName,
|
||||
monitorName
|
||||
);
|
||||
await page.waitForSelector('.ball-beat', { hidden: true });
|
||||
}
|
||||
// try to add more monitor
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const monitorName = utils.generateRandomString();
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#components', { visible: true });
|
||||
await page.click('#components');
|
||||
await page.waitForSelector('#component0', { visible: true });
|
||||
await page.click(`#more-details-${componentName}`);
|
||||
await page.waitForSelector('#form-new-monitor', { visible: true });
|
||||
await page.waitForSelector('input[id=name]', { visible: true });
|
||||
await page.click('input[id=name]');
|
||||
await page.type('input[id=name]', monitorName);
|
||||
// Added new URL-Montior
|
||||
await page.click('[data-testId=type_url]');
|
||||
await page.waitForSelector('#url', { visible: true });
|
||||
await page.click('#url');
|
||||
await page.type('#url', 'https://google.com');
|
||||
await page.click('button[type=submit]');
|
||||
|
||||
const pricingPlanModal = await page.waitForSelector(
|
||||
'#pricingPlanModal',
|
||||
{ visible: true }
|
||||
await init.addNewMonitorToComponent(
|
||||
page,
|
||||
componentName,
|
||||
monitorName
|
||||
);
|
||||
expect(pricingPlanModal).toBeTruthy();
|
||||
await page.waitForSelector('.ball-beat', { hidden: true });
|
||||
}
|
||||
// try to add more monitor
|
||||
const monitorName = utils.generateRandomString();
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#components', { visible: true });
|
||||
await page.click('#components');
|
||||
await page.waitForSelector('#component0', { visible: true });
|
||||
await page.click(`#more-details-${componentName}`);
|
||||
await page.waitForSelector('#form-new-monitor', { visible: true });
|
||||
await page.waitForSelector('input[id=name]', { visible: true });
|
||||
await page.click('input[id=name]');
|
||||
await page.type('input[id=name]', monitorName);
|
||||
// Added new URL-Montior
|
||||
await page.click('[data-testId=type_url]');
|
||||
await page.waitForSelector('#url', { visible: true });
|
||||
await page.click('#url');
|
||||
await page.type('#url', 'https://google.com');
|
||||
await page.click('button[type=submit]');
|
||||
|
||||
const pricingPlanModal = await page.waitForSelector(
|
||||
'#pricingPlanModal',
|
||||
{ visible: true }
|
||||
);
|
||||
expect(pricingPlanModal).toBeTruthy();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
@ -131,46 +131,46 @@ describe('New Monitor API', () => {
|
||||
'should not show any upgrade modal if the project plan is on Scale plan and above',
|
||||
async done => {
|
||||
const projectName = utils.generateRandomString();
|
||||
const componentName = utils.generateRandomString();
|
||||
await init.addScaleProject(projectName, page);
|
||||
// create a component
|
||||
// Redirects automatically component to details page
|
||||
await init.addComponent(componentName, page);
|
||||
const componentName = utils.generateRandomString();
|
||||
await init.addScaleProject(projectName, page);
|
||||
// create a component
|
||||
// Redirects automatically component to details page
|
||||
await init.addComponent(componentName, page);
|
||||
|
||||
for (let i = 0; i < 15; i++) {
|
||||
const monitorName = utils.generateRandomString();
|
||||
|
||||
await init.addNewMonitorToComponent(
|
||||
page,
|
||||
componentName,
|
||||
monitorName
|
||||
);
|
||||
await page.waitForSelector('.ball-beat', { hidden: true });
|
||||
}
|
||||
|
||||
// try to add more monitor
|
||||
for (let i = 0; i < 15; i++) {
|
||||
const monitorName = utils.generateRandomString();
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#components', { visible: true });
|
||||
await page.click('#components');
|
||||
await page.waitForSelector('#component0', { visible: true });
|
||||
await page.click(`#more-details-${componentName}`);
|
||||
await page.waitForSelector('#form-new-monitor');
|
||||
await page.waitForSelector('input[id=name]');
|
||||
await page.click('input[id=name]');
|
||||
await page.type('input[id=name]', monitorName);
|
||||
// Added new URL-Montior
|
||||
await page.click('[data-testId=type_url]');
|
||||
await page.waitForSelector('#url');
|
||||
await page.click('#url');
|
||||
await page.type('#url', 'https://google.com');
|
||||
await page.click('button[type=submit]');
|
||||
|
||||
const pricingPlanModal = await page.waitForSelector(
|
||||
'#pricingPlanModal',
|
||||
{ hidden: true }
|
||||
await init.addNewMonitorToComponent(
|
||||
page,
|
||||
componentName,
|
||||
monitorName
|
||||
);
|
||||
expect(pricingPlanModal).toBeNull();
|
||||
await page.waitForSelector('.ball-beat', { hidden: true });
|
||||
}
|
||||
|
||||
// try to add more monitor
|
||||
const monitorName = utils.generateRandomString();
|
||||
await page.goto(utils.DASHBOARD_URL);
|
||||
await page.waitForSelector('#components', { visible: true });
|
||||
await page.click('#components');
|
||||
await page.waitForSelector('#component0', { visible: true });
|
||||
await page.click(`#more-details-${componentName}`);
|
||||
await page.waitForSelector('#form-new-monitor');
|
||||
await page.waitForSelector('input[id=name]');
|
||||
await page.click('input[id=name]');
|
||||
await page.type('input[id=name]', monitorName);
|
||||
// Added new URL-Montior
|
||||
await page.click('[data-testId=type_url]');
|
||||
await page.waitForSelector('#url');
|
||||
await page.click('#url');
|
||||
await page.type('#url', 'https://google.com');
|
||||
await page.click('button[type=submit]');
|
||||
|
||||
const pricingPlanModal = await page.waitForSelector(
|
||||
'#pricingPlanModal',
|
||||
{ hidden: true }
|
||||
);
|
||||
expect(pricingPlanModal).toBeNull();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
|
@ -10,7 +10,7 @@ const password = '1234567890';
|
||||
const pageName = utils.generateRandomString();
|
||||
const user = {
|
||||
email,
|
||||
password
|
||||
password,
|
||||
};
|
||||
|
||||
describe('Status Page', () => {
|
||||
@ -19,64 +19,63 @@ describe('Status Page', () => {
|
||||
let cluster;
|
||||
beforeAll(async () => {
|
||||
jest.setTimeout(360000);
|
||||
|
||||
|
||||
browser = await puppeteer.launch(utils.puppeteerLaunchConfig);
|
||||
page = await browser.newPage();
|
||||
await page.setUserAgent(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
|
||||
);
|
||||
// user
|
||||
await init.registerEnterpriseUser(user, page);
|
||||
await init.adminLogout(page);
|
||||
// user
|
||||
await init.registerEnterpriseUser(user, page);
|
||||
await init.adminLogout(page);
|
||||
});
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async done => {
|
||||
await browser.close();
|
||||
done();
|
||||
});
|
||||
|
||||
test(
|
||||
'should not show upgrade modal if IS_SAAS_SERVICE is false',
|
||||
async (done) => {
|
||||
|
||||
await init.loginUser(user, page);
|
||||
//Pricing Plan is selectable for a user under growth plane.
|
||||
await init.growthPlanUpgrade(page);
|
||||
await page.reload({
|
||||
waitUntil : 'networkidle0'
|
||||
});
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await page.$eval('#statusPages', elem => elem.click());
|
||||
await page.waitForSelector(
|
||||
'button[type="button"] .bs-FileUploadButton', {visible: true}
|
||||
);
|
||||
await page.click('button[type="button"] .bs-FileUploadButton');
|
||||
await page.waitForSelector('#name', {visible: true});
|
||||
await page.click('#name');
|
||||
await page.type('#name', pageName);
|
||||
await page.click('#btnCreateStatusPage');
|
||||
// select the first item from the table row
|
||||
const rowItem = await page.waitForSelector(
|
||||
'#statusPagesListContainer > tr',
|
||||
{ visible: true }
|
||||
);
|
||||
rowItem.click();
|
||||
await page.waitForSelector('ul#customTabList > li', {
|
||||
visible: true,
|
||||
});
|
||||
await page.$$eval('ul#customTabList > li', elems =>
|
||||
elems[5].click() // 'isPrivate' is under 'Advanced options' which is the last tab
|
||||
);
|
||||
await page.$eval('input[name="isPrivate"]', elem =>
|
||||
elem.click()
|
||||
);
|
||||
async done => {
|
||||
await init.loginUser(user, page);
|
||||
//Pricing Plan is selectable for a user under growth plane.
|
||||
await init.growthPlanUpgrade(page);
|
||||
await page.reload({
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await page.$eval('#statusPages', elem => elem.click());
|
||||
await page.waitForSelector(
|
||||
'button[type="button"] .bs-FileUploadButton',
|
||||
{ visible: true }
|
||||
);
|
||||
await page.click('button[type="button"] .bs-FileUploadButton');
|
||||
await page.waitForSelector('#name', { visible: true });
|
||||
await page.click('#name');
|
||||
await page.type('#name', pageName);
|
||||
await page.click('#btnCreateStatusPage');
|
||||
// select the first item from the table row
|
||||
const rowItem = await page.waitForSelector(
|
||||
'#statusPagesListContainer > tr',
|
||||
{ visible: true }
|
||||
);
|
||||
rowItem.click();
|
||||
await page.waitForSelector('ul#customTabList > li', {
|
||||
visible: true,
|
||||
});
|
||||
await page.$$eval(
|
||||
'ul#customTabList > li',
|
||||
elems => elems[5].click() // 'isPrivate' is under 'Advanced options' which is the last tab
|
||||
);
|
||||
await page.$eval('input[name="isPrivate"]', elem => elem.click());
|
||||
|
||||
const modal = await page.$('#pricingPlanModal');
|
||||
const modal = await page.$('#pricingPlanModal');
|
||||
|
||||
expect(modal).toBeNull();
|
||||
done();
|
||||
expect(modal).toBeNull();
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
|
@ -14,7 +14,7 @@ const projectViewer = {
|
||||
};
|
||||
const user = {
|
||||
email,
|
||||
password
|
||||
password,
|
||||
};
|
||||
const role = 'Viewer';
|
||||
|
||||
@ -29,219 +29,231 @@ describe('Sub-Project API', () => {
|
||||
page = await browser.newPage();
|
||||
await page.setUserAgent(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
|
||||
);
|
||||
// user
|
||||
await init.registerEnterpriseUser(user, page);
|
||||
await init.createUserFromAdminDashboard(projectViewer, page);
|
||||
);
|
||||
// user
|
||||
await init.registerEnterpriseUser(user, page);
|
||||
await init.createUserFromAdminDashboard(projectViewer, page);
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async done => {
|
||||
await browser.close();
|
||||
done();
|
||||
});
|
||||
|
||||
test(
|
||||
'should create a new sub-project',
|
||||
async done => {
|
||||
// await page.goto(utils.DASHBOARD_URL, {
|
||||
// waitUntil: 'networkidle0',
|
||||
// });
|
||||
//Growth Plan is needed for a subproject
|
||||
await init.growthPlanUpgrade(page);
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
async done => {
|
||||
// await page.goto(utils.DASHBOARD_URL, {
|
||||
// waitUntil: 'networkidle0',
|
||||
// });
|
||||
//Growth Plan is needed for a subproject
|
||||
await init.growthPlanUpgrade(page);
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
|
||||
await init.renameProject(newProjectName, page);
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await page.waitForSelector('#projectSettings',{visible:true});
|
||||
await page.click('#projectSettings');
|
||||
|
||||
await page.waitForSelector('#btn_Add_SubProjects', {visible: true});
|
||||
await page.click('#btn_Add_SubProjects');
|
||||
await page.waitForSelector('#title', {visible: true});
|
||||
await page.type('#title', subProjectName);
|
||||
await page.click('#btnAddSubProjects');
|
||||
await page.waitForSelector('#title', { hidden: true });
|
||||
const subProjectSelector = await page.waitForSelector(
|
||||
`#sub_project_name_${subProjectName}`,
|
||||
{ visible: true }
|
||||
);
|
||||
await init.renameProject(newProjectName, page);
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await page.waitForSelector('#projectSettings', { visible: true });
|
||||
await page.click('#projectSettings');
|
||||
|
||||
expect(
|
||||
await (
|
||||
await subProjectSelector.getProperty('textContent')
|
||||
).jsonValue()
|
||||
).toEqual(subProjectName);
|
||||
await page.waitForSelector('#btn_Add_SubProjects', {
|
||||
visible: true,
|
||||
});
|
||||
await page.click('#btn_Add_SubProjects');
|
||||
await page.waitForSelector('#title', { visible: true });
|
||||
await page.type('#title', subProjectName);
|
||||
await page.click('#btnAddSubProjects');
|
||||
await page.waitForSelector('#title', { hidden: true });
|
||||
const subProjectSelector = await page.waitForSelector(
|
||||
`#sub_project_name_${subProjectName}`,
|
||||
{ visible: true }
|
||||
);
|
||||
|
||||
expect(
|
||||
await (
|
||||
await subProjectSelector.getProperty('textContent')
|
||||
).jsonValue()
|
||||
).toEqual(subProjectName);
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
|
||||
test('should invite viewer to a subproject', async (done) => {
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await page.waitForSelector('#teamMembers', {visible: true});
|
||||
await page.click('#teamMembers');
|
||||
let prevMemberCount = await page.$eval(
|
||||
`#count_${subProjectName}`,
|
||||
elem => elem.textContent
|
||||
);
|
||||
prevMemberCount = Number(prevMemberCount.split(' ')[0]);
|
||||
await page.waitForSelector(`button[id=btn_${subProjectName}]`, {visible: true});
|
||||
await page.click(`button[id=btn_${subProjectName}]`);
|
||||
await page.waitForSelector(`#frm_${subProjectName}`, {visible: true});
|
||||
await page.type('input[name=emails]', email);
|
||||
await page.click(`#${role}_${subProjectName}`);
|
||||
await page.waitForSelector(`#btn_modal_${subProjectName}`, {visible: true});
|
||||
await page.click(`#btn_modal_${subProjectName}`);
|
||||
await page.waitForSelector(`#btn_modal_${subProjectName}`, {
|
||||
hidden: true,
|
||||
});
|
||||
await page.waitForSelector(`#count_${subProjectName}`, {visible: true});
|
||||
let memberCount = await page.$eval(
|
||||
`#count_${subProjectName}`,
|
||||
elem => elem.textContent
|
||||
);
|
||||
memberCount = Number(memberCount.split(' ')[0]);
|
||||
expect(memberCount).toEqual(prevMemberCount + 1);
|
||||
done();
|
||||
test('should invite viewer to a subproject', async done => {
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await page.waitForSelector('#teamMembers', { visible: true });
|
||||
await page.click('#teamMembers');
|
||||
let prevMemberCount = await page.$eval(
|
||||
`#count_${subProjectName}`,
|
||||
elem => elem.textContent
|
||||
);
|
||||
prevMemberCount = Number(prevMemberCount.split(' ')[0]);
|
||||
await page.waitForSelector(`button[id=btn_${subProjectName}]`, {
|
||||
visible: true,
|
||||
});
|
||||
await page.click(`button[id=btn_${subProjectName}]`);
|
||||
await page.waitForSelector(`#frm_${subProjectName}`, { visible: true });
|
||||
await page.type('input[name=emails]', email);
|
||||
await page.click(`#${role}_${subProjectName}`);
|
||||
await page.waitForSelector(`#btn_modal_${subProjectName}`, {
|
||||
visible: true,
|
||||
});
|
||||
await page.click(`#btn_modal_${subProjectName}`);
|
||||
await page.waitForSelector(`#btn_modal_${subProjectName}`, {
|
||||
hidden: true,
|
||||
});
|
||||
await page.waitForSelector(`#count_${subProjectName}`, {
|
||||
visible: true,
|
||||
});
|
||||
let memberCount = await page.$eval(
|
||||
`#count_${subProjectName}`,
|
||||
elem => elem.textContent
|
||||
);
|
||||
memberCount = Number(memberCount.split(' ')[0]);
|
||||
expect(memberCount).toEqual(prevMemberCount + 1);
|
||||
done();
|
||||
});
|
||||
|
||||
test('should invite viewer to a project', async (done) => {
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await page.waitForSelector('#teamMembers', {visible: true});
|
||||
await page.click('#teamMembers');
|
||||
await page.waitForSelector(`#count_${newProjectName}`, {visible: true});
|
||||
let prevMemberCount = await page.$eval(
|
||||
`#count_${newProjectName}`,
|
||||
elem => elem.textContent
|
||||
);
|
||||
prevMemberCount = Number(prevMemberCount.split(' ')[0]);
|
||||
test('should invite viewer to a project', async done => {
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await page.waitForSelector('#teamMembers', { visible: true });
|
||||
await page.click('#teamMembers');
|
||||
await page.waitForSelector(`#count_${newProjectName}`, {
|
||||
visible: true,
|
||||
});
|
||||
let prevMemberCount = await page.$eval(
|
||||
`#count_${newProjectName}`,
|
||||
elem => elem.textContent
|
||||
);
|
||||
prevMemberCount = Number(prevMemberCount.split(' ')[0]);
|
||||
|
||||
await page.waitForSelector(`button[id=btn_${newProjectName}]`, {visible: true});
|
||||
await page.click(`button[id=btn_${newProjectName}]`);
|
||||
await page.waitForSelector(`#frm_${newProjectName}`, {visible: true});
|
||||
await page.type('input[name=emails]', projectViewer.email);
|
||||
await page.click(`#${role}_${newProjectName}`);
|
||||
await page.waitForSelector(`#btn_modal_${newProjectName}`, {visible: true});
|
||||
await page.click(`#btn_modal_${newProjectName}`);
|
||||
const elem = await page.$('button[id=btnConfirmInvite]');
|
||||
elem.click();
|
||||
await page.waitForSelector(`#btn_modal_${newProjectName}`, {
|
||||
hidden: true,
|
||||
});
|
||||
await page.waitForSelector(`#count_${newProjectName}`, {visible: true});
|
||||
let memberCount = await page.$eval(
|
||||
`#count_${newProjectName}`,
|
||||
elem => elem.textContent
|
||||
);
|
||||
memberCount = Number(memberCount.split(' ')[0]);
|
||||
expect(memberCount).toEqual(prevMemberCount + 1);
|
||||
done();
|
||||
await page.waitForSelector(`button[id=btn_${newProjectName}]`, {
|
||||
visible: true,
|
||||
});
|
||||
await page.click(`button[id=btn_${newProjectName}]`);
|
||||
await page.waitForSelector(`#frm_${newProjectName}`, { visible: true });
|
||||
await page.type('input[name=emails]', projectViewer.email);
|
||||
await page.click(`#${role}_${newProjectName}`);
|
||||
await page.waitForSelector(`#btn_modal_${newProjectName}`, {
|
||||
visible: true,
|
||||
});
|
||||
await page.click(`#btn_modal_${newProjectName}`);
|
||||
const elem = await page.$('button[id=btnConfirmInvite]');
|
||||
elem.click();
|
||||
await page.waitForSelector(`#btn_modal_${newProjectName}`, {
|
||||
hidden: true,
|
||||
});
|
||||
await page.waitForSelector(`#count_${newProjectName}`, {
|
||||
visible: true,
|
||||
});
|
||||
let memberCount = await page.$eval(
|
||||
`#count_${newProjectName}`,
|
||||
elem => elem.textContent
|
||||
);
|
||||
memberCount = Number(memberCount.split(' ')[0]);
|
||||
expect(memberCount).toEqual(prevMemberCount + 1);
|
||||
done();
|
||||
});
|
||||
|
||||
test('should create a status page', async (done) => {
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await page.waitForSelector('#statusPages', {visible: true});
|
||||
await page.click('#statusPages');
|
||||
await page.waitForSelector(`#status_page_count_${newProjectName}`, {visible: true});
|
||||
let oldStatusPageCounter = await page.$eval(
|
||||
`#status_page_count_${newProjectName}`,
|
||||
elem => elem.textContent
|
||||
);
|
||||
oldStatusPageCounter = Number(oldStatusPageCounter.split(' ')[0]);
|
||||
await init.addStatusPageToProject(
|
||||
statusPageName,
|
||||
newProjectName,
|
||||
page
|
||||
);
|
||||
await page.waitForSelector(`#status_page_count_${newProjectName}`, {visible: true});
|
||||
let statusPageCounter = await page.$eval(
|
||||
`#status_page_count_${newProjectName}`,
|
||||
elem => elem.textContent
|
||||
);
|
||||
statusPageCounter = Number(statusPageCounter.split(' ')[0]);
|
||||
expect(statusPageCounter).toEqual(oldStatusPageCounter + 1);
|
||||
done();
|
||||
test('should create a status page', async done => {
|
||||
await page.goto(utils.DASHBOARD_URL, {
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await page.waitForSelector('#statusPages', { visible: true });
|
||||
await page.click('#statusPages');
|
||||
await page.waitForSelector(`#status_page_count_${newProjectName}`, {
|
||||
visible: true,
|
||||
});
|
||||
let oldStatusPageCounter = await page.$eval(
|
||||
`#status_page_count_${newProjectName}`,
|
||||
elem => elem.textContent
|
||||
);
|
||||
oldStatusPageCounter = Number(oldStatusPageCounter.split(' ')[0]);
|
||||
await init.addStatusPageToProject(statusPageName, newProjectName, page);
|
||||
await page.waitForSelector(`#status_page_count_${newProjectName}`, {
|
||||
visible: true,
|
||||
});
|
||||
let statusPageCounter = await page.$eval(
|
||||
`#status_page_count_${newProjectName}`,
|
||||
elem => elem.textContent
|
||||
);
|
||||
statusPageCounter = Number(statusPageCounter.split(' ')[0]);
|
||||
expect(statusPageCounter).toEqual(oldStatusPageCounter + 1);
|
||||
done();
|
||||
});
|
||||
|
||||
test(
|
||||
'should display subproject status pages to a subproject viewer',
|
||||
async (done) => {
|
||||
// Login as viewer
|
||||
await init.logout(page);
|
||||
await init.loginUser({ email, password }, page);
|
||||
await page.waitForSelector('#AccountSwitcherId', {visible: true});
|
||||
await page.click('#AccountSwitcherId');
|
||||
await page.waitForSelector('#accountSwitcher', {visible: true});
|
||||
const element = await page.$(
|
||||
`#accountSwitcher > div[title=${newProjectName}]`
|
||||
);
|
||||
element.click();
|
||||
await page.waitForSelector('#statusPageTable_0', {visible: true});
|
||||
const projectStatusPages = await page.$('#statusPageTable');
|
||||
expect(projectStatusPages).toEqual(null);
|
||||
async done => {
|
||||
// Login as viewer
|
||||
await init.logout(page);
|
||||
await init.loginUser({ email, password }, page);
|
||||
await page.waitForSelector('#AccountSwitcherId', { visible: true });
|
||||
await page.click('#AccountSwitcherId');
|
||||
await page.waitForSelector('#accountSwitcher', { visible: true });
|
||||
const element = await page.$(
|
||||
`#accountSwitcher > div[title=${newProjectName}]`
|
||||
);
|
||||
element.click();
|
||||
await page.waitForSelector('#statusPageTable_0', { visible: true });
|
||||
const projectStatusPages = await page.$('#statusPageTable');
|
||||
expect(projectStatusPages).toEqual(null);
|
||||
|
||||
const subProjectStatusPages = await page.$(
|
||||
'#statusPageTable_0'
|
||||
);
|
||||
expect(subProjectStatusPages).not.toEqual(null);
|
||||
done();
|
||||
const subProjectStatusPages = await page.$('#statusPageTable_0');
|
||||
expect(subProjectStatusPages).not.toEqual(null);
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
|
||||
test(
|
||||
'should display project and subproject status pages to project viewers',
|
||||
async (done) => {
|
||||
await init.logout(page);
|
||||
await init.loginUser(projectViewer, page);
|
||||
await page.waitForSelector('#AccountSwitcherId', {visible: true});
|
||||
await page.click('#AccountSwitcherId');
|
||||
await page.waitForSelector('#accountSwitcher', {visible: true});
|
||||
const element = await page.$(
|
||||
`#accountSwitcher > div[title=${newProjectName}]`
|
||||
);
|
||||
element.click();
|
||||
await page.waitForSelector('#statusPageTable_0', {visible: true});
|
||||
const projectStatusPages = await page.$('#statusPageTable');
|
||||
expect(projectStatusPages).not.toEqual(null);
|
||||
async done => {
|
||||
await init.logout(page);
|
||||
await init.loginUser(projectViewer, page);
|
||||
await page.waitForSelector('#AccountSwitcherId', { visible: true });
|
||||
await page.click('#AccountSwitcherId');
|
||||
await page.waitForSelector('#accountSwitcher', { visible: true });
|
||||
const element = await page.$(
|
||||
`#accountSwitcher > div[title=${newProjectName}]`
|
||||
);
|
||||
element.click();
|
||||
await page.waitForSelector('#statusPageTable_0', { visible: true });
|
||||
const projectStatusPages = await page.$('#statusPageTable');
|
||||
expect(projectStatusPages).not.toEqual(null);
|
||||
|
||||
const subProjectStatusPages = await page.$(
|
||||
'#statusPageTable_0'
|
||||
);
|
||||
expect(subProjectStatusPages).not.toEqual(null);
|
||||
done();
|
||||
const subProjectStatusPages = await page.$('#statusPageTable_0');
|
||||
expect(subProjectStatusPages).not.toEqual(null);
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
|
||||
test('should redirect viewer to external status page', async (done) => {
|
||||
await init.logout(page);
|
||||
await init.loginUser(projectViewer, page);
|
||||
await page.waitForSelector('#AccountSwitcherId', {visible: true});
|
||||
await page.click('#AccountSwitcherId');
|
||||
await page.waitForSelector('#accountSwitcher', {visible: true});
|
||||
const element = await page.$(
|
||||
`#accountSwitcher > div[title=${newProjectName}]`
|
||||
);
|
||||
element.click();
|
||||
const rowItem = await page.waitForSelector(
|
||||
'#statusPagesListContainer > tr',
|
||||
{ visible: true }
|
||||
);
|
||||
rowItem.click();
|
||||
const statusPage = await page.$(`#cb${statusPageName}`);
|
||||
expect(statusPage).toEqual(null);
|
||||
done();
|
||||
test('should redirect viewer to external status page', async done => {
|
||||
await init.logout(page);
|
||||
await init.loginUser(projectViewer, page);
|
||||
await page.waitForSelector('#AccountSwitcherId', { visible: true });
|
||||
await page.click('#AccountSwitcherId');
|
||||
await page.waitForSelector('#accountSwitcher', { visible: true });
|
||||
const element = await page.$(
|
||||
`#accountSwitcher > div[title=${newProjectName}]`
|
||||
);
|
||||
element.click();
|
||||
const rowItem = await page.waitForSelector(
|
||||
'#statusPagesListContainer > tr',
|
||||
{ visible: true }
|
||||
);
|
||||
rowItem.click();
|
||||
const statusPage = await page.$(`#cb${statusPageName}`);
|
||||
expect(statusPage).toEqual(null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -20,48 +20,54 @@ describe('Enterprise Team SubProject API', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
jest.setTimeout(500000);
|
||||
|
||||
|
||||
browser = await puppeteer.launch(utils.puppeteerLaunchConfig);
|
||||
page = await browser.newPage();
|
||||
await page.setUserAgent(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
|
||||
);
|
||||
// Register users
|
||||
await init.registerEnterpriseUser(user, page);
|
||||
await init.createUserFromAdminDashboard(newUser, page);
|
||||
await init.adminLogout(page);
|
||||
// Register users
|
||||
await init.registerEnterpriseUser(user, page);
|
||||
await init.createUserFromAdminDashboard(newUser, page);
|
||||
await init.adminLogout(page);
|
||||
});
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async done => {
|
||||
await browser.close();
|
||||
done();
|
||||
});
|
||||
|
||||
test(
|
||||
'Should add a new user to sub-project (role -> `Member`)',
|
||||
async (done) => {
|
||||
const subProjectName = utils.generateRandomString();
|
||||
async done => {
|
||||
const subProjectName = utils.generateRandomString();
|
||||
|
||||
await init.loginUser(user, page);
|
||||
//SubProject is only available for 'Growth Plan and above'
|
||||
await init.growthPlanUpgrade(page);
|
||||
await page.reload({
|
||||
waitUntil : 'networkidle0'
|
||||
});
|
||||
await init.addSubProject(subProjectName, page);
|
||||
const role = 'Member';
|
||||
await init.loginUser(user, page);
|
||||
//SubProject is only available for 'Growth Plan and above'
|
||||
await init.growthPlanUpgrade(page);
|
||||
await page.reload({
|
||||
waitUntil: 'networkidle0',
|
||||
});
|
||||
await init.addSubProject(subProjectName, page);
|
||||
const role = 'Member';
|
||||
|
||||
await page.waitForSelector('#teamMembers',{visible: true});
|
||||
await page.click('#teamMembers');
|
||||
await page.waitForSelector(`#btn_${subProjectName}`,{visible: true});
|
||||
await page.click(`#btn_${subProjectName}`);
|
||||
await page.waitForSelector(`#frm_${subProjectName}`,{visible: true});
|
||||
await page.click(`#emails_${subProjectName}`);
|
||||
await page.type(`#emails_${subProjectName}`, newUser.email);
|
||||
await page.click(`#${role}_${subProjectName}`);
|
||||
await page.click(`#btn_modal_${subProjectName}`);
|
||||
await page.waitForSelector(`#btn_modal_${subProjectName}`,{hidden: true});
|
||||
done();
|
||||
await page.waitForSelector('#teamMembers', { visible: true });
|
||||
await page.click('#teamMembers');
|
||||
await page.waitForSelector(`#btn_${subProjectName}`, {
|
||||
visible: true,
|
||||
});
|
||||
await page.click(`#btn_${subProjectName}`);
|
||||
await page.waitForSelector(`#frm_${subProjectName}`, {
|
||||
visible: true,
|
||||
});
|
||||
await page.click(`#emails_${subProjectName}`);
|
||||
await page.type(`#emails_${subProjectName}`, newUser.email);
|
||||
await page.click(`#${role}_${subProjectName}`);
|
||||
await page.click(`#btn_modal_${subProjectName}`);
|
||||
await page.waitForSelector(`#btn_modal_${subProjectName}`, {
|
||||
hidden: true,
|
||||
});
|
||||
done();
|
||||
},
|
||||
operationTimeOut
|
||||
);
|
||||
|
@ -94,7 +94,8 @@ app.get('/product/public-status-page', function(req, res) {
|
||||
cta: true,
|
||||
blackLogo: false,
|
||||
requestDemoCta: false,
|
||||
footerCtaText: "Start with Status Pages, expand into everything else. Sign up today."
|
||||
footerCtaText:
|
||||
'Start with Status Pages, expand into everything else. Sign up today.',
|
||||
});
|
||||
});
|
||||
|
||||
@ -109,7 +110,8 @@ app.get('/product/private-status-page', function(req, res) {
|
||||
cta: true,
|
||||
blackLogo: false,
|
||||
requestDemoCta: false,
|
||||
footerCtaText: "Start with Status Pages, expand into everything else. Sign up today."
|
||||
footerCtaText:
|
||||
'Start with Status Pages, expand into everything else. Sign up today.',
|
||||
});
|
||||
});
|
||||
|
||||
@ -277,7 +279,8 @@ app.get('/product/api-monitoring', function(req, res) {
|
||||
cta: true,
|
||||
blackLogo: false,
|
||||
requestDemoCta: false,
|
||||
footerCtaText: "Start with API monitoring, expand into everything else. Sign up today."
|
||||
footerCtaText:
|
||||
'Start with API monitoring, expand into everything else. Sign up today.',
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,7 @@ async function run() {
|
||||
});
|
||||
for (let i = 0; i < statusPages.length; i++) {
|
||||
let { name } = statusPages[i];
|
||||
name = slugify(name || "statuspage");
|
||||
name = slugify(name || 'statuspage');
|
||||
name = `${name}-${generate('1234567890', 8)}`;
|
||||
statusPages[i].slug = name.toLowerCase();
|
||||
await update(
|
||||
|
@ -9,7 +9,7 @@ async function run() {
|
||||
});
|
||||
for (let i = 0; i < schedules.length; i++) {
|
||||
let { name } = schedules[i];
|
||||
name = slugify(name || "schedules");
|
||||
name = slugify(name || 'schedules');
|
||||
name = `${name}-${generate('1234567890', 8)}`;
|
||||
schedules[i].slug = name.toLowerCase();
|
||||
await update(
|
||||
|
Loading…
Reference in New Issue
Block a user