mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
More UI tests !wip
This commit is contained in:
parent
f586d4f082
commit
8764ec3a78
5 changed files with 133 additions and 25 deletions
|
@ -214,7 +214,7 @@
|
|||
<button *ngIf="!edit" type="button" data-test="createuserbtn" class="btn btn-danger-outline" (click)="create()">Create</button>
|
||||
<div *ngIf="edit">
|
||||
<button type="button" class="btn btn-primary-outline" (click)="update()">Update</button>
|
||||
<button type="button" class="btn btn-danger-outline" (click)="delete()">Delete</button>
|
||||
<button type="button" data-test="deletebtn" class="btn btn-danger-outline" (click)="delete()">Delete</button>
|
||||
<button type="button" style="float:right;" class="btn btn-info-outline" (click)="resetPassword()"
|
||||
pTooltip="You need your SMTP settings setup">Send Reset Password Link</button>
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<span *ngIf="u.userType === 3">Emby User</span>
|
||||
</td>
|
||||
<td>
|
||||
<a [routerLink]="['/usermanagement/user/' + u.id]" class="btn btn-sm btn-info-outline">Details/Edit</a>
|
||||
<a id="edit{{u.userName}}" [routerLink]="['/usermanagement/user/' + u.id]" class="btn btn-sm btn-info-outline">Details/Edit</a>
|
||||
</td>
|
||||
<td *ngIf="customizationSettings">
|
||||
<button *ngIf="!u.hasLoggedIn" (click)="welcomeEmail(u)" [disabled]="!customizationSettings.applicationUrl" class="btn btn-sm btn-info-outline">Send Welcome Email</button>
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
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);
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
|
@ -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)
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue