mirror of https://github.com/Ombi-app/Ombi
commit
442b0ff90c
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,36 @@
|
||||
import { PlatformLocation } from "@angular/common";
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { Injectable } from "@angular/core";
|
||||
|
||||
import { IVoteEngineResult, IVoteViewModel } from "../interfaces";
|
||||
import { ServiceHelpers } from "./service.helpers";
|
||||
|
||||
@Injectable()
|
||||
export class VoteService extends ServiceHelpers {
|
||||
constructor(public http: HttpClient, public platformLocation: PlatformLocation) {
|
||||
super(http, "/api/v1/Vote/", platformLocation);
|
||||
}
|
||||
|
||||
public async getModel(): Promise<IVoteViewModel[]> {
|
||||
return await this.http.get<IVoteViewModel[]>(`${this.url}`, {headers: this.headers}).toPromise();
|
||||
}
|
||||
|
||||
public async upvoteMovie(requestId: number): Promise<IVoteEngineResult> {
|
||||
return await this.http.post<IVoteEngineResult>(`${this.url}up/movie/${requestId}`, {headers: this.headers}).toPromise();
|
||||
}
|
||||
public async upvoteTv(requestId: number): Promise<IVoteEngineResult> {
|
||||
return await this.http.post<IVoteEngineResult>(`${this.url}up/tv/${requestId}`, {headers: this.headers}).toPromise();
|
||||
}
|
||||
public async upvoteAlbum(requestId: number): Promise<IVoteEngineResult> {
|
||||
return await this.http.post<IVoteEngineResult>(`${this.url}up/album/${requestId}`, {headers: this.headers}).toPromise();
|
||||
}
|
||||
public async downvoteMovie(requestId: number): Promise<IVoteEngineResult> {
|
||||
return await this.http.post<IVoteEngineResult>(`${this.url}down/movie/${requestId}`, {headers: this.headers}).toPromise();
|
||||
}
|
||||
public async downvoteTv(requestId: number): Promise<IVoteEngineResult> {
|
||||
return await this.http.post<IVoteEngineResult>(`${this.url}down/tv/${requestId}`, {headers: this.headers}).toPromise();
|
||||
}
|
||||
public async downvoteAlbum(requestId: number): Promise<IVoteEngineResult> {
|
||||
return await this.http.post<IVoteEngineResult>(`${this.url}down/album/${requestId}`, {headers: this.headers}).toPromise();
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
<h1>Vote</h1>
|
||||
|
||||
|
||||
|
||||
<ul id="nav-tabs" class="nav nav-tabs" role="tablist">
|
||||
|
||||
<li role="presentation" class="active">
|
||||
<a id="currentVotes" href="#currentVotes" aria-controls="home" role="tab" data-toggle="tab" (click)="selectCurrentTab()"><i
|
||||
class="fa fa-meh-o"></i> {{ 'Votes.VotesTab' | translate }}</a>
|
||||
</li>
|
||||
|
||||
<li role="presentation">
|
||||
<a id="completedVotes" href="#completedVotes" aria-controls="profile" role="tab" data-toggle="tab" (click)="selectCompletedVotesTab()"><i
|
||||
class="fa fa-smile-o"></i> {{ 'Votes.CompletedVotesTab' | translate }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
|
||||
<div [hidden]="!showCurrent">
|
||||
<div *ngIf="currentVotes">
|
||||
<table class="table table-striped table-hover table-responsive table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width: 10%"></td>
|
||||
<td></td>
|
||||
<td style="width: 10%">Title</td>
|
||||
<td>Description</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let vm of currentVotes">
|
||||
<td class="vcenter">
|
||||
<button id="{{vm.requestId}}upvote" class="btn btn-info-outline col-md-6" (click)="upvote(vm)"><i class="fa fa-thumbs-o-up"
|
||||
aria-hidden="true"></i></button>
|
||||
<button id="{{vm.requestId}}downvote" class="btn btn-info-outline col-md-6" (click)="downvote(vm)" ><i class="fa fa-thumbs-o-down"
|
||||
aria-hidden="true"></i></button>
|
||||
</td>
|
||||
<td style="width: 10%"> <img *ngIf="vm.image" class="img-responsive poster" style="max-width: 100%;
|
||||
height: auto;
|
||||
width: 100%;"
|
||||
(click)="toggle($event, vm.image)" src="{{vm.image}}" alt="poster"></td>
|
||||
<td class="vcenter" [attr.data-test]='vm.requestId'>{{vm.title}}</td>
|
||||
<td class="vcenter" [innerHTML]="vm.description"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div [hidden]="!showCompleted">
|
||||
<div *ngIf="completedVotes">
|
||||
<table class="table table-striped table-hover table-responsive table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width: 10%"></td>
|
||||
<td></td>
|
||||
<td style="width: 10%">Title</td>
|
||||
<td>Description</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let vm of completedVotes">
|
||||
<td class="vcenter">
|
||||
<button id="{{vm.requestId}}upvote" class="btn btn-info-outline col-md-6" [ngClass]="{'btn-success-outline': vm.myVote == VoteType.Upvote, 'btn-info-outline': vm.myVote != VoteType.Upvote}"
|
||||
(click)="upvote(vm)" [disabled]="vm.myVote == VoteType.Upvote"><i class="fa fa-thumbs-o-up"
|
||||
aria-hidden="true"></i></button>
|
||||
<button id="{{vm.requestId}}downvote" class="btn btn-info-outline col-md-6" [ngClass]="{'btn-danger-outline': vm.myVote == VoteType.Downvote, 'btn-info-outline': vm.myVote != VoteType.Downvote}"
|
||||
(click)="downvote(vm)" [disabled]="vm.myVote == VoteType.Downvote"><i class="fa fa-thumbs-o-down"
|
||||
aria-hidden="true"></i></button>
|
||||
</td>
|
||||
<td style="width: 10%"> <img *ngIf="vm.image" class="img-responsive poster" style="max-width: 100%;
|
||||
height: auto;
|
||||
width: 100%;"
|
||||
(click)="toggle($event, vm.image)" src="{{vm.image}}" alt="poster"></td>
|
||||
<td class="vcenter" [attr.data-test]='vm.requestId'>{{vm.title}}</td>
|
||||
<td class="vcenter" [innerHTML]="vm.description"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<p-overlayPanel #op [dismissable]="true" [styleClass]="'hideBackground'">
|
||||
<img class="img-responsive poster" width="70%" src="{{panelImage}}" alt="poster">
|
||||
</p-overlayPanel>
|
@ -0,0 +1,12 @@
|
||||
.vcenter {
|
||||
vertical-align: middle;
|
||||
float: none;
|
||||
}
|
||||
|
||||
.hideBackground {
|
||||
border: 0px solid transparent !important;
|
||||
background: transparent !important;
|
||||
-webkit-box-shadow: 0 0px 0px 0 transparent !important;
|
||||
-moz-box-shadow: 0 0px 0px 0 transparent !important;
|
||||
box-shadow: 0 0px 0px 0 transparent !important;
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||
|
||||
import { OverlayPanel } from "primeng/primeng";
|
||||
import { NotificationService, VoteService } from "../services";
|
||||
|
||||
import { IVoteEngineResult, IVoteViewModel, RequestTypes, VoteType } from "../interfaces";
|
||||
|
||||
@Component({
|
||||
templateUrl: "vote.component.html",
|
||||
styleUrls: ["vote.component.scss"],
|
||||
})
|
||||
export class VoteComponent implements OnInit {
|
||||
|
||||
public showCurrent: boolean = true;
|
||||
public showCompleted: boolean;
|
||||
public viewModel: IVoteViewModel[];
|
||||
public currentVotes: IVoteViewModel[];
|
||||
public completedVotes: IVoteViewModel[];
|
||||
public VoteType = VoteType;
|
||||
public panelImage: string;
|
||||
@ViewChild("op") public overlayPanel: OverlayPanel;
|
||||
|
||||
constructor(private voteService: VoteService, private notificationSerivce: NotificationService) { }
|
||||
|
||||
public async ngOnInit() {
|
||||
this.viewModel = await this.voteService.getModel();
|
||||
this.filterLists();
|
||||
}
|
||||
|
||||
public selectCurrentTab() {
|
||||
this.showCurrent = true;
|
||||
this.showCompleted = false;
|
||||
}
|
||||
|
||||
public selectCompletedVotesTab() {
|
||||
this.showCurrent = false;
|
||||
this.showCompleted = true;
|
||||
}
|
||||
|
||||
public toggle(event: any, image: string) {
|
||||
this.panelImage = image;
|
||||
this.overlayPanel.toggle(event);
|
||||
}
|
||||
|
||||
public async upvote(vm: IVoteViewModel) {
|
||||
let result: IVoteEngineResult = {errorMessage:"", isError: false, message:"",result:false};
|
||||
switch(vm.requestType) {
|
||||
case RequestTypes.Album:
|
||||
result = await this.voteService.upvoteAlbum(vm.requestId);
|
||||
break;
|
||||
case RequestTypes.Movie:
|
||||
result = await this.voteService.upvoteMovie(vm.requestId);
|
||||
break;
|
||||
case RequestTypes.TvShow:
|
||||
result = await this.voteService.upvoteTv(vm.requestId);
|
||||
break;
|
||||
}
|
||||
|
||||
if(result.isError) {
|
||||
this.notificationSerivce.error(result.errorMessage);
|
||||
} else {
|
||||
this.notificationSerivce.success("Voted!");
|
||||
vm.alreadyVoted = true;
|
||||
vm.myVote = VoteType.Upvote;
|
||||
this.filterLists();
|
||||
}
|
||||
}
|
||||
|
||||
public async downvote(vm: IVoteViewModel) {
|
||||
let result: IVoteEngineResult = {errorMessage:"", isError: false, message:"",result:false};
|
||||
switch(vm.requestType) {
|
||||
case RequestTypes.Album:
|
||||
result = await this.voteService.downvoteAlbum(vm.requestId);
|
||||
break;
|
||||
case RequestTypes.Movie:
|
||||
result = await this.voteService.downvoteMovie(vm.requestId);
|
||||
break;
|
||||
case RequestTypes.TvShow:
|
||||
result = await this.voteService.downvoteTv(vm.requestId);
|
||||
break;
|
||||
}
|
||||
|
||||
if(result.isError) {
|
||||
this.notificationSerivce.error(result.errorMessage);
|
||||
} else {
|
||||
this.notificationSerivce.success("Voted!");
|
||||
vm.alreadyVoted = true;
|
||||
vm.myVote = VoteType.Downvote;
|
||||
this.filterLists();
|
||||
}
|
||||
}
|
||||
|
||||
private filterLists() {
|
||||
this.completedVotes = this.viewModel.filter(vm => {
|
||||
return vm.alreadyVoted;
|
||||
});
|
||||
this.currentVotes = this.viewModel.filter(vm => {
|
||||
return !vm.alreadyVoted;
|
||||
});
|
||||
}
|
||||
}
|
@ -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,4 @@
|
||||
{
|
||||
"username": "automation",
|
||||
"password": "password"
|
||||
}
|
@ -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,140 @@
|
||||
/// <reference types="Cypress" />
|
||||
|
||||
describe('Voting Feature', function () {
|
||||
beforeEach(function () {
|
||||
cy.login('automation', 'password').then(() => {
|
||||
|
||||
cy.removeAllMovieRequests();
|
||||
|
||||
cy.createUser('basicUser', 'password', [{
|
||||
value: "requestmovie",
|
||||
Enabled: "true",
|
||||
}, {
|
||||
value: "requesttv",
|
||||
Enabled: "true",
|
||||
}, {
|
||||
value: "requestmusic",
|
||||
Enabled: "true",
|
||||
},
|
||||
]);
|
||||
|
||||
cy.createUser('basicUser2', 'password', [{
|
||||
value: "requestmovie",
|
||||
Enabled: "true",
|
||||
}, {
|
||||
value: "requesttv",
|
||||
Enabled: "true",
|
||||
}, {
|
||||
value: "requestmusic",
|
||||
Enabled: "true",
|
||||
},
|
||||
]);
|
||||
|
||||
// Enable voting
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: '/api/v1/Settings/vote',
|
||||
body: {
|
||||
Enabled: true,
|
||||
MovieVoteMax: 2,
|
||||
MusicVoteMax: 2,
|
||||
TvShowVoteMax: 2,
|
||||
},
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + window.localStorage.getItem('id_token'),
|
||||
}
|
||||
});
|
||||
|
||||
// Login as regular user
|
||||
cy.login('basicUser', 'password').then(() => {
|
||||
|
||||
cy.visit('/vote');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
///
|
||||
/// Make sure we can load the page
|
||||
///
|
||||
it('Loads votes page', function () {
|
||||
// cy.login('basicUser','password');
|
||||
cy.contains("Vote");
|
||||
});
|
||||
|
||||
///
|
||||
/// Make sure that when we request a movie it automatically get's upvoted
|
||||
///
|
||||
it('Request Movie automatically upvotes when I am the requestor', function () {
|
||||
cy.requestMovie(335983).then(() => {
|
||||
cy.visit('/vote');
|
||||
cy.get('#completedVotes').click();
|
||||
cy.contains('Venom').should('have.attr', 'data-test').then(($id) => {
|
||||
cy.get('#' + $id + 'upvote').should('have.attr', 'disabled');
|
||||
cy.get('#' + $id + 'downvote').should('not.have.attr', 'disabled');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
///
|
||||
/// Make sure that when we request a tv show it automatically get's upvoted
|
||||
///
|
||||
it('Request TV automatically upvotes when I am the requestor', function () {
|
||||
cy.requestAllTv(305288).then(() => {
|
||||
cy.visit('/vote');
|
||||
cy.get('#completedVotes').click();
|
||||
cy.contains('Stranger Things').should('have.attr', 'data-test').then(($id) => {
|
||||
cy.get('#' + $id + 'upvote').should('have.attr', 'disabled');
|
||||
cy.get('#' + $id + 'downvote').should('not.have.attr', 'disabled');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
///
|
||||
/// Upvotes a movie with a different user, the votes should eq 2
|
||||
/// Meaning it should be approved now
|
||||
///
|
||||
it.only('Upvote Movie to be approved', function () {
|
||||
cy.login('basicUser2', 'password').then(() => {
|
||||
cy.requestMovie(439079).then(() => {
|
||||
cy.login('basicUser', 'password').then(() => {
|
||||
|
||||
cy.visit('/vote');
|
||||
cy.contains('The Nun').should('have.attr', 'data-test').then(($id) => {
|
||||
cy.get('#' + $id + 'upvote').click();
|
||||
cy.verifyNotification('Voted!');
|
||||
|
||||
// Verify it's in the completed panel
|
||||
cy.get('#completedVotes').click(); cy.contains('The Nun').should('have.attr', 'data-test').then(($id) => {
|
||||
cy.get('#' + $id + 'upvote').should('have.attr', 'disabled');
|
||||
cy.get('#' + $id + 'downvote').should('not.have.attr', 'disabled');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it.only('Downvote Movie', function () {
|
||||
cy.login('basicUser2', 'password').then(() => {
|
||||
cy.requestMovie(439079).then(() => {
|
||||
cy.login('basicUser', 'password').then(() => {
|
||||
|
||||
cy.visit('/vote');
|
||||
cy.contains('The Nun').should('have.attr', 'data-test').then(($id) => {
|
||||
cy.get('#' + $id + 'downvote').click();
|
||||
cy.verifyNotification('Voted!');
|
||||
|
||||
// Verify it's in the completed panel
|
||||
cy.get('#completedVotes').click(); cy.contains('The Nun').should('have.attr', 'data-test').then(($id) => {
|
||||
cy.get('#' + $id + 'upvote').should('not.have.attr', 'disabled');
|
||||
cy.get('#' + $id + 'downvote').should('have.attr', 'disabled');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue