Skip to content

Commit

Permalink
Merge pull request #270 from giranm/release/v0.4.0-beta.0
Browse files Browse the repository at this point in the history
[Release] v0.4.0 beta.0
  • Loading branch information
gsreynolds authored Sep 15, 2022
2 parents 08b4618 + c764f48 commit a042af7
Show file tree
Hide file tree
Showing 26 changed files with 705 additions and 982 deletions.
25 changes: 25 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const { defineConfig } = require('cypress')
const dotenv = require('dotenv');
const cypressFailFast = require('cypress-fail-fast/plugin');

module.exports = defineConfig({
video: false,
viewportWidth: 1920,
viewportHeight: 1080,
defaultCommandTimeout: 15000,
retries: 3,
e2e: {
setupNodeEvents(on, config) {
dotenv.config();
cypressFailFast(on, config);
config.env.PD_USER_TOKEN = process.env.REACT_APP_PD_USER_TOKEN;
return config;
},
baseUrl: 'http://localhost:3000/pd-live-react',
specPattern: 'cypress/e2e/**/*.spec.{js,ts,jsx,tsx}',
},
component: {
setupNodeEvents(on, config) {},
specPattern: 'src/**/*.spec.{js,ts,jsx,tsx}',
},
})
13 changes: 0 additions & 13 deletions cypress.json

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Query Incidents', { failFast: { enabled: false } }, () => {
before(() => {
acceptDisclaimer();
manageIncidentTableColumns('remove', ['Latest Note']);
manageIncidentTableColumns('add', ['Urgency', 'Teams']);
manageIncidentTableColumns('add', ['Urgency', 'Teams', 'Escalation Policy']);
priorityNames.forEach((currentPriority) => {
activateButton(`query-priority-${currentPriority}-button`);
});
Expand All @@ -35,7 +35,7 @@ describe('Query Incidents', { failFast: { enabled: false } }, () => {
if (cy.state('test').currentRetry() > 1) {
acceptDisclaimer();
manageIncidentTableColumns('remove', ['Latest Note']);
manageIncidentTableColumns('add', ['Urgency', 'Teams']);
manageIncidentTableColumns('add', ['Urgency', 'Teams', 'Escalation Policy']);
}
priorityNames.forEach((currentPriority) => {
activateButton(`query-priority-${currentPriority}-button`);
Expand Down Expand Up @@ -178,6 +178,16 @@ describe('Query Incidents', { failFast: { enabled: false } }, () => {
cy.get('#query-team-select').click().type('{del}');
});
});

const escalationPolicies = ['Team A (EP)', 'Team B (EP)'];
escalationPolicies.forEach((escalationPolicy) => {
it(`Query for incidents on ${escalationPolicy} only`, () => {
cy.get('#query-escalation-policy-select').click().type(`${escalationPolicy}{enter}`);
waitForIncidentTable();
checkIncidentCellContentAllRows('Escalation Policy', escalationPolicy);
cy.get('#query-escalation-policy-select').click().type('{del}');
});
});

const services = ['Service A1', 'Service B2'];
services.forEach((service) => {
Expand All @@ -200,6 +210,18 @@ describe('Query Incidents', { failFast: { enabled: false } }, () => {
cy.get('#query-team-select').click().type('{del}');
cy.get('#query-service-select').click().type('{del}');
});

it('Query for incidents on Team A (EP) and Service A1 only', () => {
cy.get('#query-escalation-policy-select').click().type('Team A (EP){enter}');
cy.get('#query-service-select').click().type('Service A1{enter}');

waitForIncidentTable();
checkIncidentCellContentAllRows('Service', 'Service A1');
checkIncidentCellContentAllRows('Escalation Policy', 'Team A (EP)');

cy.get('#query-escalation-policy-select').click().type('{del}');
cy.get('#query-service-select').click().type('{del}');
});

it('Query on Team A only allows further querying for associated services and users', () => {
cy.get('#query-team-select').click().type('Team A{enter}');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 0 additions & 12 deletions cypress/plugins/index.js

This file was deleted.

File renamed without changes.
46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "pd-live-react",
"homepage": "https://giranm.github.io/pd-live-react",
"version": "0.3.1-beta.0",
"version": "0.4.0-beta.0",
"private": true,
"dependencies": {
"@braintree/sanitize-url": "^6.0.0",
"@craco/craco": "7.0.0-alpha.3",
"@datadog/browser-rum": "^4.17.1",
"@fortawesome/fontawesome-svg-core": "^6.1.2",
"@fortawesome/free-brands-svg-icons": "^6.1.2",
"@fortawesome/free-regular-svg-icons": "^6.1.2",
"@fortawesome/free-solid-svg-icons": "^6.1.2",
"@datadog/browser-rum": "^4.19.0",
"@fortawesome/fontawesome-svg-core": "^6.2.0",
"@fortawesome/free-brands-svg-icons": "^6.2.0",
"@fortawesome/free-regular-svg-icons": "^6.2.0",
"@fortawesome/free-solid-svg-icons": "^6.2.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"@pagerduty/pdjs": "^2.2.3",
"@testing-library/jest-dom": "^5.16.5",
Expand All @@ -22,21 +22,21 @@
"babel-eslint": "^10.1.0",
"bootstrap": "^4.6.2",
"bottleneck": "^2.19.5",
"date-fns": "^2.29.1",
"date-fns": "^2.29.2",
"enzyme": "^3.11.0",
"font-awesome": "^4.7.0",
"fuse.js": "^6.6.2",
"immer": "^9.0.15",
"jsonpath-plus": "^7.0.0",
"jsonpath-plus": "^7.2.0",
"lodash": "^4.17.21",
"mezr": "^0.6.2",
"moment": "^2.29.4",
"node-sass": "^7.0.1",
"node-sass": "^7.0.3",
"react": "^17.0.2",
"react-bootstrap": "^1.6.5",
"react-datepicker": "^4.8.0",
"react-dom": "^17.0.2",
"react-dual-listbox": "^2.2.0",
"react-dual-listbox": "^2.3.0",
"react-inject-env": "^2.0.1",
"react-redux": "^8.0.2",
"react-scripts": "5.0.1",
Expand All @@ -45,11 +45,11 @@
"react-window": "^1.8.7",
"redux": "^4.2.0",
"redux-persist": "^6.0.0",
"redux-saga": "^1.1.3",
"redux-saga": "^1.2.1",
"styled-components": "^5.3.5",
"use-debounce": "^8.0.3",
"use-debounce": "^8.0.4",
"validator": "^13.7.0",
"web-vitals": "^2.1.4"
"web-vitals": "^3.0.1"
},
"resolutions": {
"autoprefixer": "10.4.5"
Expand Down Expand Up @@ -92,12 +92,12 @@
"@4tw/cypress-drag-drop": "^2.2.1",
"@babel/preset-env": "^7.18.9",
"@babel/preset-react": "^7.16.7",
"@cypress/react": "5.12.4",
"@cypress/webpack-dev-server": "^2.1.0",
"@faker-js/faker": "^7.4.0",
"cy2": "^2.0.0",
"cypress": "^9.2.1",
"cypress-fail-fast": "^5.0.0",
"@cypress/react": "6.2.0",
"@cypress/webpack-dev-server": "^2.3.0",
"@faker-js/faker": "^7.5.0",
"cy2": "^2.0.1",
"cypress": "^10.7.0",
"cypress-fail-fast": "^5.0.1",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^8.5.0",
Expand All @@ -106,7 +106,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react": "^7.31.1",
"eslint-plugin-react-hooks": "^4.6.0",
"genversion": "^3.1.1",
"gh-pages": "^4.0.0",
Expand All @@ -116,13 +116,13 @@
"jest-location-mock": "^1.0.9",
"prettier": "^2.6.2",
"prettier-eslint": "^15.0.1",
"prettier-eslint-cli": "^6.0.1",
"prettier-eslint-cli": "^7.1.0",
"redux-mock-store": "^1.5.4",
"redux-saga-test-plan": "^4.0.5",
"redux-saga-test-plan": "^4.0.6",
"resolve-url-loader": "^5.0.0",
"string.prototype.replaceall": "^1.0.6",
"svg-jest": "^1.0.1",
"wait-on": "^6.0.1",
"yarn-audit-fix": "^9.3.3"
"yarn-audit-fix": "^9.3.5"
}
}
46 changes: 46 additions & 0 deletions src/components/QuerySettings/QuerySettingsComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@ import {
updateQuerySettingsIncidentUrgency as updateQuerySettingsIncidentUrgencyConnected,
updateQuerySettingsIncidentPriority as updateQuerySettingsIncidentPriorityConnected,
updateQuerySettingsTeams as updateQuerySettingsTeamsConnected,
updateQuerySettingsEscalationPolicies as updateQuerySettingsEscalationPoliciesConnected,
updateQuerySettingsServices as updateQuerySettingsServicesConnected,
updateQuerySettingsUsers as updateQuerySettingsUsersConnected,
} from 'redux/query_settings/actions';
import {
FETCH_TEAMS_COMPLETED,
} from 'redux/teams/actions';
import {
FETCH_ESCALATION_POLICIES_COMPLETED,
} from 'redux/escalation_policies/actions';
import {
FETCH_SERVICES_COMPLETED,
} from 'redux/services/actions';
Expand All @@ -63,6 +67,7 @@ import {

const QuerySettingsComponent = ({
querySettings,
escalationPolicies,
services,
teams,
priorities,
Expand All @@ -73,6 +78,7 @@ const QuerySettingsComponent = ({
updateQuerySettingsIncidentUrgency,
updateQuerySettingsIncidentPriority,
updateQuerySettingsTeams,
updateQuerySettingsEscalationPolicies,
updateQuerySettingsServices,
updateQuerySettingsUsers,
}) => {
Expand All @@ -82,12 +88,16 @@ const QuerySettingsComponent = ({
incidentUrgency,
incidentPriority,
teamIds,
escalationPolicyIds,
serviceIds,
userIds,
} = querySettings;
const {
teams: teamList, status: teamStatus,
} = teams;
const {
escalationPolicies: escalationPolicyList, status: escalationPolicyStatus,
} = escalationPolicies;
const {
services: serviceList, status: serviceStatus,
} = services;
Expand All @@ -101,6 +111,7 @@ const QuerySettingsComponent = ({

// Identify when to enable selects once data has been fetched
const isTeamSelectDisabled = teamStatus !== FETCH_TEAMS_COMPLETED;
const isEscalationPolicySelectDisabled = escalationPolicyStatus !== FETCH_ESCALATION_POLICIES_COMPLETED;
const isServiceSelectDisabled = serviceStatus !== FETCH_SERVICES_COMPLETED;
const isUserSelectDisabled = !userList.length; // There are multiple states which affect this

Expand All @@ -110,6 +121,11 @@ const QuerySettingsComponent = ({
value: team.id,
}));

const selectListEscalationPolicies = escalationPolicyList.map((escalationPolicy) => ({
label: escalationPolicy.name,
value: escalationPolicy.id,
}));

const selectListServices = serviceList.map((service) => ({
label: service.name,
value: service.id,
Expand All @@ -128,6 +144,11 @@ const QuerySettingsComponent = ({

// Get "stored" option values
const storedSelectTeams = getObjectsFromList(selectListTeams, teamIds, 'value');
const storedSelectEscalationPolicies = getObjectsFromList(
selectListEscalationPolicies,
escalationPolicyIds,
'value',
);
const storedSelectServices = getObjectsFromList(selectListServices, serviceIds, 'value');
const storedSelectUsers = getObjectsFromList(selectListUsers, userIds, 'value');

Expand Down Expand Up @@ -310,6 +331,27 @@ const QuerySettingsComponent = ({
/>
</Form.Group>
</Col>
<Col>
Escalation Policy:
{' '}
<Form.Group>
<Select
id="query-escalation-policy-select"
styles={reactSelectStyle}
onChange={(selectedEscalationPolicies) => {
const escalationPolicyIdsInt = selectedEscalationPolicies.map(
(escalationPolicy) => escalationPolicy.value,
);
updateQuerySettingsEscalationPolicies(escalationPolicyIdsInt);
}}
isMulti
options={selectListEscalationPolicies}
value={storedSelectEscalationPolicies}
isLoading={isEscalationPolicySelectDisabled}
isDisabled={isEscalationPolicySelectDisabled}
/>
</Form.Group>
</Col>
<Col>
Service:
{' '}
Expand Down Expand Up @@ -340,6 +382,7 @@ const QuerySettingsComponent = ({
const mapStateToProps = (state) => ({
querySettings: state.querySettings,
services: state.services,
escalationPolicies: state.escalationPolicies,
teams: state.teams,
priorities: state.priorities.priorities,
users: state.users,
Expand All @@ -360,6 +403,9 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(updateQuerySettingsIncidentPriorityConnected(incidentPriority));
},
updateQuerySettingsTeams: (teamIds) => dispatch(updateQuerySettingsTeamsConnected(teamIds)),
updateQuerySettingsEscalationPolicies: (escalationPolicyIds) => {
dispatch(updateQuerySettingsEscalationPoliciesConnected(escalationPolicyIds));
},
updateQuerySettingsServices: (serviceIds) => {
dispatch(updateQuerySettingsServicesConnected(serviceIds));
},
Expand Down
2 changes: 1 addition & 1 deletion src/config/version.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions src/mocks/escalation_policies.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {
faker,
} from '@faker-js/faker';

const generateMockEscalationPolicy = () => {
// Generate Faker stubs for escalation policy
const id = faker.random.alphaNumeric(7);
const escalationPolicyName = faker.name.jobArea();
return {
id,
summary: escalationPolicyName,
self: `https://api.pagerduty.com/escalation_policies/${id}`,
html_url: `https://www.pagerduty.com/escalation_policies/${id}`,
};
};

export const generateMockEscalationPolicies = (num) => Array.from({ length: num }, () => generateMockEscalationPolicy());

export default generateMockEscalationPolicies;

test.skip('Mock Teams', () => 1);
21 changes: 21 additions & 0 deletions src/mocks/services.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {
faker,
} from '@faker-js/faker';

const generateMockService = () => {
// Generate Faker stubs for service
const id = faker.random.alphaNumeric(7);
const serviceName = faker.commerce.product();
return {
id,
summary: serviceName,
self: `https://api.pagerduty.com/services/${id}`,
html_url: `https://www.pagerduty.com/services/${id}`,
};
};

export const generateMockServices = (num) => Array.from({ length: num }, () => generateMockService());

export default generateMockServices;

test.skip('Mock Services', () => 1);
Loading

0 comments on commit a042af7

Please sign in to comment.