Fixed all the automation tests, and the bugs that the tests found

pull/4112/head
tidusjar 4 years ago
parent c5f123b903
commit e34ce215ac

@ -2,4 +2,5 @@
result: boolean;
message: string;
errorMessage: string;
requestId: number | undefined;
}

@ -9,6 +9,7 @@ export interface IUser {
emailAddress: string;
password: string;
userType: UserType;
userAlias: string;
lastLoggedIn: Date;
hasLoggedIn: boolean;
movieRequestLimit: number;

@ -75,7 +75,7 @@
</ng-template>
</span>
<span *ngIf="isAdmin && hasRequest">
<button id="approveBtn" *ngIf="!movie.approved" (click)="approve()" mat-raised-button class="btn-spacing" color="accent">
<button id="approveBtn" *ngIf="!movie.approved " (click)="approve()" mat-raised-button class="btn-spacing" color="accent">
<i class="fas fa-plus"></i> {{ 'Common.Approve' | translate }}
</button>
<button id="markAvailableBtn" *ngIf="!movie.available" (click)="markAvailable()" mat-raised-button class="btn-spacing"

@ -86,9 +86,16 @@ export class MovieDetailsComponent {
public async request(userId?: string) {
if (this.isAdmin) {
this.dialog.open(AdminRequestDialogComponent, { width: "700px", data: { type: RequestType.movie, id: this.movie.id }, panelClass: 'modal-panel' });
const dialog = this.dialog.open(AdminRequestDialogComponent, { width: "700px", data: { type: RequestType.movie, id: this.movie.id }, panelClass: 'modal-panel' });
dialog.afterClosed().subscribe(async (result) => {
if (result) {
this.movie.requested = true;
this.movie.requestId = result.requestId;
this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId);
}
});
} else {
const result = await this.requestService.requestMovie({ theMovieDbId: this.theMovidDbId, languageCode: null, requestOnBehalf: userId, qualityPathOverride: 0, rootFolderOverride: 0 }).toPromise();
const result = await this.requestService.requestMovie({ theMovieDbId: this.theMovidDbId, languageCode: null, requestOnBehalf: userId, qualityPathOverride: undefined, rootFolderOverride: undefined }).toPromise();
if (result.result) {
this.movie.requested = true;
this.messageService.send(result.message, "Ok");

@ -2,7 +2,7 @@
<div class="rating medium-font">
<span *ngIf="movie.voteAverage"
matTooltip="{{'MediaDetails.Votes' | translate }} {{movie.voteCount | thousandShort: 1}}">
<img class="rating-small" src="{{baseUrl}}/images/tmdb-logo.svg"> {{movie.voteAverage | number:'1.0-1'}}/10
<img class="rating-small" src="{{baseUrl}}images/tmdb-logo.svg"> {{movie.voteAverage | number:'1.0-1'}}/10
</span>
<span *ngIf="ratings?.critics_rating && ratings?.critics_score">
<img class="rating-small"

@ -1,9 +1,9 @@
<form [formGroup]="form" *ngIf="form">
<h1>Advanced Options</h1>
<h1 id="advancedOptionsTitle">{{'MediaDetails.AdvancedOptions' | translate }}</h1>
<div class="alert alert-info" role="alert">
You can configure the request here, once requested it will be send to your DVR application and will be auto approved!
{{'MediaDetails.AutoApproveOptions' | translate }}
</div>
<div style="max-width: 0; max-height: 0; overflow: hidden;">
@ -14,7 +14,8 @@
<h3>{{'MediaDetails.RequestOnBehalf' | translate }}</h3>
<mat-form-field class="example-full-width" appearance="outline" floatLabel=auto>
<mat-label>{{ 'MediaDetails.PleaseSelectUser' | translate}}</mat-label>
<input type="text"
<input id="requestOnBehalfUserInput"
type="text"
matInput
formControlName="username"
[matAutocomplete]="auto">
@ -35,16 +36,16 @@
<h3>Sonarr Overrides</h3>
<mat-form-field appearance="outline" floatLabel=auto>
<mat-label>{{'MediaDetails.QualityProfilesSelect' | translate }}</mat-label>
<mat-select formControlName="sonarrPathId">
<mat-option *ngFor="let profile of sonarrProfiles" value="{{profile.id}}">{{profile.name}}</mat-option>
<mat-select id="sonarrQualitySelect" formControlName="sonarrPathId">
<mat-option id="sonarrQualitySelect{{profile.id}}" *ngFor="let profile of sonarrProfiles" value="{{profile.id}}">{{profile.name}}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div >
<mat-form-field appearance="outline" floatLabel=auto>
<mat-label>{{'MediaDetails.RootFolderSelect' | translate }}</mat-label>
<mat-select formControlName="sonarrFolderId">
<mat-option *ngFor="let profile of sonarrRootFolders" value="{{profile.id}}">{{profile.path}}</mat-option>
<mat-select id="sonarrFolderSelect" formControlName="sonarrFolderId">
<mat-option id="sonarrFolderSelect{{profile.id}}" *ngFor="let profile of sonarrRootFolders" value="{{profile.id}}">{{profile.path}}</mat-option>
</mat-select>
</mat-form-field>
</div>
@ -52,21 +53,21 @@
<!-- End Sonarr-->
<!-- Radarr -->
<div *ngIf="data.type === RequestType.movie">
<div *ngIf="data.type === RequestType.movie && radarrEnabled">
<div>
<h3>Radarr Overrides</h3>
<mat-form-field appearance="outline" floatLabel=auto>
<mat-label>{{'MediaDetails.QualityProfilesSelect' | translate }}</mat-label>
<mat-select formControlName="radarrPathId">
<mat-option *ngFor="let profile of radarrProfiles" value="{{profile.id}}">{{profile.name}}</mat-option>
<mat-select id="radarrQualitySelect" formControlName="radarrPathId">
<mat-option id="radarrQualitySelect{{profile.id}}" *ngFor="let profile of radarrProfiles" value="{{profile.id}}">{{profile.name}}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div mat-dialog-content>
<mat-form-field appearance="outline" floatLabel=auto>
<mat-label>{{'MediaDetails.RootFolderSelect' | translate }}</mat-label>
<mat-select formControlName="radarrFolderId">
<mat-option *ngFor="let profile of radarrRootFolders" value="{{profile.id}}">{{profile.path}}</mat-option>
<mat-select id="radarrFolderSelect" formControlName="radarrFolderId">
<mat-option id="radarrFolderSelect{{profile.id}}" *ngFor="let profile of radarrRootFolders" value="{{profile.id}}">{{profile.path}}</mat-option>
</mat-select>
</mat-form-field>
</div>
@ -75,8 +76,8 @@
<div mat-dialog-actions>
<button mat-raised-button [mat-dialog-close]="" color="warn">{{ 'Common.Cancel' | translate }}</button>
<button mat-raised-button (click)="submitRequest()" color="accent">{{ 'Common.Request' | translate }}</button>
<button mat-raised-button id="cancelButton" [mat-dialog-close]="" color="warn">{{ 'Common.Cancel' | translate }}</button>
<button mat-raised-button id="requestButton" (click)="submitRequest()" color="accent">{{ 'Common.Request' | translate }}</button>
</div>
</form>

@ -112,11 +112,17 @@ export class AdminRequestDialogComponent implements OnInit {
}).subscribe((x) => {
if (x.result) {
this.notificationService.send(x.message, "Ok");
model.radarrQualityOverrideTitle = this.radarrProfiles?.filter(x => x.id == model.radarrPathId)[0]?.name;
model.radarrRootFolderTitle = this.radarrRootFolders?.filter(x => x.id == model.radarrFolderId)[0]?.path;
model.requestId = x.requestId;
this.dialogRef.close(model);
} else {
this.notificationService.send(x.errorMessage, "Ok");
}
this.dialogRef.close();
})
}

@ -78,6 +78,7 @@ export class UserManagementUserComponent implements OnInit {
episodeRequestQuota: null,
movieRequestQuota: null,
language: null,
userAlias: "",
streamingCountry: "US",
userQualityProfiles: {
radarrQualityProfile: 0,

@ -252,6 +252,7 @@
"ViewCollection":"View Collection",
"NotEnoughInfo": "Unfortunately there is not enough information about this show yet!",
"AdvancedOptions":"Advanced Options",
"AutoApproveOptions":"You can configure the request here, once requested it will be send to your DVR application and will be auto approved!",
"QualityProfilesSelect":"Select A Quality Profile",
"RootFolderSelect":"Select A Root Folder",
"Status":"Status",

@ -1,10 +1,15 @@
import { BasePage } from "../../base.page";
import { AdminRequestDialog } from "../../shared/AdminRequestDialog";
class MovieInformationPanel {
get denyReason(): Cypress.Chainable<any> {
return cy.get('#deniedReasonInfo');
}
get requestedBy(): Cypress.Chainable<any> {
return cy.get('#requestedByInfo');
}
}
class DenyModal {
@ -74,6 +79,7 @@ class MovieDetailsPage extends BasePage {
denyModal = new DenyModal();
informationPanel = new MovieInformationPanel();
adminOptionsDialog = new AdminRequestDialog();
constructor() {
super();

@ -0,0 +1,58 @@
export class AdminRequestDialog {
isOpen(): Cypress.Chainable<any> {
return cy.waitUntil(x => {
return this.title.should('exist');
});
}
get title(): Cypress.Chainable<any> {
return cy.get(`#advancedOptionsTitle`);
}
get requestOnBehalfUserInput(): Cypress.Chainable<any> {
return cy.get(`#requestOnBehalfUserInput`);
}
get sonarrQualitySelect(): Cypress.Chainable<any> {
return cy.get(`#sonarrQualitySelect`);
}
selectSonarrQuality(id: number): Cypress.Chainable<any> {
return cy.get(`#sonarrQualitySelect${id}`);
}
get sonarrFolderSelect(): Cypress.Chainable<any> {
return cy.get(`#sonarrFolderSelect`);
}
selectSonarrFolder(id: number): Cypress.Chainable<any> {
return cy.get(`#sonarrFolderSelect${id}`);
}
get radarrQualitySelect(): Cypress.Chainable<any> {
return cy.get(`#radarrQualitySelect`);
}
selectradarrQuality(id: number): Cypress.Chainable<any> {
return cy.get(`#radarrQualitySelect${id}`);
}
get radarrFolderSelect(): Cypress.Chainable<any> {
return cy.get(`#radarrFolderSelect`);
}
selectradarrFolder(id: number): Cypress.Chainable<any> {
return cy.get(`#radarrFolderSelect${id}`);
}
get cancelButton(): Cypress.Chainable<any> {
return cy.get(`#cancelButton`);
}
get requestButton(): Cypress.Chainable<any> {
return cy.get(`#requestButton`);
}
}

@ -6,6 +6,10 @@ describe("Movie Details Buttons", () => {
Page.visit("587807");
Page.requestButton.click();
Page.adminOptionsDialog.isOpen();
Page.adminOptionsDialog.requestButton.click();
cy.verifyNotification("Tom & Jerry (2021) has been successfully added");
Page.requestedButton.should("be.visible");
@ -83,6 +87,8 @@ describe("Movie Details Buttons", () => {
Page.visit("399566");
Page.requestButton.click();
Page.adminOptionsDialog.isOpen();
Page.adminOptionsDialog.requestButton.click();
cy.verifyNotification(
"Godzilla vs. Kong (2021) has been successfully added"
);
@ -96,12 +102,14 @@ describe("Movie Details Buttons", () => {
Page.availableButton.should("exist");
});
it("Movie Requested, Deny Movie", () => {
it.only("Movie Requested, Deny Movie", () => {
cy.login();
Page.visit("671");
Page.requestButton.click();
Page.adminOptionsDialog.isOpen();
Page.adminOptionsDialog.requestButton.click();
cy.verifyNotification(
"Harry Potter and the Philosopher's Stone (2001) has been successfully added"
);
@ -112,6 +120,7 @@ describe("Movie Details Buttons", () => {
Page.denyButton.click();
Page.denyModal.denyReason.type("Automation Tests");
cy.wait(500);
Page.denyModal.denyButton.click();
Page.deniedButton.should('exist');

@ -173,7 +173,7 @@ describe("Discover Cards Requests Tests", () => {
});
});
it.only("Not available TV does not allow us to request", () => {
it("Not available TV does not allow us to request", () => {
cy.intercept("GET", "**/search/Tv/popular/**", (req) => {
req.reply((res) => {
const body = res.body;

Loading…
Cancel
Save