-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add functional test and use classname for styling
- Loading branch information
1 parent
72598c3
commit d0c0dfc
Showing
8 changed files
with
164 additions
and
2 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...actions_ui/public/application/sections/rule_details/components/rule_actions_popopver.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
button[data-test-subj='deleteRuleButton'] { | ||
.ruleActionsPopover__deleteButton { | ||
color: $euiColorDangerText; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
..._actions_ui/public/application/sections/rules_list/components/collapsed_item_actions.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
button[data-test-subj='deleteRule'] { | ||
.collapsedItemActions__deleteButton { | ||
color: $euiColorDangerText; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
...test/alerting_api_integration/security_and_spaces/group1/tests/alerting/retain_api_key.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { UserAtSpaceScenarios } from '../../../scenarios'; | ||
import { FtrProviderContext } from '../../../../common/ftr_provider_context'; | ||
import { AlertUtils, getUrlPrefix, getTestRuleData, ObjectRemover } from '../../../../common/lib'; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default function retainAPIKeyTests({ getService }: FtrProviderContext) { | ||
const supertest = getService('supertest'); | ||
const supertestWithoutAuth = getService('supertestWithoutAuth'); | ||
|
||
describe('retain api key', () => { | ||
const objectRemover = new ObjectRemover(supertest); | ||
|
||
after(() => objectRemover.removeAll()); | ||
|
||
for (const scenario of UserAtSpaceScenarios) { | ||
const { user, space } = scenario; | ||
const alertUtils = new AlertUtils({ user, space, supertestWithoutAuth }); | ||
|
||
describe(scenario.id, () => { | ||
it('should retain the api key when a rule is disabled and then enabled', async () => { | ||
const { body: createdConnector } = await supertest | ||
.post(`${getUrlPrefix(space.id)}/api/actions/connector`) | ||
.set('kbn-xsrf', 'foo') | ||
.send({ | ||
name: 'MY action', | ||
connector_type_id: 'test.noop', | ||
config: {}, | ||
secrets: {}, | ||
}) | ||
.expect(200); | ||
|
||
const { body: createdRule } = await supertest | ||
.post(`${getUrlPrefix(space.id)}/api/alerting/rule`) | ||
.set('kbn-xsrf', 'foo') | ||
.send( | ||
getTestRuleData({ | ||
actions: [ | ||
{ | ||
id: createdConnector.id, | ||
group: 'default', | ||
params: {}, | ||
}, | ||
], | ||
}) | ||
) | ||
.expect(200); | ||
objectRemover.add(space.id, createdRule.id, 'rule', 'alerting'); | ||
|
||
const { | ||
body: { apiKey, apiKeyOwner }, | ||
} = await alertUtils.getAPIKeyRequest(createdRule.id); | ||
|
||
await alertUtils.getDisableRequest(createdRule.id); | ||
|
||
const { | ||
body: { apiKey: apiKeyAfterDisable, apiKeyOwner: apiKeyOwnerAfterDisable }, | ||
} = await alertUtils.getAPIKeyRequest(createdRule.id); | ||
|
||
switch (scenario.id) { | ||
case 'no_kibana_privileges at space1': | ||
case 'space_1_all at space2': | ||
case 'global_read at space1': | ||
case 'space_1_all_alerts_none_actions at space1': | ||
case 'superuser at space1': | ||
case 'space_1_all at space1': | ||
case 'space_1_all_with_restricted_fixture at space1': | ||
expect(apiKey).to.be(apiKeyAfterDisable); | ||
expect(apiKeyOwner).to.be(apiKeyOwnerAfterDisable); | ||
break; | ||
default: | ||
throw new Error(`Scenario untested: ${JSON.stringify(scenario)}`); | ||
} | ||
|
||
await alertUtils.getEnableRequest(createdRule.id); | ||
|
||
const { | ||
body: { apiKey: apiKeyAfterEnable, apiKeyOwner: apiKeyOwnerAfterEnable }, | ||
} = await alertUtils.getAPIKeyRequest(createdRule.id); | ||
|
||
switch (scenario.id) { | ||
case 'no_kibana_privileges at space1': | ||
case 'space_1_all at space2': | ||
case 'global_read at space1': | ||
case 'space_1_all_alerts_none_actions at space1': | ||
case 'superuser at space1': | ||
case 'space_1_all at space1': | ||
case 'space_1_all_with_restricted_fixture at space1': | ||
expect(apiKey).to.be(apiKeyAfterEnable); | ||
expect(apiKeyOwner).to.be(apiKeyOwnerAfterEnable); | ||
break; | ||
default: | ||
throw new Error(`Scenario untested: ${JSON.stringify(scenario)}`); | ||
} | ||
}); | ||
}); | ||
} | ||
}); | ||
} |