diff --git a/src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.html b/src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.html
index 1dfba95dd..c25102ba2 100644
--- a/src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.html
+++ b/src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.html
@@ -214,7 +214,7 @@
-
+
diff --git a/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.html b/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.html
index 26faac5cb..b8a89c2b3 100644
--- a/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.html
+++ b/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.html
@@ -129,7 +129,7 @@
Emby User
- Details/Edit
+ Details/Edit
|
diff --git a/src/Ombi/cypress/integration/login.spec.js b/src/Ombi/cypress/integration/login.spec.js
index 92f7eface..af40f21e7 100644
--- a/src/Ombi/cypress/integration/login.spec.js
+++ b/src/Ombi/cypress/integration/login.spec.js
@@ -9,8 +9,7 @@ describe('Login Page', function () {
cy.get('#inputPassword').type('incorrectpw');
cy.get('[data-test=signinbtn]').click();
- cy.get('.ui-growl-title').should('be.visible');
- cy.get('.ui-growl-title').next().contains('Incorrect username')
+ cy.verifyNotification('Incorrect username');
});
it('Invalid Username', function () {
@@ -21,8 +20,7 @@ describe('Login Page', function () {
cy.get('#inputPassword').type('incorrectpw');
cy.get('[data-test=signinbtn]').click();
- cy.get('.ui-growl-title').should('be.visible');
- cy.get('.ui-growl-title').next().contains('Incorrect username')
+ cy.verifyNotification('Incorrect username');
});
it('Correct Login', function () {
diff --git a/src/Ombi/cypress/integration/usermanagement.spec.js b/src/Ombi/cypress/integration/usermanagement.spec.js
index 8c15f4593..866542129 100644
--- a/src/Ombi/cypress/integration/usermanagement.spec.js
+++ b/src/Ombi/cypress/integration/usermanagement.spec.js
@@ -2,18 +2,12 @@
describe('User Management Page', function () {
beforeEach(function () {
- cy.request({
- method: 'POST',
- url: 'http://localhost:3577/api/v1/token',
- body: {
- username: 'automation',
- password: 'password',
- }
- })
- .then((resp) => {
- window.localStorage.setItem('id_token', resp.body.access_token)
- });
-
+ cy.login('automation', 'password');
+ cy.createUser('userToDelete', 'password', [{
+ value: "requestmovie",
+ Enabled: "true",
+ }]);
+
cy.visit('/usermanagement');
});
@@ -22,9 +16,9 @@ describe('User Management Page', function () {
cy.contains("Add User To Ombi");
});
- it.only('Creates basic user', function(){
+ it('Creates basic user', function () {
cy.get('[data-test=adduserbtn').click();
- cy.url().should('include','/user');
+ cy.url().should('include', '/user');
// Setup the form
cy.get('#username').type("user1");
@@ -40,9 +34,91 @@ describe('User Management Page', function () {
// submit user
cy.get('[data-test=createuserbtn]').click();
-
- cy.get('.ui-growl-title').should('be.visible');
- cy.get('.ui-growl-title').next().contains('has been created successfully')
+
+ cy.verifyNotification('has been created successfully');
+
+ // Also check if the user is in the table
+ cy.contains('alias1');
});
-
-})
\ No newline at end of file
+
+ it('Tries to create user without roles', function () {
+ cy.get('[data-test=adduserbtn').click();
+ cy.url().should('include', '/user');
+
+ // Setup the form
+ cy.get('#username').type("user1");
+ cy.get('#alias').type("alias1");
+ cy.get('#emailAddress').type("user1@emailaddress.com");
+ cy.get('#password').type("password");
+ cy.get('#confirmPass').type("password");
+
+ // submit user
+ cy.get('[data-test=createuserbtn]').click();
+
+ cy.verifyNotification('Please assign a role');
+
+ });
+
+ it('Tries to create user when passwords do not match', function () {
+ cy.get('[data-test=adduserbtn').click();
+ cy.url().should('include', '/user');
+
+ // Setup the form
+ cy.get('#username').type("user1");
+ cy.get('#alias').type("alias1");
+ cy.get('#emailAddress').type("user1@emailaddress.com");
+ cy.get('#password').type("password");
+ cy.get('#confirmPass').type("pass22word");
+
+ // submit user
+ cy.get('[data-test=createuserbtn]').click();
+
+ cy.verifyNotification('Passwords do not match');
+ });
+
+ it('Delete a user', function () {
+ cy.get('#edituserToDelete').click();
+ cy.contains('User: userToDelete');
+ cy.get('[data-test=deletebtn]').click();
+ cy.contains('Are you sure that you want to delete this user?');
+ cy.contains('Yes').click();
+ cy.verifyNotification('was deleted');
+ })
+
+
+ it.only('Creates user with request limits', function () {
+ cy.get('[data-test=adduserbtn').click();
+ cy.url().should('include', '/user');
+
+ // Setup the form
+ cy.get('#username').type("user2");
+ cy.get('#alias').type("alias2");
+ cy.get('#emailAddress').type("user2@emailaddress.com");
+ cy.get('#password').type("password");
+ cy.get('#confirmPass').type("password");
+
+ // setup the roles
+ cy.contains('Roles').click()
+ cy.get('#labelRequestMovie').click();
+
+ cy.contains('Request Limits').click();
+ cy.get('#movieRequestLimit').clear().type(2);
+ cy.get('#musicRequestLimit').clear().type(3);
+ cy.get('#episodeRequestLimit').clear().type(4);
+
+ // submit user
+ cy.get('[data-test=createuserbtn]').click();
+
+ cy.verifyNotification('has been updated successfully');
+
+ // Verify that the limits are set
+ cy.get('#edituser2').click();
+ cy.contains('Request Limits').click();
+ cy.get('#movieRequestLimit').should('eq', 2);
+ cy.get('#musicRequestLimit').should('eq', 3);
+ cy.get('#tvRequestLimit').should('eq', 4);
+
+ });
+
+
+});
\ No newline at end of file
diff --git a/src/Ombi/cypress/support/commands.js b/src/Ombi/cypress/support/commands.js
index c1f5a772e..cc2110b3e 100644
--- a/src/Ombi/cypress/support/commands.js
+++ b/src/Ombi/cypress/support/commands.js
@@ -23,3 +23,37 @@
//
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
+
+Cypress.Commands.add('login', (username, password) => {
+ cy.request({
+ method: 'POST',
+ url: '/api/v1/token',
+ body: {
+ username: username,
+ password: password,
+ }
+ })
+ .then((resp) => {
+ window.localStorage.setItem('id_token', resp.body.access_token)
+ });
+});
+
+Cypress.Commands.add('createUser', (username, password, claims) => {
+ cy.request({
+ method: 'POST',
+ url: '/api/v1/identity',
+ body: {
+ UserName: username,
+ Password: password,
+ Claims: claims,
+ },
+ headers: {
+ 'Authorization': 'Bearer ' + window.localStorage.getItem('id_token'),
+ }
+ })
+})
+
+Cypress.Commands.add('verifyNotification', (text) => {
+ cy.get('.ui-growl-title').should('be.visible');
+ cy.get('.ui-growl-title').next().contains(text)
+})
\ No newline at end of file
|