-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Chaoscenter e2e tests Signed-off-by: Dhanush0369 <dhanush789245@gmail.com> * Updated chaosinfra tests Signed-off-by: Dhanush0369 <dhanush789245@gmail.com> * Completed chaosInfra tests Signed-off-by: Dhanush0369 <dhanush789245@gmail.com> * Updated chaosInfra tests Signed-off-by: Dhanush0369 <dhanush789245@gmail.com> * Added chaosprobes test Signed-off-by: Dhanush0369 <dhanush789245@gmail.com> * Updated chaosprobes tests Signed-off-by: Dhanush0369 <dhanush789245@gmail.com> * Added User Managment and Negative tests Signed-off-by: Dhanush0369 <dhanush789245@gmail.com> * Restructuring files into two groups REST APIs and UI Signed-off-by: Dhanush0369 <dhanush789245@gmail.com> * Delete Previous Files Signed-off-by: Dhanush0369 <dhanush789245@gmail.com> * Addition of chaoshub,chaosInfra and Negative test cases Signed-off-by: Dhanush0369 <dhanush789245@gmail.com> --------- Signed-off-by: Dhanush0369 <dhanush789245@gmail.com>
- Loading branch information
1 parent
1e83cb7
commit e813226
Showing
20 changed files
with
4,069 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const { defineConfig } = require("cypress"); | ||
|
||
module.exports = defineConfig({ | ||
e2e: { | ||
baseUrl: 'http://192.168.49.2:30829', | ||
requestTimeout: 60000, | ||
responseTimeout: 60000 | ||
}, | ||
env: { | ||
username: 'admin', | ||
password: 'litmus' | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
describe('Test Cases for User-Management', () => { | ||
let user; | ||
beforeEach(() => { | ||
cy.requestLogin(Cypress.env('username'),Cypress.env('password')); | ||
cy.fixture("Users").then((User) => { | ||
user = User.user1; | ||
}); | ||
}); | ||
|
||
it('Create New User', () => { | ||
const accessToken = localStorage.getItem('accessToken'); | ||
|
||
//add user | ||
const add_payload = { | ||
name: user.name, | ||
email: user.email, | ||
username: user.username, | ||
password: user.password, | ||
role: 'user' | ||
}; | ||
|
||
cy.request({ | ||
method: 'POST', | ||
url: '/auth/create_user', | ||
headers: { | ||
Authorization: `Bearer ${accessToken}` | ||
}, | ||
body: add_payload, | ||
}).then((response) => { | ||
expect(response.status).to.equal(200); | ||
expect(response.body.username).to.eq(add_payload.username); | ||
expect(response.body.email).to.eq(add_payload.email); | ||
expect(response.body.name).to.eq(add_payload.name); | ||
}); | ||
}); | ||
|
||
it('Negative test case for User management [Get error when creating User with same name]', () => { | ||
const accessToken = localStorage.getItem('accessToken'); | ||
|
||
//add user | ||
const add_payload = { | ||
name: user.name, | ||
email: user.email, | ||
username: user.username, | ||
password: user.password, | ||
role: 'user' | ||
}; | ||
|
||
cy.request({ | ||
method: 'POST', | ||
url: '/auth/create_user', | ||
headers: { | ||
Authorization: `Bearer ${accessToken}` | ||
}, | ||
body: add_payload, | ||
failOnStatusCode: false, | ||
}).then((response) => { | ||
expect(response.body.error).to.equal('user_exists'); | ||
}); | ||
}) | ||
|
||
it('Edit user password', () => { | ||
const accessToken = localStorage.getItem('accessToken'); | ||
|
||
const edit_payload = { | ||
username: user.username, | ||
oldPassword: '', | ||
newPassword: '1' | ||
}; | ||
|
||
cy.request({ | ||
method: 'POST', | ||
url: '/auth/reset/password', | ||
headers: { | ||
Authorization: `Bearer ${accessToken}` | ||
}, | ||
body: edit_payload, | ||
}).then((response) => { | ||
expect(response.status).to.equal(200); | ||
expect(response.body.message).to.eq('password has been reset successfully'); | ||
}); | ||
}); | ||
|
||
it('Disable user', () => { | ||
const accessToken = localStorage.getItem('accessToken'); | ||
|
||
//negative test case for disable user | ||
const disable_payload1 = { | ||
username: '123', | ||
isDeactivate: true | ||
}; | ||
|
||
cy.request({ | ||
method: 'POST', | ||
url: '/auth/update/state', | ||
failOnStatusCode: false, | ||
headers: { | ||
Authorization: `Bearer ${accessToken}` | ||
}, | ||
body: disable_payload1, | ||
}).then((response) => { | ||
expect(response.body.error).to.equal('user does not exist'); | ||
}); | ||
|
||
|
||
//disable user | ||
const disable_payload = { | ||
username: user.username, | ||
isDeactivate: true | ||
}; | ||
|
||
cy.request({ | ||
method: 'POST', | ||
url: '/auth/update/state', | ||
headers: { | ||
Authorization: `Bearer ${accessToken}` | ||
}, | ||
body: disable_payload, | ||
}).then((response) => { | ||
expect(response.status).to.equal(200); | ||
expect(response.body.message).to.eq("user's state updated successfully"); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.