Skip to content

Commit

Permalink
Updating cypress version and fixing CVE-2024-21538 (#1247)
Browse files Browse the repository at this point in the history
* Updating cypress version

Signed-off-by: Kshitij Tandon <[email protected]>

* Fixing CVE-2024-21538

Signed-off-by: Kshitij Tandon <[email protected]>

* Testing cypress baselining

Signed-off-by: Kshitij Tandon <[email protected]>

* Modifying spec patterns

Signed-off-by: Kshitij Tandon <[email protected]>

* Fixing an issue in snpashot e2e test

Signed-off-by: Kshitij Tandon <[email protected]>

---------

Signed-off-by: Kshitij Tandon <[email protected]>
(cherry picked from commit 3eb1b24)
  • Loading branch information
tandonks committed Jan 30, 2025
1 parent 3db302c commit 09e085d
Show file tree
Hide file tree
Showing 24 changed files with 699 additions and 1,212 deletions.
47 changes: 47 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
e2e: {
specPattern: "cypress/e2e/plugins/index-management-dashboards-plugin/*.{js,jsx,ts,tsx}",
defaultCommandTimeout: 60000,
requestTimeout: 60000,
responseTimeout: 60000,
baseUrl: "http://localhost:5601",
viewportWidth: 2000,
viewportHeight: 1320,
env: {
openSearchUrl: "http://localhost:9200",
SECURITY_ENABLED: false,
username: "admin",
password: "admin",
},
clientCertificates: [
{
url: "https://localhost:9200/.opendistro-ism*",
ca: ["cypress/resources/root-ca.pem"],
certs: [
{
cert: "cypress/resources/kirk.pem",
key: "cypress/resources/kirk-key.pem",
passphrase: "",
},
],
},
{
url: "https://localhost:9200/.opendistro-ism-config/_update_by_query/",
ca: ["cypress/resources/root-ca.pem"],
certs: [
{
cert: "cypress/resources/kirk.pem",
key: "cypress/resources/kirk-key.pem",
passphrase: "",
},
],
},
],
setupNodeEvents(on, config) {
// implement node event listeners here
return config;
},
},
});
14 changes: 0 additions & 14 deletions cypress.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ describe("Snapshots", () => {

describe("Snapshot can be restored", () => {
it("Successfully restores indexes from snapshot", () => {
cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/snapshots`);
// Wait for snapshot to be created successfully with a 12sec timeout
cy.get(`[data-test-subj="refreshButton"]`, { timeout: 12000 })
.should("be.visible")
Expand Down Expand Up @@ -124,6 +125,7 @@ describe("Snapshots", () => {

describe("Snapshot can be deleted", () => {
it("deletes snapshot successfully", () => {
cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/snapshots`);
// Select test snapshot
cy.get(`[data-test-subj="checkboxSelectRow-test_repo:test_snapshot"]`).check({ force: true });

Expand Down
57 changes: 0 additions & 57 deletions cypress/plugins/index.js

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion cypress/utils/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Cypress.Commands.add("login", () => {

Cypress.Commands.add("deleteAllIndices", () => {
cy.log("Deleting all indexes");
cy.request("DELETE", `${Cypress.env("openSearchUrl")}/index*,sample*,opensearch_dashboards*`);
cy.request("DELETE", `${Cypress.env("openSearchUrl")}/test_index_*,index*,sample*,opensearch_dashboards*`);
cy.task("readCertAndKey").then(({ cert, key }) => {
cy.request({
method: "DELETE",
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"**/nth-check": "^2.0.1",
"**/typescript": "4.0.2",
"**/terser": "^4.8.1",
"braces": "^3.0.3"
"braces": "^3.0.3",
"**/eslint/cross-spawn": "^7.0.5"
},
"devDependencies": {
"@elastic/elastic-eslint-config-kibana": "link:../../packages/opensearch-eslint-config-opensearch-dashboards",
Expand All @@ -72,7 +73,7 @@
"@types/json-schema": "^7.0.11",
"@types/react-dom": "^16.9.8",
"@types/react-router-dom": "^5.3.2",
"cypress": "9.5.4",
"cypress": "12.17.4",
"diff": "^4.0.1",
"eslint-plugin-no-unsanitized": "^3.0.2",
"eslint-plugin-prefer-object-spread": "^1.2.1",
Expand All @@ -83,4 +84,4 @@
"engines": {
"yarn": "^1.21.1"
}
}
}
Loading

0 comments on commit 09e085d

Please sign in to comment.