diff --git a/src/Ombi/ClientApp/src/app/media-details/components/shared/top-banner/top-banner.component.html b/src/Ombi/ClientApp/src/app/media-details/components/shared/top-banner/top-banner.component.html index 570db9b9c..55550160e 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/shared/top-banner/top-banner.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/shared/top-banner/top-banner.component.html @@ -9,7 +9,7 @@
-

{{title}} +

{{title}} ({{releaseDate | amLocal | amDateFormat: 'YYYY'}})

diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html index 9c71884e0..6c05ed837 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html +++ b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html @@ -5,20 +5,20 @@
- - - + + - - +
- + 10 15 30 @@ -31,14 +31,14 @@ - - + - + - + - + - + @@ -87,9 +87,9 @@ - - - + + \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.html b/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.html index be749cc28..399b35e16 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.html +++ b/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.html @@ -1,11 +1,11 @@ - + {{'Requests.RequestPanel.Delete' | translate}} - + {{'Requests.RequestPanel.Approve' | translate}} - + {{'Requests.RequestPanel.ChangeAvailability' | translate}} \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.html b/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.html index 49f4ae8c5..b9c256985 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.html +++ b/src/Ombi/ClientApp/src/app/requests-list/components/tv-grid/tv-grid.component.html @@ -5,20 +5,20 @@
- - - + + - - +
- + 10 15 30 @@ -33,24 +33,24 @@
- + - + - - - @@ -68,8 +68,8 @@ diff --git a/tests/cypress/integration/page-objects/details/tv/tvdetails.page.ts b/tests/cypress/integration/page-objects/details/tv/tvdetails.page.ts index 3b7c2c40d..b75e7fb45 100644 --- a/tests/cypress/integration/page-objects/details/tv/tvdetails.page.ts +++ b/tests/cypress/integration/page-objects/details/tv/tvdetails.page.ts @@ -1,5 +1,10 @@ import { BasePage } from "../../base.page"; +class BaseMediaPage extends BasePage { + get title(): Cypress.Chainable { + return cy.get('#mediaTitle'); + } +} class TvRequestPanel { seasonTab(seasonNumber: number): Cypress.Chainable { @@ -56,7 +61,7 @@ class TvDetailsInformationPanel { } } -class TvDetailsPage extends BasePage { +class TvDetailsPage extends BaseMediaPage { get availableButton(): Cypress.Chainable { diff --git a/tests/cypress/integration/page-objects/index.ts b/tests/cypress/integration/page-objects/index.ts index d4bf55488..79ba6635b 100644 --- a/tests/cypress/integration/page-objects/index.ts +++ b/tests/cypress/integration/page-objects/index.ts @@ -4,3 +4,4 @@ export * from './wizard/wizard.page'; export * from './details/tv/tvdetails.page'; export * from './search/search.page'; export * from './user-preferences/user-preferences.page'; +export * from './requests/requests.page'; diff --git a/tests/cypress/integration/page-objects/requests/requests.page.ts b/tests/cypress/integration/page-objects/requests/requests.page.ts new file mode 100644 index 000000000..4eddaaa9c --- /dev/null +++ b/tests/cypress/integration/page-objects/requests/requests.page.ts @@ -0,0 +1,132 @@ +import { BasePage } from "../base.page"; + +class MediaBaseTab { + get allRequestsButton(): Cypress.Chainable { + return cy.get('#filterAll'); + } + + get pendingRequestsButton(): Cypress.Chainable { + return cy.get('#filterPending'); + } + + get processingRequestsButton(): Cypress.Chainable { + return cy.get('#filterProcessing'); + } + + get availableRequestsButton(): Cypress.Chainable { + return cy.get('#filterAvailable'); + } + + get deniedRequestsButton(): Cypress.Chainable { + return cy.get('#filterDenied'); + } + + get requestsToDisplayDropdown(): Cypress.Chainable { + return cy.get('#requestsToDisplayDropdown'); + } + + getGridRow(requestId: number): GridRow { + return new GridRow(requestId); + } + +} + +class GridRow { + requestId: number; + get title(): Cypress.Chainable { + return cy.get(`#title${this.requestId}`); + } + + get requestedBy(): Cypress.Chainable { + return cy.get(`#requestedBy${this.requestId}`); + } + + get requestedDate(): Cypress.Chainable { + return cy.get(`#requestedDate${this.requestId}`); + } + + get requestedStatus(): Cypress.Chainable { + return cy.get(`#requestedStatus${this.requestId}`); + } + + get status(): Cypress.Chainable { + return cy.get(`#status${this.requestId}`); + } + + get detailsButton(): Cypress.Chainable { + return cy.get(`#detailsButton${this.requestId}`); + } + + get optionsButton(): Cypress.Chainable { + return cy.get(`#optionsButton${this.requestId}`); + } + + get optionsDelete(): Cypress.Chainable { + return cy.get(`#requestDelete`); + } + + get optionsApprove(): Cypress.Chainable { + return cy.get(`#requestApprove`); + } + + get optionsChangeAvailability(): Cypress.Chainable { + return cy.get(`#requestChangeAvailability`); + } + + constructor(requestId: number) { + this.requestId = requestId; + } +} + +class MoviesTab extends MediaBaseTab { + + get adminMasterCheckbox(): Cypress.Chainable { + return cy.get('#adminMasterCheckbox'); + } + + get bulkFabButton(): Cypress.Chainable { + return cy.get('#bulkFab'); + } + + get deleteFabButton(): Cypress.Chainable { + return cy.get('#deleteFabButton'); + } + + get approveFabButton(): Cypress.Chainable { + return cy.get('#approveFabButton'); + } +} + +class RequestsPage extends BasePage { + + get moviesTab(): Cypress.Chainable { + return cy.get('[role="tab"]').eq(0); + } + + get tvTab(): Cypress.Chainable { + return cy.get('[role="tab"]').eq(1); + } + + get musicTab(): Cypress.Chainable { + return cy.get('[role="tab"]').eq(2); + } + + movies = new MoviesTab(); + tv = new MediaBaseTab(); + music = new MediaBaseTab(); + + constructor() { + super(); + } + + visit(options: Cypress.VisitOptions): Cypress.Chainable; + visit(): Cypress.Chainable; + visit(id: string): Cypress.Chainable; + visit(id: string, options: Cypress.VisitOptions): Cypress.Chainable; + visit(id?: any, options?: any) { + return cy.visit(`/requests-list`, options); + } + +} + +export const requestPage = new RequestsPage(); diff --git a/tests/cypress/support/request.commands.ts b/tests/cypress/support/request.commands.ts index 4c936a4bc..1d48d6f05 100644 --- a/tests/cypress/support/request.commands.ts +++ b/tests/cypress/support/request.commands.ts @@ -26,11 +26,11 @@ Cypress.Commands.add('requestMovie', (movieId) => { }) Cypress.Commands.add('requestAllTv', (tvId) => { - cy.request({ + return cy.request({ method: 'POST', - url: '/api/v1/request/tv', + url: '/api/v2/requests/tv', body: { - TvDbId: tvId, + TheMovieDbId: tvId, RequestAll: true }, headers: { diff --git a/tests/cypress/tests/requests/requests.spec.ts b/tests/cypress/tests/requests/requests.spec.ts new file mode 100644 index 000000000..23c5ccb09 --- /dev/null +++ b/tests/cypress/tests/requests/requests.spec.ts @@ -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'); + }); +});
- + - @@ -47,36 +47,36 @@ {{ 'Requests.RequestsTitle' | translate}} {{element.title}} ({{element.releaseDate | amLocal | amDateFormat: 'YYYY'}}) {{element.title}} ({{element.releaseDate | amLocal | amDateFormat: 'YYYY'}}) {{'Requests.RequestedBy' | translate}} {{element.requestedUser?.userAlias}} {{element.requestedUser?.userAlias}} {{ 'Requests.RequestDate' | translate}} {{element.requestedDate | amLocal | amDateFormat: 'LL'}} {{element.requestedDate | amLocal | amDateFormat: 'LL'}} {{ 'Requests.Status' | translate}} {{element.status}} {{element.status}} {{ 'Requests.RequestStatus' | translate}} {{element.requestStatus | translate}} {{element.requestStatus | translate}} - - + + {{'Requests.RequestsTitle' | translate}} {{element.parentRequest.title}} {{element.parentRequest.title}} {{'Requests.RequestedBy' | translate}} {{element.requestedUser.userAlias}} {{element.requestedUser.userAlias}} {{'Requests.RequestDate' | translate}} + {{element.requestedDate | amLocal | amDateFormat: 'LL'}} {{'Requests.RequestStatus' | translate}} +
{{'Common.ProcessingRequest' | translate}}
{{'Common.PendingApproval' |translate}}
{{'Common.Available' | translate}}
@@ -60,7 +60,7 @@
{{'Requests.Status' | translate}} + {{element.parentRequest.status}} - - + +