feat: Recently requested improvements (#4755)

* feat(discover):  Admins can now approve the Recently Requested list

* feat(discover):  Images for the recently requested area are now loading faster and just better all around

* test:  Added automation for the new feature
This commit is contained in:
Jamie 2022-09-14 20:39:48 +01:00 committed by GitHub
commit ff04d87534
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 292 additions and 95 deletions

View file

@ -43,9 +43,13 @@ class DetailedCard {
return cy.get(`#detailed-request-status-${this.id}`);
}
get approveButton(): Cypress.Chainable<any> {
return cy.get(`#detailed-request-approve-${this.id}`);
}
verifyTitle(expected: string): Cypress.Chainable<any> {
return this.title.should('have.text',expected);
}
}
constructor(id: string) {
this.id = id;

View file

@ -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');
});
});
});
});