Skip to content

Commit

Permalink
Change cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed May 12, 2020
1 parent e135b02 commit d2badbf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { goToEditExternalConnection } from '../tasks/all_cases';
import {
addServiceNowConnector,
openAddNewConnectorOption,
saveChanges,
selectLastConnectorCreated,
} from '../tasks/configure_cases';
import { loginAndWaitForPageWithoutDateRange } from '../tasks/login';
Expand All @@ -37,7 +36,6 @@ describe('Cases connectors', () => {
cy.get(TOASTER).should('have.text', "Created 'New connector'");

selectLastConnectorCreated();
saveChanges();

cy.wait('@saveConnector', { timeout: 10000 })
.its('status')
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/siem/cypress/screens/configure_cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const ADD_NEW_CONNECTOR_OPTION_LINK =
'[data-test-subj="case-configure-add-connector-button"]';
export const ADD_NEW_CONNECTOR_DROPDOWN_BUTTON =
'[data-test-subj="dropdown-connector-add-connector"]';

export const CONNECTOR = (id: string) => {
return `[data-test-subj='dropdown-connector-${id}']`;
Expand Down
10 changes: 3 additions & 7 deletions x-pack/plugins/siem/cypress/tasks/configure_cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
*/

import {
ADD_NEW_CONNECTOR_OPTION_LINK,
ADD_NEW_CONNECTOR_DROPDOWN_BUTTON,
CONNECTOR,
CONNECTOR_NAME,
CONNECTORS_DROPDOWN,
PASSWORD,
SAVE_BTN,
SAVE_CHANGES_BTN,
SERVICE_NOW_CONNECTOR_CARD,
URL,
USERNAME,
Expand All @@ -33,15 +32,12 @@ export const openAddNewConnectorOption = () => {
cy.get(MAIN_PAGE).then($page => {
if ($page.find(SERVICE_NOW_CONNECTOR_CARD).length !== 1) {
cy.wait(1000);
cy.get(ADD_NEW_CONNECTOR_OPTION_LINK).click({ force: true });
cy.get(CONNECTORS_DROPDOWN).click({ force: true });
cy.get(ADD_NEW_CONNECTOR_DROPDOWN_BUTTON).click();
}
});
};

export const saveChanges = () => {
cy.get(SAVE_CHANGES_BTN).click();
};

export const selectLastConnectorCreated = () => {
cy.get(CONNECTORS_DROPDOWN).click({ force: true });
cy.get('@createConnector')
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/siem/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"extract-mitre-attacks": "node scripts/extract_tactics_techniques_mitre.js && node ../../../scripts/eslint ./public/pages/detection_engine/mitre/mitre_tactics_techniques.ts --fix",
"build-graphql-types": "node scripts/generate_types_from_graphql.js",
"cypress:open": "cypress open --config-file ./cypress/cypress.json",
"cypress:run": "cypress run --browser chrome --headless --spec ./cypress/integration/**/*.spec.ts --config-file ./cypress/cypress.json --reporter ../../node_modules/cypress-multi-reporters --reporter-options configFile=./cypress/reporter_config.json; status=$?; ../../node_modules/.bin/mochawesome-merge --reportDir ../../../target/kibana-siem/cypress/results > ../../../target/kibana-siem/cypress/results/output.json; ../../../node_modules/.bin/marge ../../../target/kibana-siem/cypress/results/output.json --reportDir ../../../target/kibana-siem/cypress/results; mkdir -p ../../../target/junit && cp ../../../target/kibana-siem/cypress/results/*.xml ../../../target/junit/ && exit $status;",
"cypress:run": "cypress run --browser chrome --headless --spec ./cypress/integration/cases_connectors.spec.ts --config-file ./cypress/cypress.json --reporter ../../node_modules/cypress-multi-reporters --reporter-options configFile=./cypress/reporter_config.json; status=$?; ../../node_modules/.bin/mochawesome-merge --reportDir ../../../target/kibana-siem/cypress/results > ../../../target/kibana-siem/cypress/results/output.json; ../../../node_modules/.bin/marge ../../../target/kibana-siem/cypress/results/output.json --reportDir ../../../target/kibana-siem/cypress/results; mkdir -p ../../../target/junit && cp ../../../target/kibana-siem/cypress/results/*.xml ../../../target/junit/ && exit $status;",
"cypress:run-as-ci": "node ../../../scripts/functional_tests --config ../../test/siem_cypress/config.ts"
},
"devDependencies": {
Expand Down

0 comments on commit d2badbf

Please sign in to comment.