Added more UI test !wip

pull/2605/head
Jamie 6 years ago
parent 8764ec3a78
commit 148e394896

@ -94,13 +94,13 @@
</a> </a>
</li> </li>
<li [routerLinkActive]="['active']" class="dropdown"> <li [routerLinkActive]="['active']" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <a href="#" id="userDropdown" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<i class="fa fa-user"></i>{{ 'NavigationBar.Welcome' | translate: {username: user.name} }} <i class="fa fa-user"></i>{{ 'NavigationBar.Welcome' | translate: {username: user.name} }}
<span class="caret"></span> <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li [routerLinkActive]="['active']"> <li [routerLinkActive]="['active']">
<a [routerLink]="['/usermanagement/updatedetails']"> <a id="updateUserDetails" [routerLink]="['/usermanagement/updatedetails']">
<i class="fa fa-key"></i>{{ 'NavigationBar.UpdateDetails' | translate }}</a> <i class="fa fa-key"></i>{{ 'NavigationBar.UpdateDetails' | translate }}</a>
</li> </li>
<li [routerLinkActive]="['active']"> <li [routerLinkActive]="['active']">

@ -31,7 +31,7 @@
</div> </div>
</div> </div>
<div> <div>
<button type="submit" class="btn btn-primary-outline" [disabled]="form.invalid">Save</button> <button type="submit" data-test="submitbtn" class="btn btn-primary-outline" [disabled]="form.invalid">Save</button>
</div> </div>
</form> </form>

@ -80,7 +80,7 @@
<div class="checkbox"> <div class="checkbox">
<input type="checkbox" [(ngModel)]="c.enabled" [value]="c.value" id="create{{c.value}}" <input type="checkbox" [(ngModel)]="c.enabled" [value]="c.value" id="create{{c.value}}"
[attr.name]="'create' + c.value" ng-checked="c.enabled"> [attr.name]="'create' + c.value" ng-checked="c.enabled">
<label for="create{{c.value}}">{{c.value | humanize}}</label> <label id="label{{c.value}}" for="create{{c.value}}">{{c.value | humanize}}</label>
</div> </div>
</div> </div>
@ -132,7 +132,7 @@
<label for="{{pref.agent}}" class="control-label">{{NotificationAgent[pref.agent] <label for="{{pref.agent}}" class="control-label">{{NotificationAgent[pref.agent]
| humanize}}</label> | humanize}}</label>
<div> <div>
<input type="text" [(ngModel)]="pref.value" class="form-control form-control-custom" <input type="text" [attr.data-test]="NotificationAgent[pref.agent]" [(ngModel)]="pref.value" class="form-control form-control-custom"
name="{{pref.agent}}" value="{{pref?.value}}"> name="{{pref.agent}}" value="{{pref?.value}}">
</div> </div>
</div> </div>
@ -213,7 +213,7 @@
<div class="col-md-12"> <div class="col-md-12">
<button *ngIf="!edit" type="button" data-test="createuserbtn" class="btn btn-danger-outline" (click)="create()">Create</button> <button *ngIf="!edit" type="button" data-test="createuserbtn" class="btn btn-danger-outline" (click)="create()">Create</button>
<div *ngIf="edit"> <div *ngIf="edit">
<button type="button" class="btn btn-primary-outline" (click)="update()">Update</button> <button type="button" data-test="updatebtn" class="btn btn-primary-outline" (click)="update()">Update</button>
<button type="button" data-test="deletebtn" 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()" <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> pTooltip="You need your SMTP settings setup">Send Reset Password Link</button>

@ -8,6 +8,11 @@ describe('User Management Page', function () {
Enabled: "true", Enabled: "true",
}]); }]);
cy.createUser('userToEdit', 'password', [{
value: "requestmovie",
Enabled: "true",
}]);
cy.visit('/usermanagement'); cy.visit('/usermanagement');
}); });
@ -86,20 +91,8 @@ describe('User Management Page', function () {
}) })
it.only('Creates user with request limits', function () { it('Add request limits to a user', function () {
cy.get('[data-test=adduserbtn').click(); cy.get('#edituserToEdit').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.contains('Request Limits').click();
cy.get('#movieRequestLimit').clear().type(2); cy.get('#movieRequestLimit').clear().type(2);
@ -107,17 +100,98 @@ describe('User Management Page', function () {
cy.get('#episodeRequestLimit').clear().type(4); cy.get('#episodeRequestLimit').clear().type(4);
// submit user // submit user
cy.get('[data-test=createuserbtn]').click(); cy.get('[data-test=updatebtn]').click();
cy.verifyNotification('has been updated successfully'); cy.verifyNotification('successfully');
// Verify that the limits are set // Verify that the limits are set
cy.get('#edituser2').click(); cy.get('#edituserToEdit').click();
cy.contains('Request Limits').click(); cy.contains('Request Limits').click();
cy.get('#movieRequestLimit').should('eq', 2); cy.get('#movieRequestLimit').should('have.attr', 'ng-reflect-model', '2')
cy.get('#musicRequestLimit').should('eq', 3); cy.get('#musicRequestLimit').should('have.attr', 'ng-reflect-model', '3')
cy.get('#tvRequestLimit').should('eq', 4); cy.get('#episodeRequestLimit').should('have.attr', 'ng-reflect-model', '4')
});
it('Add notification preferences to user', function () {
cy.get('#edituserToEdit').click();
cy.contains('Notification Preferences').click();
cy.get('[data-test=Discord]').clear().type("Discord");
cy.get('[data-test=Pushbullet]').clear().type("Pushbullet");
cy.get('[data-test=Pushover]').clear().type("Pushover");
cy.get('[data-test=Telegram]').clear().type("Telegram");
cy.get('[data-test=Slack]').clear().type("Slack");
cy.get('[data-test=Mattermost]').clear().type("Mattermost");
// submit user
cy.get('[data-test=updatebtn]').click();
cy.verifyNotification('successfully');
// Verify that the limits are set
cy.get('#edituserToEdit').click();
cy.contains('Notification Preferences').click();
cy.get('[data-test=Discord]').should('have.attr', 'ng-reflect-model', "Discord");
cy.get('[data-test=Pushbullet]').should('have.attr', 'ng-reflect-model', "Pushbullet");
cy.get('[data-test=Pushover]').should('have.attr', 'ng-reflect-model', "Pushover");
cy.get('[data-test=Telegram]').should('have.attr', 'ng-reflect-model', "Telegram");
cy.get('[data-test=Slack]').should('have.attr', 'ng-reflect-model', "Slack");
cy.get('[data-test=Mattermost]').should('have.attr', 'ng-reflect-model', "Mattermost");
});
it('Modify roles', function () {
cy.get('#edituserToEdit').click();
cy.contains('Roles').click();
cy.get('#labelRequestMovie').click();
cy.get('#labelRequestTv').click();
// submit user
cy.get('[data-test=updatebtn]').click();
cy.verifyNotification('successfully');
// Verify that the limits are set
cy.get('#edituserToEdit').click();
cy.contains('Roles').click();
cy.get('#createRequestMovie').should('have.attr', 'ng-reflect-model', 'true');
cy.get('#createRequestTv').should('have.attr', 'ng-reflect-model', 'true');
cy.get('#createDisabled').should('have.attr', 'ng-reflect-model', 'false');
});
it('Update local users info', function () {
cy.get('#userDropdown').click();
cy.get('#updateUserDetails').click();
cy.url().should('include','/updatedetails');
cy.get('#emailAddress').clear().type("user11@emailaddress.com");
cy.get('#currentPassword').type("password");
cy.get('[data-test=submitbtn]').click();
cy.verifyNotification('All of your details have now been updated');
});
it('Update local users info with bad password', function () {
cy.get('#userDropdown').click();
cy.get('#updateUserDetails').click();
cy.url().should('include','/updatedetails');
cy.get('#emailAddress').clear().type("user11@emailaddress.com");
cy.get('#currentPassword').type("password32113123123");
cy.get('[data-test=submitbtn]').click();
cy.verifyNotification('Your password is incorrect');
}); });

@ -56,4 +56,4 @@ Cypress.Commands.add('createUser', (username, password, claims) => {
Cypress.Commands.add('verifyNotification', (text) => { Cypress.Commands.add('verifyNotification', (text) => {
cy.get('.ui-growl-title').should('be.visible'); cy.get('.ui-growl-title').should('be.visible');
cy.get('.ui-growl-title').next().contains(text) cy.get('.ui-growl-title').next().contains(text)
}) });

@ -1,12 +0,0 @@
{
"compilerOptions": {
"allowJs": true,
"baseUrl": "../node_modules",
"types": [
"cypress"
]
},
"include": [
"**/*.*"
]
}

@ -2,6 +2,7 @@
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es5",
"lib": [ "lib": [
"es2015",
"es2017", "es2017",
"dom" "dom"
], ],
@ -27,6 +28,9 @@
} }
] ]
}, },
"types": [
"cypress"
],
"include": [ "include": [
"ClientApp/**/*", "ClientApp/**/*",
"typings/**/*", "typings/**/*",

Loading…
Cancel
Save