Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution][Explore] Cypress last adjustments for MKI #179180

Merged
merged 3 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ import { login } from '../../../tasks/login';
import { visit, visitWithTimeRange } from '../../../tasks/navigation';

import { CASES_URL, OVERVIEW_URL } from '../../../urls/navigation';
import { ELASTICSEARCH_USERNAME } from '../../../env_var_names_constants';
import { CLOUD_SERVERLESS, ELASTICSEARCH_USERNAME } from '../../../env_var_names_constants';
import { deleteCases } from '../../../tasks/api_calls/cases';

// https://github.com/elastic/kibana/issues/179231
const isCloudServerless = Cypress.env(CLOUD_SERVERLESS);
const username = isCloudServerless ? 'admin' : Cypress.env(ELASTICSEARCH_USERNAME);

// Tracked by https://github.com/elastic/security-team/issues/7696
describe('Cases', { tags: ['@ess', '@serverless'] }, () => {
beforeEach(() => {
Expand Down Expand Up @@ -109,12 +113,8 @@ describe('Cases', { tags: ['@ess', '@serverless'] }, () => {
'have.text',
`${this.mycase.description} ${this.mycase.timeline.title}`
);
cy.get(CASE_DETAILS_USERNAMES)
.eq(REPORTER)
.should('contain', Cypress.env(ELASTICSEARCH_USERNAME));
cy.get(CASE_DETAILS_USERNAMES)
.eq(PARTICIPANTS)
.should('contain', Cypress.env(ELASTICSEARCH_USERNAME));
cy.get(CASE_DETAILS_USERNAMES).eq(REPORTER).should('contain', username);
cy.get(CASE_DETAILS_USERNAMES).eq(PARTICIPANTS).should('contain', username);
cy.get(CASE_DETAILS_TAGS).should('have.text', expectedTags);

EXPECTED_METRICS.forEach((metric) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export const API_HEADERS = Object.freeze({
[ELASTIC_HTTP_VERSION_HEADER]: [INITIAL_REST_VERSION],
});

export const INTERNAL_CLOUD_CONNECTORS = ['Elastic-Cloud-SMTP'];

export const rootRequest = <T = unknown>({
headers: optionHeaders,
...restOptions
Expand Down Expand Up @@ -108,10 +110,12 @@ export const deleteConnectors = () => {
return connector.id;
});
ids.forEach((id) => {
rootRequest({
method: 'DELETE',
url: `api/actions/connector/${id}`,
});
if (!INTERNAL_CLOUD_CONNECTORS.includes(id)) {
rootRequest({
method: 'DELETE',
url: `api/actions/connector/${id}`,
});
}
});
}
});
Expand Down