Skip to content

Commit

Permalink
[Security Solution][Explore] Cypress last adjustments for MKI (elasti…
Browse files Browse the repository at this point in the history
…c#179180)

## Summary

After executing the tests at the MKI pipeline I saw that:
- One test was failing because in cloud there is a default SMTP
connector that cannot be deleted, and we were trying to do so.
- Author name when creating a case, is different.

In this PR we are fixing the above.
  • Loading branch information
MadameSheema authored Mar 22, 2024
1 parent 59386ba commit a1213a5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
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

0 comments on commit a1213a5

Please sign in to comment.