From 1c99765ff9b372642983cbf2ae4101c0567ab5e9 Mon Sep 17 00:00:00 2001 From: DongYoung Kim Date: Wed, 4 Sep 2024 17:23:14 +0900 Subject: [PATCH 1/8] Fix expected response status code change from 400 to 401 Signed-off-by: DongYoung Kim --- chaoscenter/cypress/e2e/REST APIs/login.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chaoscenter/cypress/e2e/REST APIs/login.cy.js b/chaoscenter/cypress/e2e/REST APIs/login.cy.js index 13adb97a6..c9b62e730 100644 --- a/chaoscenter/cypress/e2e/REST APIs/login.cy.js +++ b/chaoscenter/cypress/e2e/REST APIs/login.cy.js @@ -13,7 +13,7 @@ describe('Testing login page of chaoscenter via REST APIs', () => { password: 'invalid_password', }, }).then((response) => { - expect(response.status).to.equal(400); + expect(response.status).to.equal(401); expect(response.body.error).to.equal('invalid_credentials'); }); }) From be67145e7dbd536895830269e07699c6807677ba Mon Sep 17 00:00:00 2001 From: DongYoung Kim Date: Wed, 4 Sep 2024 17:28:30 +0900 Subject: [PATCH 2/8] Fix request header referrer value was added Signed-off-by: DongYoung Kim --- chaoscenter/cypress/e2e/REST APIs/chaosinfra.cy.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chaoscenter/cypress/e2e/REST APIs/chaosinfra.cy.js b/chaoscenter/cypress/e2e/REST APIs/chaosinfra.cy.js index 36935d4b9..9f9af6d35 100644 --- a/chaoscenter/cypress/e2e/REST APIs/chaosinfra.cy.js +++ b/chaoscenter/cypress/e2e/REST APIs/chaosinfra.cy.js @@ -72,7 +72,8 @@ describe('testing chaosinfra via REST APIs', () => { url: '/api/query', body: registerInfra_payload, headers: { - Authorization: `Bearer ${accessToken}` + Authorization: `Bearer ${accessToken}`, + Referer: 'https://localhost:3000/' } }).then((response) => { expect(response.status).to.equal(200); @@ -159,7 +160,8 @@ describe('testing chaosinfra via REST APIs', () => { method: 'POST', url: '/api/query', headers: { - Authorization: `Bearer ${accessToken}` + Authorization: `Bearer ${accessToken}`, + Referer: 'https://localhost:3000/' }, body: updateInfra_payload, }).then((response) => { From 309a0a7c89449e428a9056e7ff97f667a34af47d Mon Sep 17 00:00:00 2001 From: DongYoung Kim Date: Wed, 4 Sep 2024 17:36:24 +0900 Subject: [PATCH 3/8] Fix when edit user newPassword value has been changed Signed-off-by: DongYoung Kim --- chaoscenter/cypress/e2e/REST APIs/UserManagment.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chaoscenter/cypress/e2e/REST APIs/UserManagment.cy.js b/chaoscenter/cypress/e2e/REST APIs/UserManagment.cy.js index 4fd3f5cfa..c216d5834 100644 --- a/chaoscenter/cypress/e2e/REST APIs/UserManagment.cy.js +++ b/chaoscenter/cypress/e2e/REST APIs/UserManagment.cy.js @@ -65,7 +65,7 @@ describe('Test Cases for User-Management', () => { const edit_payload = { username: user.username, oldPassword: '', - newPassword: '1' + newPassword: '!Qwer1234' }; cy.request({ From be65b9559049c1e32ed057d22d6aae3e58d8664e Mon Sep 17 00:00:00 2001 From: DongYoung Kim Date: Wed, 4 Sep 2024 17:41:21 +0900 Subject: [PATCH 4/8] Add resetpassword data and apply the value to ui test Signed-off-by: DongYoung Kim --- chaoscenter/cypress/e2e/UI/Usermanagment.cy.js | 4 ++-- chaoscenter/cypress/fixtures/Users.json | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/chaoscenter/cypress/e2e/UI/Usermanagment.cy.js b/chaoscenter/cypress/e2e/UI/Usermanagment.cy.js index 3c83da568..1ad75901a 100644 --- a/chaoscenter/cypress/e2e/UI/Usermanagment.cy.js +++ b/chaoscenter/cypress/e2e/UI/Usermanagment.cy.js @@ -31,8 +31,8 @@ describe('testing for User management', () => { cy.wrap(buttons[buttons.length - 1]).click(); }); cy.contains('Reset Password').click(); - cy.get('input[name="password"]').type('22222'); - cy.get('input[name="reEnterPassword"]').type('22222'); + cy.get('input[name="password"]').type(user.resetpassword); + cy.get('input[name="reEnterPassword"]').type(user.resetpassword); cy.intercept('POST','/auth/reset/password').as('reset'); cy.contains('Confirm').click(); cy.wait('@reset'); diff --git a/chaoscenter/cypress/fixtures/Users.json b/chaoscenter/cypress/fixtures/Users.json index 8f4300dbd..95de11aff 100644 --- a/chaoscenter/cypress/fixtures/Users.json +++ b/chaoscenter/cypress/fixtures/Users.json @@ -2,6 +2,7 @@ "user1": { "username": "user1", "password": "user1", + "resetpassword": "!Qwer1234", "role": "user", "email": "user1@litmus.com", "name": "Test Account 1" @@ -9,6 +10,7 @@ "user2": { "username": "user2", "password": "user2", + "resetpassword": "!Qwer1234", "role": "user", "email": "user2@litmus.com", "name": "Test Account 2" From 4f2fa9ca79ff832991597f36536a78adadf7147c Mon Sep 17 00:00:00 2001 From: DongYoung Kim Date: Wed, 4 Sep 2024 17:44:50 +0900 Subject: [PATCH 5/8] Style remove comma Signed-off-by: DongYoung Kim --- chaoscenter/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chaoscenter/package.json b/chaoscenter/package.json index 711afdb01..341d16fc9 100644 --- a/chaoscenter/package.json +++ b/chaoscenter/package.json @@ -4,7 +4,7 @@ "description": "Package for Testing", "main": "index.js", "scripts": { - "start": "cypress run", + "start": "cypress run" }, "devDependencies": { "cypress": "^13.7.0", From d794346414a4c05f87df5cc0ffcb4e185a800e26 Mon Sep 17 00:00:00 2001 From: DongYoung Kim Date: Sat, 14 Sep 2024 15:58:08 +0900 Subject: [PATCH 6/8] Add the remoteHub field in the ChaosHub API Signed-off-by: DongYoung Kim --- chaoscenter/cypress/e2e/REST APIs/chaoshub.cy.js | 3 +++ chaoscenter/cypress/fixtures/chaoshub.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/chaoscenter/cypress/e2e/REST APIs/chaoshub.cy.js b/chaoscenter/cypress/e2e/REST APIs/chaoshub.cy.js index 60bc50a2c..26989961e 100644 --- a/chaoscenter/cypress/e2e/REST APIs/chaoshub.cy.js +++ b/chaoscenter/cypress/e2e/REST APIs/chaoshub.cy.js @@ -25,6 +25,7 @@ describe('testing chaoshub', () => { request: { name: 'testing', repoBranch: 'master', + remoteHub: 'GitHub', description: '', tags: [], authType: 'NONE', @@ -82,6 +83,7 @@ describe('testing chaoshub', () => { request: { name: 'testing', repoBranch: 'master', + remoteHub: 'Github', description: '', tags: [], authType: 'NONE', @@ -118,6 +120,7 @@ describe('testing chaoshub', () => { id: hubID, name: 'sample', repoBranch: 'master', + remoteHub: 'GitHub', description: '', authType: 'NONE', isPrivate: false, diff --git a/chaoscenter/cypress/fixtures/chaoshub.js b/chaoscenter/cypress/fixtures/chaoshub.js index efa57ae13..9fe97ea52 100644 --- a/chaoscenter/cypress/fixtures/chaoshub.js +++ b/chaoscenter/cypress/fixtures/chaoshub.js @@ -4,6 +4,7 @@ export const add_hub = ` name repoURL repoBranch + remoteHub hubType isPrivate __typename @@ -17,6 +18,7 @@ export const update_hub =` name repoURL repoBranch + remoteHub __typename } } @@ -33,6 +35,7 @@ export const list_hub = ` id repoURL repoBranch + remoteHub authType isAvailable totalFaults From d3fab505a4d2bbe201c31847123dd791cb19beb1 Mon Sep 17 00:00:00 2001 From: DongYoung Kim Date: Sat, 14 Sep 2024 16:16:45 +0900 Subject: [PATCH 7/8] Add the remoteHub field in the ChaosHub UI Signed-off-by: DongYoung Kim --- chaoscenter/cypress/e2e/UI/chaoshub.cy.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chaoscenter/cypress/e2e/UI/chaoshub.cy.js b/chaoscenter/cypress/e2e/UI/chaoshub.cy.js index 863f38a5e..c6a8f7d71 100644 --- a/chaoscenter/cypress/e2e/UI/chaoshub.cy.js +++ b/chaoscenter/cypress/e2e/UI/chaoshub.cy.js @@ -15,6 +15,8 @@ describe('testing chaoshub via UI', () => { cy.contains('Continue').click(); cy.get('input[name="repoURL"]').type('https://github.com/litmuschaos/chaos-charts.git'); cy.get('input[name="repoBranch"]').type('master'); + cy.get('div[data-testid = "dropdown-button"]').click(); + cy.contains('GitHub').click(); cy.intercept('POST','/api/query').as('Query'); cy.get('button[aria-label = "Connect Hub"]').click(); cy.wait('@Query'); @@ -36,6 +38,8 @@ describe('testing chaoshub via UI', () => { cy.contains('Continue').click(); cy.get('input[name="repoURL"]').type('1'); cy.get('input[name="repoBranch"]').type('1'); + cy.get('div[data-testid = "dropdown-button"]').click(); + cy.contains('GitHub').click(); cy.get('button[aria-label = "Connect Hub"]').click(); cy.on('window:alert', () => { expect(message).to.equal('name already exists'); From 0e3ab343bd5e430b42cdb2cf24f4ac38ea7f11f9 Mon Sep 17 00:00:00 2001 From: DongYoung Kim Date: Sat, 14 Sep 2024 22:41:32 +0900 Subject: [PATCH 8/8] Update expected error equal to contain Signed-off-by: DongYoung Kim --- chaoscenter/cypress/e2e/REST APIs/chaosProbes.cy.js | 8 ++++---- chaoscenter/cypress/e2e/REST APIs/chaosinfra.cy.js | 2 +- chaoscenter/cypress/e2e/UI/chaosinfra.cy.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/chaoscenter/cypress/e2e/REST APIs/chaosProbes.cy.js b/chaoscenter/cypress/e2e/REST APIs/chaosProbes.cy.js index 8b59ef1a9..a60c3b0f3 100644 --- a/chaoscenter/cypress/e2e/REST APIs/chaosProbes.cy.js +++ b/chaoscenter/cypress/e2e/REST APIs/chaosProbes.cy.js @@ -89,7 +89,7 @@ describe('Testing http chaos Probes', () => { } }).then((response) => { expect(response.status).to.equal(200); - expect(response.body.errors[0].message).to.equal('write exception: write errors: [E11000 duplicate key error collection: litmus.chaosProbes index: name_1 dup key: { name: "exp1111" }]'); + expect(response.body.errors[0].message).to.contain('write exception: write errors: [E11000 duplicate key error collection:'); }); }); @@ -276,7 +276,7 @@ describe('testing CMD chaos probes', () => { }, }).then((response) => { expect(response.status).to.equal(200); - expect(response.body.errors[0].message).to.equal('write exception: write errors: [E11000 duplicate key error collection: litmus.chaosProbes index: name_1 dup key: { name: "exp2222" }]'); + expect(response.body.errors[0].message).to.contain('write exception: write errors: [E11000 duplicate key error collection:'); }); }); @@ -473,7 +473,7 @@ describe('testing prometheus chaos probes', () => { }, }).then((response) => { expect(response.status).to.equal(200); - expect(response.body.errors[0].message).to.equal('write exception: write errors: [E11000 duplicate key error collection: litmus.chaosProbes index: name_1 dup key: { name: "exp3333" }]'); + expect(response.body.errors[0].message).to.contain('write exception: write errors: [E11000 duplicate key error collection:'); }); }); @@ -667,7 +667,7 @@ describe('testing kubernetes chaos probes', () => { }, }).then((response) => { expect(response.status).to.equal(200); - expect(response.body.errors[0].message).to.equal('write exception: write errors: [E11000 duplicate key error collection: litmus.chaosProbes index: name_1 dup key: { name: "exp4444" }]'); + expect(response.body.errors[0].message).to.contain('write exception: write errors: [E11000 duplicate key error collection:'); }); }); diff --git a/chaoscenter/cypress/e2e/REST APIs/chaosinfra.cy.js b/chaoscenter/cypress/e2e/REST APIs/chaosinfra.cy.js index 9f9af6d35..79c9b7803 100644 --- a/chaoscenter/cypress/e2e/REST APIs/chaosinfra.cy.js +++ b/chaoscenter/cypress/e2e/REST APIs/chaosinfra.cy.js @@ -136,7 +136,7 @@ describe('testing chaosinfra via REST APIs', () => { } }).then((response) => { expect(response.status).to.equal(200); - expect(response.body.errors[0].message).to.equal('write exception: write errors: [E11000 duplicate key error collection: litmus.environment index: environment_id_1 dup key: { environment_id: "exp99" }]'); + expect(response.body.errors[0].message).to.contain('write exception: write errors: [E11000 duplicate key error collection:'); }); }); diff --git a/chaoscenter/cypress/e2e/UI/chaosinfra.cy.js b/chaoscenter/cypress/e2e/UI/chaosinfra.cy.js index 4a3c435f7..ac3265e69 100644 --- a/chaoscenter/cypress/e2e/UI/chaosinfra.cy.js +++ b/chaoscenter/cypress/e2e/UI/chaosinfra.cy.js @@ -24,7 +24,7 @@ describe('testing chaosinfra via UI', () => { cy.get('input[name="name"]').type('exp99'); cy.contains('Save').click(); cy.on('alert message', () => { - expect(message).to.equal('write exception: write errors: [E11000 duplicate key error collection: litmus.environment index: environment_id_1 dup key: { environment_id: "exp99" }]'); + expect(message).to.contain('write exception: write errors: [E11000 duplicate key error collection:'); }); });