refactoring some of the tests

This commit is contained in:
tidusjar 2021-03-10 16:49:23 +00:00
commit e4ab1447aa
14 changed files with 1702 additions and 65 deletions

View file

@ -0,0 +1,3 @@
export abstract class BasePage {
abstract visit(options: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
}

View file

@ -0,0 +1,37 @@
import { BasePage } from "../base.page";
class CarouselComponent {
private id: string;
get combinedButton(): Cypress.Chainable<any> {
return cy.get(`#${this.id}Combined-button`);
}
get movieButton(): Cypress.Chainable<any> {
return cy.get(`#${this.id}Movie-button`);
}
get tvButton(): Cypress.Chainable<any> {
return cy.get(`#${this.id}Tv-button`);
}
constructor(id: string) {
this.id = id;
}
}
class DiscoverPage extends BasePage {
popularCarousel = new CarouselComponent('popular');
constructor() {
super();
}
visit(options?: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow> {
return cy.visit(`/discover`, options);
}
}
export const discoverPage = new DiscoverPage();

View file

@ -0,0 +1,3 @@
export * from './discover/discover.page';
export * from './login/login.page';
export * from './wizard/wizard.page';

View file

@ -0,0 +1,30 @@
import { BasePage } from "../base.page";
class LoginPage extends BasePage {
get username(): Cypress.Chainable<any> {
return cy.get('#username-field');
}
get password(): Cypress.Chainable<any> {
return cy.get('#password-field');
}
get ombiSignInButton(): Cypress.Chainable<any> {
return cy.get('[data-cy=OmbiButton]');
}
get plexSignInButton(): Cypress.Chainable<any> {
return cy.get('[data-cy=oAuthPlexButton]');
}
constructor() {
super();
}
visit(options?: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow> {
return cy.visit(`/login`, options);
}
}
export const loginPage = new LoginPage();

View file

@ -0,0 +1,64 @@
import { BasePage } from "../base.page";
class LocalUserTab {
get username(): Cypress.Chainable<any> {
return cy.get('#adminUsername');
}
get password(): Cypress.Chainable<any> {
return cy.get('#adminPassword');
}
get next(): Cypress.Chainable<any> {
return cy.getByData('nextLocalUser');
}
}
class WelcomeTab {
get next(): Cypress.Chainable<any> {
return cy.getByData('nextWelcome');
}
}
class MediaServerTab {
get next(): Cypress.Chainable<any> {
return cy.getByData('nextMediaServer');
}
}
class OmbiConfigTab {
get next(): Cypress.Chainable<any> {
return cy.getByData('nextOmbiConfig');
}
}
class WizardPage extends BasePage {
localUserTab: LocalUserTab;
welcomeTab: WelcomeTab;
mediaServerTab: MediaServerTab;
ombiConfigTab: OmbiConfigTab;
get finishButton(): Cypress.Chainable<any> {
return cy.get('#finishWizard');
}
get matStepsHeader(): Cypress.Chainable<any> {
return cy.get('mat-step-header');
}
constructor() {
super();
this.localUserTab = new LocalUserTab();
this.welcomeTab = new WelcomeTab();
this.mediaServerTab = new MediaServerTab();
this.ombiConfigTab = new OmbiConfigTab();
}
visit(options?: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow> {
return cy.visit(`/`, options);
}
}
export const wizardPage = new WizardPage();