diff --git a/src/Ombi/ClientApp/src/app/components/detailed-card/detailed-card.component.html b/src/Ombi/ClientApp/src/app/components/detailed-card/detailed-card.component.html index bba8c37ff..454874490 100644 --- a/src/Ombi/ClientApp/src/app/components/detailed-card/detailed-card.component.html +++ b/src/Ombi/ClientApp/src/app/components/detailed-card/detailed-card.component.html @@ -22,7 +22,7 @@
- +
diff --git a/tests/cypress.json b/tests/cypress.json index b1042c4fc..67fd65364 100644 --- a/tests/cypress.json +++ b/tests/cypress.json @@ -1,7 +1,7 @@ { "$schema": "https://on.cypress.io/cypress.schema.json", "supportFile": "cypress/support/index.ts", - "baseUrl": "http://localhost:5000", + "baseUrl": "http://localhost:3577", "integrationFolder": "cypress/tests", "testFiles": "**/*.spec.ts*", "watchForFileChanges": true, diff --git a/tests/cypress/integration/page-objects/discover/discover.page.ts b/tests/cypress/integration/page-objects/discover/discover.page.ts index ef15f0d29..3f1456817 100644 --- a/tests/cypress/integration/page-objects/discover/discover.page.ts +++ b/tests/cypress/integration/page-objects/discover/discover.page.ts @@ -43,9 +43,13 @@ class DetailedCard { return cy.get(`#detailed-request-status-${this.id}`); } + get approveButton(): Cypress.Chainable { + return cy.get(`#detailed-request-approve-${this.id}`); + } + verifyTitle(expected: string): Cypress.Chainable { return this.title.should('have.text',expected); -} + } constructor(id: string) { this.id = id; diff --git a/tests/cypress/tests/discover/discover-recently-requested.spec.ts b/tests/cypress/tests/discover/discover-recently-requested.spec.ts index 9eff61475..b8bceb088 100644 --- a/tests/cypress/tests/discover/discover-recently-requested.spec.ts +++ b/tests/cypress/tests/discover/discover-recently-requested.spec.ts @@ -44,6 +44,7 @@ describe("Discover Recently Requested Tests", () => { const card = Page.recentlyRequested.getRequest("626735"); card.verifyTitle("Dog"); card.status.should('contain.text', 'Pending'); + card.approveButton.should('be.visible'); }); }); @@ -69,6 +70,7 @@ describe("Discover Recently Requested Tests", () => { const card = Page.recentlyRequested.getRequest("675353"); card.verifyTitle("Sonic the Hedgehog 2"); card.status.should('contain.text', 'Available'); // Because admin auto request + card.approveButton.should('not.exist'); }); }); @@ -94,6 +96,7 @@ describe("Discover Recently Requested Tests", () => { const card = Page.recentlyRequested.getRequest("135647"); card.verifyTitle("2 Good 2 Be True"); card.status.should('contain.text', 'Available'); + card.approveButton.should('not.exist'); }); }); @@ -119,6 +122,7 @@ describe("Discover Recently Requested Tests", () => { const card = Page.recentlyRequested.getRequest("158415"); card.verifyTitle("Pantanal"); card.status.should('contain.text', 'Partially Available'); + card.approveButton.should('not.exist'); }); }); @@ -143,6 +147,7 @@ describe("Discover Recently Requested Tests", () => { const card = Page.recentlyRequested.getRequest("60574"); card.verifyTitle("Peaky Blinders"); card.status.should('contain.text', 'Pending'); + card.approveButton.should('be.visible'); }); }); @@ -161,4 +166,70 @@ describe("Discover Recently Requested Tests", () => { }); }); + it("Approve Requested Movie", () => { + + cy.requestMovie(55341); + + cy.intercept("GET", "**/v2/Requests/recentlyRequested", (req) => { + req.reply((res) => { + const body = res.body; + const movie = body[0]; + movie.available = false; + movie.approved = false; + + body[0] = movie; + res.send(body); + }); + }).as("response"); + + cy.intercept("POST", "**/v1/Request/Movie/Approve").as("approveCall"); + + Page.visit(); + + cy.wait("@response").then((_) => { + + const card = Page.recentlyRequested.getRequest("55341"); + card.approveButton.should('be.visible'); + card.approveButton.click(); + + cy.wait("@approveCall").then((_) => { + card.status.should('contain.text', 'Approved'); + }); + + }); + }); + + it.only("Approve Requested Tv Show", () => { + + cy.requestAllTv(71712); + + cy.intercept("GET", "**/v2/Requests/recentlyRequested", (req) => { + req.reply((res) => { + const body = res.body; + const movie = body[0]; + movie.available = false; + movie.approved = false; + + body[0] = movie; + res.send(body); + }); + }).as("response"); + + cy.intercept("POST", "**/v1/Request/tv/approve").as("approveCall"); + + Page.visit(); + + cy.wait("@response").then((_) => { + + const card = Page.recentlyRequested.getRequest("71712"); + card.approveButton.should('be.visible'); + card.approveButton.click(); + + cy.wait("@approveCall").then((_) => { + card.status.should('contain.text', 'Approved'); + }); + + }); + }); + });