mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
feat: ✨ Recently Requested on Discover Page (#4387)
This commit is contained in:
parent
26ac75f0c2
commit
44d38fbaae
46 changed files with 3785 additions and 3567 deletions
|
@ -26,8 +26,35 @@ class CarouselComponent {
|
|||
}
|
||||
}
|
||||
|
||||
class RecentlyRequestedComponent {
|
||||
getRequest(id: string): DetailedCard {
|
||||
return new DetailedCard(id);
|
||||
}
|
||||
}
|
||||
|
||||
class DetailedCard {
|
||||
private id: string;
|
||||
|
||||
get title(): Cypress.Chainable<any> {
|
||||
return cy.get(`#detailed-request-title-${this.id}`);
|
||||
}
|
||||
|
||||
get status(): Cypress.Chainable<any> {
|
||||
return cy.get(`#detailed-request-status-${this.id}`);
|
||||
}
|
||||
|
||||
verifyTitle(expected: string): Cypress.Chainable<any> {
|
||||
return this.title.should('have.text',expected);
|
||||
}
|
||||
|
||||
constructor(id: string) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
class DiscoverPage extends BasePage {
|
||||
popularCarousel = new CarouselComponent("popular");
|
||||
recentlyRequested = new RecentlyRequestedComponent();
|
||||
adminOptionsDialog = new AdminRequestDialog();
|
||||
|
||||
constructor() {
|
||||
|
|
164
tests/cypress/tests/discover/discover-recently-requested.spec.ts
Normal file
164
tests/cypress/tests/discover/discover-recently-requested.spec.ts
Normal file
|
@ -0,0 +1,164 @@
|
|||
|
||||
import { discoverPage as Page } from "@/integration/page-objects";
|
||||
|
||||
describe("Discover Recently Requested Tests", () => {
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
});
|
||||
|
||||
it("Requested Movie Is Displayed", () => {
|
||||
|
||||
cy.requestMovie(315635);
|
||||
cy.intercept("GET", "**/v2/Requests/recentlyRequested").as("response");
|
||||
|
||||
Page.visit();
|
||||
|
||||
cy.wait("@response").then((_) => {
|
||||
|
||||
const card = Page.recentlyRequested.getRequest("315635");
|
||||
card.verifyTitle("Spider-Man: Homecoming");
|
||||
card.status.should('contain.text', 'Approved');
|
||||
});
|
||||
});
|
||||
|
||||
it("Requested Movie Is Pending Approval", () => {
|
||||
|
||||
cy.requestMovie(626735);
|
||||
|
||||
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");
|
||||
|
||||
Page.visit();
|
||||
|
||||
cy.wait("@response").then((_) => {
|
||||
|
||||
const card = Page.recentlyRequested.getRequest("626735");
|
||||
card.verifyTitle("Dog");
|
||||
card.status.should('contain.text', 'Pending');
|
||||
});
|
||||
});
|
||||
|
||||
it("Requested Movie Is Available", () => {
|
||||
|
||||
cy.requestMovie(675353);
|
||||
|
||||
cy.intercept("GET", "**/v2/Requests/recentlyRequested", (req) => {
|
||||
req.reply((res) => {
|
||||
const body = res.body;
|
||||
const movie = body[0];
|
||||
movie.available = true;
|
||||
|
||||
body[0] = movie;
|
||||
res.send(body);
|
||||
});
|
||||
}).as("response");
|
||||
|
||||
Page.visit();
|
||||
|
||||
cy.wait("@response").then((_) => {
|
||||
|
||||
const card = Page.recentlyRequested.getRequest("675353");
|
||||
card.verifyTitle("Sonic the Hedgehog 2");
|
||||
card.status.should('contain.text', 'Available'); // Because admin auto request
|
||||
});
|
||||
});
|
||||
|
||||
it("Requested TV Is Available", () => {
|
||||
|
||||
cy.requestAllTv(135647);
|
||||
|
||||
cy.intercept("GET", "**/v2/Requests/recentlyRequested", (req) => {
|
||||
req.reply((res) => {
|
||||
const body = res.body;
|
||||
const tv = body[0];
|
||||
tv.available = true;
|
||||
|
||||
body[0] = tv;
|
||||
res.send(body);
|
||||
});
|
||||
}).as("response");
|
||||
|
||||
Page.visit();
|
||||
|
||||
cy.wait("@response").then((_) => {
|
||||
|
||||
const card = Page.recentlyRequested.getRequest("135647");
|
||||
card.verifyTitle("2 Good 2 Be True");
|
||||
card.status.should('contain.text', 'Available');
|
||||
});
|
||||
});
|
||||
|
||||
it("Requested TV Is Partially Available", () => {
|
||||
|
||||
cy.requestAllTv(158415);
|
||||
|
||||
cy.intercept("GET", "**/v2/Requests/recentlyRequested", (req) => {
|
||||
req.reply((res) => {
|
||||
const body = res.body;
|
||||
const tv = body[0];
|
||||
tv.tvPartiallyAvailable = true;
|
||||
|
||||
body[0] = tv;
|
||||
res.send(body);
|
||||
});
|
||||
}).as("response");
|
||||
|
||||
Page.visit();
|
||||
|
||||
cy.wait("@response").then((_) => {
|
||||
|
||||
const card = Page.recentlyRequested.getRequest("158415");
|
||||
card.verifyTitle("Pantanal");
|
||||
card.status.should('contain.text', 'Partially Available');
|
||||
});
|
||||
});
|
||||
|
||||
it("Requested TV Is Pending", () => {
|
||||
cy.requestAllTv(60574);
|
||||
|
||||
cy.intercept("GET", "**/v2/Requests/recentlyRequested", (req) => {
|
||||
req.reply((res) => {
|
||||
const body = res.body;
|
||||
const tv = body[0];
|
||||
tv.approved = false;
|
||||
|
||||
body[0] = tv;
|
||||
res.send(body);
|
||||
});
|
||||
}).as("response");
|
||||
|
||||
Page.visit();
|
||||
|
||||
cy.wait("@response").then((_) => {
|
||||
|
||||
const card = Page.recentlyRequested.getRequest("60574");
|
||||
card.verifyTitle("Peaky Blinders");
|
||||
card.status.should('contain.text', 'Pending');
|
||||
});
|
||||
});
|
||||
|
||||
it("Requested TV Is Displayed", () => {
|
||||
|
||||
cy.requestAllTv(66732);
|
||||
cy.intercept("GET", "**/v2/Requests/recentlyRequested").as("response");
|
||||
|
||||
Page.visit();
|
||||
|
||||
cy.wait("@response").then((_) => {
|
||||
|
||||
const card = Page.recentlyRequested.getRequest("66732");
|
||||
card.verifyTitle("Stranger Things");
|
||||
card.status.should('contain.text', 'Approved'); // Because admin auto request
|
||||
});
|
||||
});
|
||||
|
||||
});
|
|
@ -12,8 +12,8 @@ const langs = [
|
|||
];
|
||||
|
||||
langs.forEach((l) => {
|
||||
it(`Change language to ${l.code}, UI should update`, () => {
|
||||
cy.intercept('POST','/language').as('langSave');
|
||||
it.only(`Change language to ${l.code}, UI should update`, () => {
|
||||
cy.intercept('POST','**/language').as('langSave');
|
||||
Page.visit();
|
||||
|
||||
Page.profile.languageSelectBox.click();
|
||||
|
|
|
@ -28,7 +28,7 @@ describe('User Management Page', () => {
|
|||
// Setup the form
|
||||
cy.get('#username').type(username);
|
||||
cy.get('#alias').type("alias1");
|
||||
cy.get('#emailAddress').type(username + "@emailaddress.com");
|
||||
cy.get('#emailAddress').type(username + "@emailaddress.com", { force: true });
|
||||
cy.get('#password').type("password");
|
||||
cy.get('#confirmPass').type("password");
|
||||
|
||||
|
@ -54,7 +54,7 @@ describe('User Management Page', () => {
|
|||
// Setup the form
|
||||
cy.get('#username').type("user1");
|
||||
cy.get('#alias').type("alias1");
|
||||
cy.get('#emailAddress').type("user1@emailaddress.com");
|
||||
cy.get('#emailAddress').type("user1@emailaddress.com", { force: true });
|
||||
cy.get('#password').type("password");
|
||||
cy.get('#confirmPass').type("password");
|
||||
|
||||
|
@ -72,7 +72,7 @@ describe('User Management Page', () => {
|
|||
// Setup the form
|
||||
cy.get('#username').type("user1");
|
||||
cy.get('#alias').type("alias1");
|
||||
cy.get('#emailAddress').type("user1@emailaddress.com");
|
||||
cy.get('#emailAddress').type("user1@emailaddress.com", { force: true });
|
||||
cy.get('#password').type("password");
|
||||
cy.get('#confirmPass').type("pass22word");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue