From 33ed7e130c49af5bf0ffb344219800dabcb8cc2a Mon Sep 17 00:00:00 2001 From: Nathaniel Caza Date: Fri, 28 Jun 2019 09:51:16 -0500 Subject: [PATCH 1/5] update cypress --- web/src/package.json | 2 +- web/src/yarn.lock | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/web/src/package.json b/web/src/package.json index 6cb0ee385a..46715c775e 100644 --- a/web/src/package.json +++ b/web/src/package.json @@ -125,7 +125,7 @@ "chance": "^1.0.16", "css-loader": "1.0.1", "cssnano": "^4.1.7", - "cypress": "3.3.1", + "cypress": "3.3.2", "eslint": "^5.9.0", "eslint-config-prettier": "5.0.0", "eslint-config-standard": "^12.0.0", diff --git a/web/src/yarn.lock b/web/src/yarn.lock index 01fc218c4b..954b61fe74 100644 --- a/web/src/yarn.lock +++ b/web/src/yarn.lock @@ -3574,9 +3574,10 @@ cyclist@~0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" -cypress@*, cypress@3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-3.3.1.tgz#8a127b1d9fa74bff21f111705abfef58d595fdef" +cypress@*, cypress@3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-3.3.2.tgz#105d9283c747884d534b88a8e6c857d977887024" + integrity sha512-d2gFX0KBBdNfMMZ/ud9ouNqjDtMM3Tf5Z50hkl8Ldb8T+jKc7RLFo/4FjMu9i28T2x+50Sx8sN/kLzxr2oeWNg== dependencies: "@cypress/listr-verbose-renderer" "0.4.1" "@cypress/xvfb" "1.2.4" @@ -3591,7 +3592,7 @@ cypress@*, cypress@3.3.1: execa "0.10.0" executable "4.1.1" extract-zip "1.6.7" - fs-extra "4.0.1" + fs-extra "5.0.0" getos "3.1.1" glob "7.1.3" is-ci "1.2.1" @@ -4929,12 +4930,13 @@ fs-constants@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" -fs-extra@4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.1.tgz#7fc0c6c8957f983f57f306a24e5b9ddd8d0dd880" +fs-extra@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd" + integrity sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ== dependencies: graceful-fs "^4.1.2" - jsonfile "^3.0.0" + jsonfile "^4.0.0" universalify "^0.1.0" fs-minipass@^1.2.5: @@ -6803,9 +6805,10 @@ json5@^2.1.0: dependencies: minimist "^1.2.0" -jsonfile@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66" +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= optionalDependencies: graceful-fs "^4.1.6" From 6af9b48a20dec4acd4cb3ee1f1c57e7b59122c6a Mon Sep 17 00:00:00 2001 From: Nathaniel Caza Date: Fri, 28 Jun 2019 09:54:40 -0500 Subject: [PATCH 2/5] add failing test for ep user selection --- .../integration/escalationPolicySteps.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/web/src/cypress/integration/escalationPolicySteps.ts b/web/src/cypress/integration/escalationPolicySteps.ts index 44cc8773c0..df3a2ed51f 100644 --- a/web/src/cypress/integration/escalationPolicySteps.ts +++ b/web/src/cypress/integration/escalationPolicySteps.ts @@ -81,6 +81,23 @@ function testSteps(screen: ScreenFormat) { }) }) + it('should add users when slack is disabled', () => { + cy.updateConfig({ Slack: { Enable: false } }) + cy.reload() + cy.fixture('users').then(users => { + const u1 = users[0] + const u2 = users[1] + + cy.pageFab() + cy.get('div[role=dialog]').as('dialog') + cy.get('@dialog').should('contain', 'Create Step') + + cy.get('button[data-cy="users-step"]').click() + cy.get('input[name=users]').selectByLabel(u1.name) + cy.get('input[name=users]').selectByLabel(u2.name) + }) + }) + it('should edit a step', () => { cy.createEPStep({ epID: ep.id }).then(() => cy.reload()) cy.get('ul[data-cy=steps-list]') @@ -117,6 +134,8 @@ function testSteps(screen: ScreenFormat) { }) it('should add and then remove a slack channel', () => { + cy.updateConfig({ Slack: { Enable: true } }) + cy.pageFab() cy.get('div[role=dialog]').as('dialog') cy.get('@dialog').should('contain', 'Create Step') From 8074723651200e7759b550b3288391adeba03b80 Mon Sep 17 00:00:00 2001 From: Nathaniel Caza Date: Fri, 28 Jun 2019 09:58:07 -0500 Subject: [PATCH 3/5] fix the bug --- web/src/app/escalation-policies/PolicyStepForm.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/app/escalation-policies/PolicyStepForm.js b/web/src/app/escalation-policies/PolicyStepForm.js index f716afe284..9ea28c2542 100644 --- a/web/src/app/escalation-policies/PolicyStepForm.js +++ b/web/src/app/escalation-policies/PolicyStepForm.js @@ -221,7 +221,9 @@ export default class PolicyStepForm extends React.Component { data-cy='users-step' icon={} optional={optionalText} - onClick={this.handleStepChange(3)} + onClick={this.handleStepChange( + cfg['Slack.Enable'] ? 3 : 2, + )} > {badgeMeUpScotty( getTargetsByType('user')(value.targets).length, From 45ba424aa069061a9c9f06216140c761445820cd Mon Sep 17 00:00:00 2001 From: Katy <31386843+Katy-M@users.noreply.github.com> Date: Fri, 28 Jun 2019 12:14:13 -0500 Subject: [PATCH 4/5] Update web/src/cypress/integration/escalationPolicySteps.ts --- web/src/cypress/integration/escalationPolicySteps.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/cypress/integration/escalationPolicySteps.ts b/web/src/cypress/integration/escalationPolicySteps.ts index df3a2ed51f..a5403a673a 100644 --- a/web/src/cypress/integration/escalationPolicySteps.ts +++ b/web/src/cypress/integration/escalationPolicySteps.ts @@ -133,7 +133,9 @@ function testSteps(screen: ScreenFormat) { ) }) - it('should add and then remove a slack channel', () => { +it('should add and then remove a slack channel', () => { + cy.updateConfig({ Slack: { Enable: true } }) + cy.reload() cy.updateConfig({ Slack: { Enable: true } }) cy.pageFab() From b083d59471dfc06aead4e3701a1a8fe3ea5648d6 Mon Sep 17 00:00:00 2001 From: Nathaniel Caza Date: Fri, 28 Jun 2019 13:38:32 -0500 Subject: [PATCH 5/5] fix formatting --- web/src/cypress/integration/escalationPolicySteps.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/web/src/cypress/integration/escalationPolicySteps.ts b/web/src/cypress/integration/escalationPolicySteps.ts index a5403a673a..ba849d9bac 100644 --- a/web/src/cypress/integration/escalationPolicySteps.ts +++ b/web/src/cypress/integration/escalationPolicySteps.ts @@ -133,10 +133,9 @@ function testSteps(screen: ScreenFormat) { ) }) -it('should add and then remove a slack channel', () => { - cy.updateConfig({ Slack: { Enable: true } }) - cy.reload() + it('should add and then remove a slack channel', () => { cy.updateConfig({ Slack: { Enable: true } }) + cy.reload() cy.pageFab() cy.get('div[role=dialog]').as('dialog')