Merge branch 'develop' of https://github.com/tidusjar/Ombi into develop

pull/2580/head^2
Anojh 6 years ago
commit 8471b74ca8

@ -94,13 +94,13 @@
</a>
</li>
<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} }}
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li [routerLinkActive]="['active']">
<a [routerLink]="['/usermanagement/updatedetails']">
<a id="updateUserDetails" [routerLink]="['/usermanagement/updatedetails']">
<i class="fa fa-key"></i>{{ 'NavigationBar.UpdateDetails' | translate }}</a>
</li>
<li [routerLinkActive]="['active']">

@ -33,7 +33,7 @@ include the remember me checkbox
</div>
</div>
<button class="btn btn-success" type="submit" [translate]="'Login.SignInButton'"></button>
<button class="btn btn-success" type="submit" data-test='signinbtn' [translate]="'Login.SignInButton'"></button>
<a [routerLink]="['/reset']" class="forgot-password col-md-12">
<b [translate]="'Login.ForgottenPassword'"></b>
</a>

@ -31,7 +31,7 @@
</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>
</form>

@ -1,5 +1,8 @@
<h3 *ngIf="!edit">Create User</h3>
<h3 *ngIf="edit && user"> User: {{user.userName}}</h3>
<p-confirmDialog></p-confirmDialog>
<button type="button" class="btn btn-primary-outline" style="float:right;" [routerLink]="['/usermanagement/']">Back</button>
<div *ngIf="!edit || edit && user">
@ -65,7 +68,7 @@
<div class="checkbox">
<input type="checkbox" [(ngModel)]="c.enabled" [value]="c.value" id="create{{c.value}}"
[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>
@ -77,7 +80,7 @@
<div class="checkbox">
<input type="checkbox" [(ngModel)]="c.enabled" [value]="c.value" id="create{{c.value}}"
[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>
@ -129,7 +132,7 @@
<label for="{{pref.agent}}" class="control-label">{{NotificationAgent[pref.agent]
| humanize}}</label>
<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}}">
</div>
</div>
@ -208,10 +211,10 @@
</div>
<div class="row">
<div class="col-md-12">
<button *ngIf="!edit" type="button" 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">
<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="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" style="float:right;" class="btn btn-info-outline" (click)="resetPassword()"
pTooltip="You need your SMTP settings setup">Send Reset Password Link</button>

@ -2,7 +2,7 @@
<button type="button" class="btn btn-success-outline" [routerLink]="['/usermanagement/user']">Add User To Ombi</button>
<button type="button" class="btn btn-success-outline" data-test="adduserbtn" [routerLink]="['/usermanagement/user']">Add User To Ombi</button>
<button type="button" style="float:right;" class="btn btn-primary-outline"(click)="showBulkEdit = !showBulkEdit" [disabled]="!hasChecked()">Bulk Edit</button>
<div *ngIf="plexEnabled">
@ -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>

@ -19,7 +19,7 @@
<div class="form-group">
<div style="text-align: center; margin-top: 20px">
<button (click)="createUser()" type="submit" class="btn btn-success-outline">Finish</button>
<button (click)="createUser()" data-test="createuserbtn" type="submit" class="btn btn-success-outline">Finish</button>
</div>
</div>
</div>

@ -16,7 +16,7 @@
</a>
</div>
<div class="row">
<button (click)="skip()" class="btn btn-primary-outline wizard-img" id="plexImg">
<button (click)="skip()" data-test="skipbtn" class="btn btn-primary-outline wizard-img" id="plexImg">
Skip
</button>
</div>

@ -9,7 +9,7 @@
<small>we are just going to run though the initial Ombi setup!</small>
<div style="text-align: center; margin-top: 20px">
<a (click)="next()" class="btn btn-primary-outline">Next</a>
<a (click)="next()" data-test="nextbtn" class="btn btn-primary-outline">Next</a>
</div>
</div>
</div>

@ -0,0 +1,4 @@
{
"projectId": "gms1wj",
"baseUrl": "http://localhost:3577"
}

@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}

@ -0,0 +1,36 @@
/// <reference types="Cypress" />
describe('Login Page', function () {
it('Invalid Password', function () {
cy.visit('/');
cy.contains('Sign in');
cy.get('#inputEmail').type('automation');
cy.get('#inputPassword').type('incorrectpw');
cy.get('[data-test=signinbtn]').click();
cy.verifyNotification('Incorrect username');
});
it('Invalid Username', function () {
cy.visit('/');
cy.contains('Sign in');
cy.get('#inputEmail').type('bad username');
cy.get('#inputPassword').type('incorrectpw');
cy.get('[data-test=signinbtn]').click();
cy.verifyNotification('Incorrect username');
});
it('Correct Login', function () {
cy.visit('/');
cy.contains('Sign in');
cy.get('#inputEmail').type('automation');
cy.get('#inputPassword').type('password');
cy.get('[data-test=signinbtn]').click();
cy.url().should('include', '/search')
});
})

@ -0,0 +1,198 @@
/// <reference types="Cypress" />
describe('User Management Page', function () {
beforeEach(function () {
cy.login('automation', 'password');
cy.createUser('userToDelete', 'password', [{
value: "requestmovie",
Enabled: "true",
}]);
cy.createUser('userToEdit', 'password', [{
value: "requestmovie",
Enabled: "true",
}]);
cy.visit('/usermanagement');
});
it('Loads users table', function () {
cy.contains("User Management");
cy.contains("Add User To Ombi");
});
it('Creates basic user', 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");
// setup the roles
cy.contains('Roles').click()
cy.get('#labelRequestTv').click();
cy.get('#labelRequestMovie').click();
// submit user
cy.get('[data-test=createuserbtn]').click();
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('Add request limits to a user', function () {
cy.get('#edituserToEdit').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=updatebtn]').click();
cy.verifyNotification('successfully');
// Verify that the limits are set
cy.get('#edituserToEdit').click();
cy.contains('Request Limits').click();
cy.get('#movieRequestLimit').should('have.attr', 'ng-reflect-model', '2')
cy.get('#musicRequestLimit').should('have.attr', 'ng-reflect-model', '3')
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');
});
});

@ -0,0 +1,21 @@
describe('Wizard Setup Tests', function() {
it('Setup Wizard User', function() {
cy.visit('http://localhost:3577/');
cy.url().should('include', '/Wizard')
cy.get('[data-test=nextbtn]').click();
// Media server page
cy.contains('Please choose your media server');
cy.get('[data-test=skipbtn]').click();
// Create user
cy.contains('Create the Admin account');
cy.get('#adminUsername').type('automation');
cy.get('#adminPassword').type('password');
// Submit user
cy.get('[data-test=createuserbtn]').click();
cy.contains('Sign in');
})
})

@ -0,0 +1,17 @@
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}

@ -0,0 +1,59 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- 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)
});

@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')

@ -7,7 +7,8 @@
"lint": "tslint -p .",
"publish": "gulp publish",
"restore": "dotnet restore && yarn install",
"clean": "gulp clean"
"clean": "gulp clean",
"cypress": "cypress open"
},
"dependencies": {
"@angular/animations": "^6.0.7",
@ -90,5 +91,8 @@
},
"resolutions": {
"@types/tapable": "1.0.0"
},
"devDependencies": {
"cypress": "^3.1.0"
}
}

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

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save