reworked some of the pages

pull/4099/head
tidusjar 4 years ago
parent fee862baa7
commit cb271cdc85

@ -6,7 +6,7 @@ on:
pull_request:
branches: [ feature/ui-automation ]
schedule:
- cron: '*/20 * * * *'
- cron: '0 0 * * *'
jobs:
automation-tests:

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

@ -0,0 +1,93 @@
import { BasePage } from "../../base.page";
class TvRequestPanel {
seasonTab(seasonNumber: number): Cypress.Chainable<any> {
return cy.getByData("classStatus"+seasonNumber);
}
getSeasonMasterCheckbox(seasonNumber: number): Cypress.Chainable<any> {
return cy.getByData("masterCheckbox"+seasonNumber);
}
getEpisodeSeasonCheckbox(seasonNumber: number, episodeNumber?: number): Cypress.Chainable<any> {
return cy.getByData("episodeCheckbox"+seasonNumber+episodeNumber);
}
getEpisodeCheckbox(seasonNumber: number): Cypress.Chainable<any> {
return cy.getByDataLike("episodeCheckbox"+seasonNumber);
}
getEpisodeStatus(seasonNumber: number, episodeNumber?: number): Cypress.Chainable<any> {
if (episodeNumber) {
return cy.getByData('episodeStatus'+seasonNumber+episodeNumber);
}
return cy.getByDataLike('episodeStatus'+seasonNumber);
}
}
class RequestFabButton {
get requestSelected(): Cypress.Chainable<any> {
return cy.get('#requestSelected');
}
get requestLatest(): Cypress.Chainable<any> {
return cy.get('#requestLatest');
}
get requestFirst(): Cypress.Chainable<any> {
return cy.get('#requestFirst');
}
get fab(): Cypress.Chainable<any> {
return cy.get('#addFabBtn');
}
}
class TvDetailsInformationPanel {
get status(): Cypress.Chainable<any> {
return cy.get('#status');
}
getStreaming(streamName: string): Cypress.Chainable<any> {
return cy.get(`#stream${streamName}`);
}
}
class TvDetailsPage extends BasePage {
get availableButton(): Cypress.Chainable<any> {
return cy.get('#availableBtn');
}
get requestButton(): Cypress.Chainable<any> {
return cy.get('#requestBtn');
}
get partiallyAvailableButton(): Cypress.Chainable<any> {
return cy.get('#partiallyAvailableBtn');
}
get reportIssueButton(): Cypress.Chainable<any> {
return cy.get('#reportIssueBtn');
}
informationPanel = new TvDetailsInformationPanel();
requestFabButton = new RequestFabButton();
requestPanel = new TvRequestPanel();
constructor() {
super();
}
visit(options?: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
visit(id: string, options?: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
visit(id: any, options?: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow> {
return cy.visit(`/details/tv/` + id, options);
}
}
export const tvDetailsPage = new TvDetailsPage();

@ -1,3 +1,4 @@
export * from './discover/discover.page';
export * from './login/login.page';
export * from './wizard/wizard.page';
export * from './details/tv/tvdetails.page';

@ -1,3 +1,5 @@
import { tvDetailsPage as Page } from "@/integration/page-objects";
describe("TV Details Buttons", () => {
beforeEach(() => {
cy.login();
@ -14,13 +16,13 @@ describe("TV Details Buttons", () => {
});
}).as("detailsResponse");
cy.visit("/details/tv/121361");
Page.visit("121361");
cy.wait('@detailsResponse');
cy.get('#availableBtn').should('be.visible');
cy.get('#requestBtn').should('not.exist');
cy.get('#addFabBtn').should('not.exist');
Page.availableButton.should('be.visible');
Page.requestButton.should('not.exist');
Page.requestFabButton.fab.should('not.exist');
});
it("Partially Available Request", () => {
@ -34,14 +36,14 @@ describe("TV Details Buttons", () => {
});
}).as("detailsResponse");
cy.visit("/details/tv/121361");
Page.visit("121361");
cy.wait('@detailsResponse');
cy.get('#availableBtn').should('not.exist');
cy.get('#requestBtn').should('be.visible');
cy.get('#addFabBtn').should('be.visible');
cy.get('#partiallyAvailableBtn').should('be.visible');
Page.availableButton.should('not.exist');
Page.requestButton.should('be.visible');
Page.requestFabButton.fab.should('be.visible');
Page.partiallyAvailableButton.should('be.visible');
});
it("Not Available Request", () => {
@ -55,13 +57,13 @@ describe("TV Details Buttons", () => {
});
}).as("detailsResponse");
cy.visit("/details/tv/121361");
Page.visit("121361");
cy.wait('@detailsResponse');
cy.get('#availableBtn').should('not.exist');
cy.get('#requestBtn').should('be.visible');
cy.get('#addFabBtn').should('be.visible');
cy.get('#partiallyAvailableBtn').should('not.exist');
Page.availableButton.should('not.exist');
Page.requestButton.should('be.visible');
Page.requestFabButton.fab.should('be.visible');
Page.partiallyAvailableButton.should('not.exist');
});
@ -70,14 +72,14 @@ describe("TV Details Buttons", () => {
cy.visit("/details/tv/121361");
cy.get('#reportIssueBtn').should('be.visible');
Page.reportIssueButton.should('be.visible');
});
it("Issues Disabled", () => {
cy.intercept("GET", "Settings/issuesenabled", 'false');
cy.visit("/details/tv/121361");
Page.visit("121361");
cy.get('#reportIssueBtn').should('not.exist');
Page.reportIssueButton.should('not.exist');
});
});

@ -1,29 +1,31 @@
import { tvDetailsPage as Page } from "@/integration/page-objects";
describe('TV Details Information Panel',() => {
beforeEach(() => {
cy.login();
});
it('Status should be ended',() => {
cy.visit('/details/tv/121361');
cy.get('#status').contains("Ended")
Page.visit('121361');
Page.informationPanel.status.contains("Ended")
});
it('Streaming Data should display',() => {
cy.intercept("GET", "**/search/stream/tv/**", { fixture: 'details/tv/streamingResponse'}).as("streamingResponse");
cy.visit('/details/tv/121361');
Page.visit('121361');
cy.wait('@streamingResponse')
cy.get('#streamSuper1').should('be.visible');
cy.get('#streamJamiesNetwork').should('be.visible');
Page.informationPanel.getStreaming('Super1').should('be.visible');
Page.informationPanel.getStreaming('JamiesNetwork').should('be.visible');
});
it.only('Streaming Data should be in correct order',() => {
it('Streaming Data should be in correct order',() => {
cy.intercept("GET", "**/search/stream/tv/**", { fixture: 'details/tv/streamingResponse'}).as("streamingResponse");
cy.visit('/details/tv/121361');
Page.visit('121361');
cy.wait('@streamingResponse')
cy.get('.stream-small').then((items) => {

@ -1,17 +1,20 @@
import { tvDetailsPage as Page } from "@/integration/page-objects";
describe("TV Requests Grid", function () {
beforeEach(() => {
cy.login();
});
it("Season not available", () => {
cy.visit("/details/tv/121361");
Page.visit('121361');
cy.getByData("classStatus1").should("not.have.class", "available");
cy.getByData("classStatus1").should("not.have.class", "requested");
cy.getByData("classStatus1").should("not.have.class", "approved");
Page.requestPanel.seasonTab(1)
.should("not.have.class", "available")
.should("not.have.class", "requested")
.should("not.have.class", "approved");
cy.getByData("masterCheckbox1").should("be.visible");
cy.getByDataLike("episodeCheckbox1").each((element) => {
Page.requestPanel.getSeasonMasterCheckbox(1).should("be.visible");
Page.requestPanel.getEpisodeCheckbox(1).each((element) => {
expect(element.length).to.be.greaterThan(0);
});
});
@ -31,19 +34,20 @@ describe("TV Requests Grid", function () {
});
}).as("detailsResponse");
cy.visit("/details/tv/121361");
Page.visit('121361');
cy.wait("@detailsResponse");
cy.getByData("classStatus1").should("not.have.class", "available");
cy.getByData("classStatus1").should("have.class", "requested");
cy.getByData("classStatus1").should("not.have.class", "approved");
Page.requestPanel.seasonTab(1)
.should("not.have.class", "available")
.should("have.class", "requested")
.should("not.have.class", "approved");
// checkboxes
cy.getByData("masterCheckbox1").should("not.exist");
cy.getByDataLike("episodeCheckbox1").should("not.exist");
Page.requestPanel.getSeasonMasterCheckbox(1).should("not.exist");
Page.requestPanel.getEpisodeCheckbox(1).should("not.exist");
cy.getByDataLike("episodeStatus1").each((element) => {
Page.requestPanel.getEpisodeStatus(1).each((element) => {
expect(element.hasClass("requested")).to.be.true;
expect(element.text()).contain('Pending Approval');
});
@ -64,19 +68,20 @@ describe("TV Requests Grid", function () {
});
}).as("detailsResponse");
cy.visit("/details/tv/121361");
Page.visit('121361');
cy.wait("@detailsResponse");
cy.getByData("classStatus1").should("not.have.class", "available");
cy.getByData("classStatus1").should("not.have.class", "requested");
cy.getByData("classStatus1").should("have.class", "approved");
Page.requestPanel.seasonTab(1)
.should("not.have.class", "available")
.should("not.have.class", "requested")
.should("have.class", "approved");
// checkboxes
cy.getByData("masterCheckbox1").should("not.exist");
cy.getByDataLike("episodeCheckbox1").should("not.exist");
Page.requestPanel.getSeasonMasterCheckbox(1).should("not.exist");
Page.requestPanel.getEpisodeCheckbox(1).should("not.exist");
cy.getByDataLike("episodeStatus1").each((element) => {
Page.requestPanel.getEpisodeStatus(1).each((element) => {
expect(element.hasClass("approved")).to.be.true;
expect(element.text()).contain('Approved');
});
@ -96,74 +101,76 @@ describe("TV Requests Grid", function () {
});
}).as("detailsResponse");
cy.visit("/details/tv/121361");
Page.visit('121361');
cy.wait("@detailsResponse");
cy.getByData("classStatus1").should("have.class", "available");
cy.getByData("classStatus1").should("not.have.class", "requested");
cy.getByData("classStatus1").should("not.have.class", "approved");
Page.requestPanel.seasonTab(1)
.should("have.class", "available")
.should("not.have.class", "requested")
.should("not.have.class", "approved");
// checkboxes
cy.getByData("masterCheckbox1").should("not.exist");
cy.getByDataLike("episodeCheckbox1").should("not.exist");
Page.requestPanel.getSeasonMasterCheckbox(1).should("not.exist");
Page.requestPanel.getEpisodeCheckbox(1).should("not.exist");
cy.getByDataLike("episodeStatus1").each((element) => {
Page.requestPanel.getEpisodeStatus(1).each((element) => {
expect(element.hasClass("available")).to.be.true;
expect(element.text()).contain('Available');
});
});
it("Request no episodes", () => {
cy.visit("/details/tv/121361");
Page.visit('121361');
cy.get('#addFabBtn').click();
cy.get('#requestSelected').click();
Page.requestFabButton.fab.click();
Page.requestFabButton.requestSelected.click();
cy.verifyNotification('You need to select some episodes!');
});
it("Request single episodes", () => {
cy.visit("/details/tv/121361");
const episodeCheckbox = 'episodeCheckbox21';
Page.visit('121361');
cy.getByData("classStatus2").click();
cy.getByData(episodeCheckbox).click();
cy.get('#addFabBtn').click();
cy.get('#requestSelected').click();
Page.requestPanel.seasonTab(2).click();
Page.requestPanel.getEpisodeSeasonCheckbox(2,1).click();
Page.requestFabButton.fab.click();
Page.requestFabButton.requestSelected.click();
cy.verifyNotification('Request for Game of Thrones has been added successfully');
cy.getByData('episodeStatus21')
Page.requestPanel.getEpisodeStatus(2,1)
.should('contain.text', 'Pending Approval')
.should('have.class', 'requested')
});
it("Request First Season", () => {
cy.visit("/details/tv/121361");
Page.visit('121361');
cy.get('#addFabBtn').click();
cy.get('#requestFirst').click();
Page.requestFabButton.fab.click();
Page.requestFabButton.requestFirst.click();
cy.verifyNotification('Request for Game of Thrones has been added successfully');
cy.getByDataLike('episodeStatus1')
Page.requestPanel.getEpisodeStatus(1)
.should('contain.text', 'Pending Approval')
.should('have.class', 'requested')
});
it("Request Latest Season", () => {
cy.visit("/details/tv/121361");
Page.visit('121361');
cy.get('#addFabBtn').click();
cy.get('#requestLatest').click();
Page.requestFabButton.fab.click();
Page.requestFabButton.requestLatest.click();
cy.verifyNotification('Request for Game of Thrones has been added successfully');
cy.getByData("classStatus8").click();
cy.getByData("classStatus8").should("have.class", "requested");
cy.getByDataLike('episodeStatus8')
Page.requestPanel.seasonTab(8)
.click()
.should("have.class", "requested");
Page.requestPanel.getEpisodeStatus(8)
.should('contain.text', 'Pending Approval')
.should('have.class', 'requested')
});

Loading…
Cancel
Save