mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 10:36:54 -07:00
refactoring some of the tests
This commit is contained in:
parent
43e22acaca
commit
e4ab1447aa
14 changed files with 1702 additions and 65 deletions
3
tests/cypress/integration/page-objects/base.page.ts
Normal file
3
tests/cypress/integration/page-objects/base.page.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export abstract class BasePage {
|
||||
abstract visit(options: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
|
||||
}
|
|
@ -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();
|
3
tests/cypress/integration/page-objects/index.ts
Normal file
3
tests/cypress/integration/page-objects/index.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export * from './discover/discover.page';
|
||||
export * from './login/login.page';
|
||||
export * from './wizard/wizard.page';
|
30
tests/cypress/integration/page-objects/login/login.page.ts
Normal file
30
tests/cypress/integration/page-objects/login/login.page.ts
Normal 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();
|
64
tests/cypress/integration/page-objects/wizard/wizard.page.ts
Normal file
64
tests/cypress/integration/page-objects/wizard/wizard.page.ts
Normal 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();
|
Loading…
Add table
Add a link
Reference in a new issue