mirror of https://github.com/Ombi-app/Ombi
perf: ⚡ Improve render performance on the discover, movie and tv pages (#5084)
* perf(details): ⚡ Improve load performance for the TV and Movie Details pages * perf(discover): ⚡ Improve load performance on the discover page * fixed tests * Fixed the dates * test * fixsnyk-upgrade-8fa6c2fd243bfece84b068e85447095d
parent
5cbb2ca528
commit
71c86a8db9
@ -0,0 +1,17 @@
|
|||||||
|
import { Pipe, PipeTransform } from "@angular/core";
|
||||||
|
import { FormatPipe } from 'ngx-date-fns';
|
||||||
|
|
||||||
|
@Pipe({
|
||||||
|
name: "ombiDate",
|
||||||
|
})
|
||||||
|
export class OmbiDatePipe implements PipeTransform {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private FormatPipe: FormatPipe,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public transform(value: string, format: string ) {
|
||||||
|
const date = new Date(value);
|
||||||
|
return this.FormatPipe.transform(date, format);
|
||||||
|
}
|
||||||
|
}
|
@ -1,163 +1,162 @@
|
|||||||
import { movieDetailsPage as Page } from "@/integration/page-objects";
|
import { movieDetailsPage as Page } from '@/integration/page-objects';
|
||||||
|
|
||||||
describe("Movie Details Buttons", () => {
|
describe('Movie Details Buttons', () => {
|
||||||
it("Movie Requested by Admin should be auto approved", () => {
|
it('Movie Requested by Admin should be auto approved', () => {
|
||||||
cy.login();
|
cy.login();
|
||||||
|
|
||||||
Page.visit("587807");
|
Page.visit('587807');
|
||||||
Page.requestButton.click();
|
Page.requestButton.click();
|
||||||
Page.adminOptionsDialog.isOpen();
|
Page.adminOptionsDialog.isOpen();
|
||||||
|
|
||||||
Page.adminOptionsDialog.requestButton.click();
|
Page.adminOptionsDialog.requestButton.click();
|
||||||
|
|
||||||
cy.verifyNotification("Request for Tom & Jerry has been added successfully");
|
cy.verifyNotification('Request for Tom & Jerry has been added successfully');
|
||||||
|
|
||||||
Page.requestedButton.should("be.visible");
|
Page.requestedButton.should('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Movie Requested by Regular user should be pending", () => {
|
it('Movie Requested by Regular user should be pending', () => {
|
||||||
cy.generateUniqueId().then((id) => {
|
cy.generateUniqueId().then((id) => {
|
||||||
cy.login();
|
cy.login();
|
||||||
const roles = [];
|
const roles = [];
|
||||||
roles.push({ value: "RequestMovie", enabled: true });
|
roles.push({ value: 'RequestMovie', enabled: true });
|
||||||
cy.createUser(id, "a", roles).then(() => {
|
cy.createUser(id, 'a', roles).then(() => {
|
||||||
cy.loginWithCreds(id, "a");
|
cy.loginWithCreds(id, 'a');
|
||||||
|
|
||||||
Page.visit("651571");
|
Page.visit('651571');
|
||||||
|
|
||||||
Page.requestButton.click();
|
Page.requestButton.click();
|
||||||
cy.verifyNotification("Request for Breach has been added successfully");
|
cy.verifyNotification('Request for Breach has been added successfully');
|
||||||
|
|
||||||
Page.requestedButton.should("be.visible");
|
Page.requestedButton.should('be.visible');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Movie Requested by Regular with no movie permission", () => {
|
it('Movie Requested by Regular with no movie permission', () => {
|
||||||
cy.generateUniqueId().then((id) => {
|
cy.generateUniqueId().then((id) => {
|
||||||
cy.login();
|
cy.login();
|
||||||
const roles = [];
|
const roles = [];
|
||||||
roles.push({ value: "RequestTv", enabled: true });
|
roles.push({ value: 'RequestTv', enabled: true });
|
||||||
cy.createUser(id, "a", roles).then(() => {
|
cy.createUser(id, 'a', roles).then(() => {
|
||||||
cy.loginWithCreds(id, "a");
|
cy.loginWithCreds(id, 'a');
|
||||||
|
|
||||||
Page.visit("791373");
|
Page.visit('791373');
|
||||||
|
|
||||||
Page.requestButton.click();
|
Page.requestButton.click();
|
||||||
cy.verifyNotification("You do not have permissions to Request a Movie");
|
cy.verifyNotification('You do not have permissions to Request a Movie');
|
||||||
|
|
||||||
Page.requestedButton.should("not.exist");
|
Page.requestedButton.should('not.exist');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Movie Requested by Regular can be approved by admin", () => {
|
it('Movie Requested by Regular can be approved by admin', () => {
|
||||||
cy.generateUniqueId().then((id) => {
|
cy.generateUniqueId().then((id) => {
|
||||||
cy.login();
|
cy.login();
|
||||||
const roles = [];
|
const roles = [];
|
||||||
roles.push({ value: "RequestMovie", enabled: true });
|
roles.push({ value: 'RequestMovie', enabled: true });
|
||||||
cy.createUser(id, "a", roles).then(() => {
|
cy.createUser(id, 'a', roles).then(() => {
|
||||||
cy.loginWithCreds(id, "a");
|
cy.loginWithCreds(id, 'a');
|
||||||
|
|
||||||
Page.visit("793723");
|
Page.visit('793723');
|
||||||
|
|
||||||
Page.requestButton.click();
|
Page.requestButton.click();
|
||||||
cy.verifyNotification("Request for Sentinelle has been added successfully");
|
cy.verifyNotification('Request for Sentinelle has been added successfully');
|
||||||
|
|
||||||
Page.requestedButton.should("be.visible");
|
Page.requestedButton.should('be.visible');
|
||||||
|
|
||||||
// Login as admin now
|
// Login as admin now
|
||||||
cy.removeLogin();
|
cy.removeLogin();
|
||||||
cy.login();
|
cy.login();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
|
|
||||||
Page.visit("793723");
|
cy.intercept('GET', '**/Request/movie/info/**').as('requestCall');
|
||||||
|
|
||||||
Page.approveButton.should("exist");
|
Page.visit('793723');
|
||||||
Page.approveButton.click();
|
|
||||||
|
|
||||||
cy.verifyNotification("Successfully Approved");
|
cy.wait('@requestCall').then((__) => {
|
||||||
});
|
Page.approveButton.should('exist');
|
||||||
});
|
Page.approveButton.click();
|
||||||
});
|
|
||||||
|
|
||||||
it("Movie Requested, mark as available", () => {
|
cy.verifyNotification('Successfully Approved');
|
||||||
cy.login();
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Page.visit("12444");
|
it('Movie Requested, mark as available', () => {
|
||||||
|
cy.login();
|
||||||
|
|
||||||
Page.requestButton.click();
|
Page.visit('12444');
|
||||||
Page.adminOptionsDialog.isOpen();
|
|
||||||
Page.adminOptionsDialog.requestButton.click();
|
|
||||||
cy.verifyNotification(
|
|
||||||
"Request for Harry Potter and the Deathly Hallows: Part 1 has been added successfully"
|
|
||||||
);
|
|
||||||
|
|
||||||
cy.reload();
|
Page.requestButton.click();
|
||||||
|
Page.adminOptionsDialog.isOpen();
|
||||||
|
Page.adminOptionsDialog.requestButton.click();
|
||||||
|
cy.verifyNotification('Request for Harry Potter and the Deathly Hallows: Part 1 has been added successfully');
|
||||||
|
|
||||||
Page.markAvailableButton.should("exist");
|
cy.intercept('GET', '**/Images/banner/movie/**').as('bannerLoad');
|
||||||
Page.markAvailableButton.click();
|
cy.reload();
|
||||||
|
|
||||||
cy.waitUntil(() => {
|
cy.wait('@bannerLoad').then((__) => {
|
||||||
return Page.availableButton.should("be.visible");
|
Page.markAvailableButton.should('exist');
|
||||||
})
|
Page.markAvailableButton.click();
|
||||||
|
|
||||||
cy.verifyNotification("Request is now available");
|
cy.verifyNotification('Request is now available');
|
||||||
Page.availableButton.should("exist");
|
Page.availableButton.should('exist');
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it.skip("Movie Requested, Deny Movie", () => {
|
it.skip('Movie Requested, Deny Movie', () => {
|
||||||
cy.login();
|
cy.login();
|
||||||
|
|
||||||
Page.visit("671");
|
Page.visit('671');
|
||||||
|
|
||||||
Page.requestButton.click();
|
Page.requestButton.click();
|
||||||
Page.adminOptionsDialog.isOpen();
|
Page.adminOptionsDialog.isOpen();
|
||||||
Page.adminOptionsDialog.requestButton.click();
|
Page.adminOptionsDialog.requestButton.click();
|
||||||
cy.verifyNotification(
|
cy.verifyNotification("Request for Harry Potter and the Philosopher's Stone has been added successfully");
|
||||||
"Request for Harry Potter and the Philosopher's Stone has been added successfully"
|
|
||||||
);
|
|
||||||
|
|
||||||
cy.reload();
|
cy.reload();
|
||||||
|
|
||||||
Page.denyButton.should("exist");
|
Page.denyButton.should('exist');
|
||||||
Page.denyButton.click();
|
Page.denyButton.click();
|
||||||
|
|
||||||
Page.denyModal.denyReason.type("Automation Tests");
|
Page.denyModal.denyReason.type('Automation Tests');
|
||||||
cy.wait(500);
|
cy.wait(500);
|
||||||
Page.denyModal.denyButton.click();
|
Page.denyModal.denyButton.click();
|
||||||
|
|
||||||
Page.deniedButton.should('exist');
|
Page.deniedButton.should('exist');
|
||||||
|
|
||||||
cy.verifyNotification("Denied Request");
|
cy.verifyNotification('Denied Request');
|
||||||
|
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
Page.informationPanel.denyReason.should('have.text', "Automation Tests");
|
Page.informationPanel.denyReason.should('have.text', 'Automation Tests');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Movie View Collection should be available", () => {
|
it('Movie View Collection should be available', () => {
|
||||||
cy.login();
|
cy.login();
|
||||||
|
|
||||||
Page.visit("671");
|
Page.visit('671');
|
||||||
|
|
||||||
Page.viewCollectionButton.should('be.visible');
|
Page.viewCollectionButton.should('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Non requested movie valid buttons", () => {
|
it('Non requested movie valid buttons', () => {
|
||||||
cy.login();
|
cy.login();
|
||||||
|
|
||||||
Page.visit("590706");
|
Page.visit('590706');
|
||||||
|
|
||||||
Page.viewCollectionButton.should('not.exist');
|
Page.viewCollectionButton.should('not.exist');
|
||||||
Page.approveButton.should('not.exist');
|
Page.approveButton.should('not.exist');
|
||||||
Page.denyButton.should('not.exist');
|
Page.denyButton.should('not.exist');
|
||||||
Page.deniedButton.should('not.exist');
|
Page.deniedButton.should('not.exist');
|
||||||
Page.markAvailableButton.should('not.exist');
|
Page.markAvailableButton.should('not.exist');
|
||||||
Page.viewOnEmbyButton.should('not.exist');
|
Page.viewOnEmbyButton.should('not.exist');
|
||||||
Page.viewOnJellyfinButton.should('not.exist');
|
Page.viewOnJellyfinButton.should('not.exist');
|
||||||
Page.viewOnPlexButton.should('not.exist');
|
Page.viewOnPlexButton.should('not.exist');
|
||||||
Page.requestedButton.should('not.exist');
|
Page.requestedButton.should('not.exist');
|
||||||
Page.reportIssueButton.should('not.exist'); // Issuess not enabled
|
Page.reportIssueButton.should('not.exist'); // Issuess not enabled
|
||||||
Page.requestButton.should('exist');
|
Page.requestButton.should('exist');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in new issue