mirror of https://github.com/Ombi-app/Ombi
parent
432fb683c2
commit
c2a3fd1c4f
@ -1,11 +1,11 @@
|
||||
<mat-nav-list>
|
||||
<a (click)="delete()" mat-list-item>
|
||||
<a id="requestDelete" (click)="delete()" mat-list-item>
|
||||
<span mat-line>{{'Requests.RequestPanel.Delete' | translate}}</span>
|
||||
</a>
|
||||
<a *ngIf="data.canApprove" (click)="approve()" mat-list-item>
|
||||
<a id="requestApprove" *ngIf="data.canApprove" (click)="approve()" mat-list-item>
|
||||
<span mat-line>{{'Requests.RequestPanel.Approve' | translate}}</span>
|
||||
</a>
|
||||
<a *ngIf="data.type !== RequestType.tvShow" (click)="changeAvailability()" mat-list-item>
|
||||
<a id="requestChangeAvailability" *ngIf="data.type !== RequestType.tvShow" (click)="changeAvailability()" mat-list-item>
|
||||
<span mat-line>{{'Requests.RequestPanel.ChangeAvailability' | translate}}</span>
|
||||
</a>
|
||||
</mat-nav-list>
|
@ -0,0 +1,132 @@
|
||||
import { BasePage } from "../base.page";
|
||||
|
||||
class MediaBaseTab {
|
||||
get allRequestsButton(): Cypress.Chainable<any> {
|
||||
return cy.get('#filterAll');
|
||||
}
|
||||
|
||||
get pendingRequestsButton(): Cypress.Chainable<any> {
|
||||
return cy.get('#filterPending');
|
||||
}
|
||||
|
||||
get processingRequestsButton(): Cypress.Chainable<any> {
|
||||
return cy.get('#filterProcessing');
|
||||
}
|
||||
|
||||
get availableRequestsButton(): Cypress.Chainable<any> {
|
||||
return cy.get('#filterAvailable');
|
||||
}
|
||||
|
||||
get deniedRequestsButton(): Cypress.Chainable<any> {
|
||||
return cy.get('#filterDenied');
|
||||
}
|
||||
|
||||
get requestsToDisplayDropdown(): Cypress.Chainable<any> {
|
||||
return cy.get('#requestsToDisplayDropdown');
|
||||
}
|
||||
|
||||
getGridRow(requestId: number): GridRow {
|
||||
return new GridRow(requestId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class GridRow {
|
||||
requestId: number;
|
||||
get title(): Cypress.Chainable<any> {
|
||||
return cy.get(`#title${this.requestId}`);
|
||||
}
|
||||
|
||||
get requestedBy(): Cypress.Chainable<any> {
|
||||
return cy.get(`#requestedBy${this.requestId}`);
|
||||
}
|
||||
|
||||
get requestedDate(): Cypress.Chainable<any> {
|
||||
return cy.get(`#requestedDate${this.requestId}`);
|
||||
}
|
||||
|
||||
get requestedStatus(): Cypress.Chainable<any> {
|
||||
return cy.get(`#requestedStatus${this.requestId}`);
|
||||
}
|
||||
|
||||
get status(): Cypress.Chainable<any> {
|
||||
return cy.get(`#status${this.requestId}`);
|
||||
}
|
||||
|
||||
get detailsButton(): Cypress.Chainable<any> {
|
||||
return cy.get(`#detailsButton${this.requestId}`);
|
||||
}
|
||||
|
||||
get optionsButton(): Cypress.Chainable<any> {
|
||||
return cy.get(`#optionsButton${this.requestId}`);
|
||||
}
|
||||
|
||||
get optionsDelete(): Cypress.Chainable<any> {
|
||||
return cy.get(`#requestDelete`);
|
||||
}
|
||||
|
||||
get optionsApprove(): Cypress.Chainable<any> {
|
||||
return cy.get(`#requestApprove`);
|
||||
}
|
||||
|
||||
get optionsChangeAvailability(): Cypress.Chainable<any> {
|
||||
return cy.get(`#requestChangeAvailability`);
|
||||
}
|
||||
|
||||
constructor(requestId: number) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
}
|
||||
|
||||
class MoviesTab extends MediaBaseTab {
|
||||
|
||||
get adminMasterCheckbox(): Cypress.Chainable<any> {
|
||||
return cy.get('#adminMasterCheckbox');
|
||||
}
|
||||
|
||||
get bulkFabButton(): Cypress.Chainable<any> {
|
||||
return cy.get('#bulkFab');
|
||||
}
|
||||
|
||||
get deleteFabButton(): Cypress.Chainable<any> {
|
||||
return cy.get('#deleteFabButton');
|
||||
}
|
||||
|
||||
get approveFabButton(): Cypress.Chainable<any> {
|
||||
return cy.get('#approveFabButton');
|
||||
}
|
||||
}
|
||||
|
||||
class RequestsPage extends BasePage {
|
||||
|
||||
get moviesTab(): Cypress.Chainable<any> {
|
||||
return cy.get('[role="tab"]').eq(0);
|
||||
}
|
||||
|
||||
get tvTab(): Cypress.Chainable<any> {
|
||||
return cy.get('[role="tab"]').eq(1);
|
||||
}
|
||||
|
||||
get musicTab(): Cypress.Chainable<any> {
|
||||
return cy.get('[role="tab"]').eq(2);
|
||||
}
|
||||
|
||||
movies = new MoviesTab();
|
||||
tv = new MediaBaseTab();
|
||||
music = new MediaBaseTab();
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
visit(options: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
|
||||
visit(): Cypress.Chainable<Cypress.AUTWindow>;
|
||||
visit(id: string): Cypress.Chainable<Cypress.AUTWindow>;
|
||||
visit(id: string, options: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
|
||||
visit(id?: any, options?: any) {
|
||||
return cy.visit(`/requests-list`, options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const requestPage = new RequestsPage();
|
@ -0,0 +1,47 @@
|
||||
import {
|
||||
requestPage as Page,
|
||||
tvDetailsPage as TvPage,
|
||||
} from "@/integration/page-objects";
|
||||
|
||||
describe("Requests Tests", () => {
|
||||
it("Clicking Details on a Tv request, takes us to the correct detail page", () => {
|
||||
cy.intercept("POST", "request/tv").as("tvRequest");
|
||||
cy.intercept("token").as("login");
|
||||
cy.login();
|
||||
|
||||
cy.requestAllTv(60735); // The Flash
|
||||
|
||||
Page.visit();
|
||||
|
||||
Page.tvTab.click();
|
||||
const row = Page.tv.getGridRow(60735);
|
||||
row.detailsButton.click();
|
||||
|
||||
cy.location("pathname").should("contains", "/details/tv/60735");
|
||||
TvPage.title.contains("The Flash");
|
||||
});
|
||||
|
||||
it("Deleting TV requests, removes from grid", () => {
|
||||
cy.intercept("POST", "request/tv").as("tvRequest");
|
||||
cy.intercept("token").as("login");
|
||||
cy.intercept('DELETE', 'Request/tv/child/60735').as('deleteRequest');
|
||||
cy.login();
|
||||
|
||||
// cy.wait('@login');
|
||||
cy.requestAllTv(60735); // The Flash
|
||||
|
||||
Page.visit();
|
||||
|
||||
|
||||
Page.tvTab.click();
|
||||
const row = Page.tv.getGridRow(60735);
|
||||
row.optionsButton.click();
|
||||
row.optionsDelete.click();
|
||||
|
||||
cy.wait('@deleteRequest').then((intercept) => {
|
||||
expect(intercept.response.body).is.true;
|
||||
})
|
||||
|
||||
row.title.should('not.exist');
|
||||
});
|
||||
});
|
Loading…
Reference in new issue