This commit is contained in:
tidusjar 2021-03-16 21:18:02 +00:00
commit 2710d7349f
9 changed files with 128 additions and 71 deletions

View file

@ -3,3 +3,4 @@ export * from './login/login.page';
export * from './wizard/wizard.page';
export * from './details/tv/tvdetails.page';
export * from './search/search.page';
export * from './user-preferences/user-preferences.page';

View file

@ -0,0 +1,42 @@
import { BasePage } from "../base.page";
class UserPreferencesPage extends BasePage {
get languageSelectBox(): Cypress.Chainable<any> {
return cy.get('#langSelect');
}
languageSelectBoxOption(lang: string): Cypress.Chainable<any> {
return cy.get('#langSelect'+lang);
}
get streamingSelectBox(): Cypress.Chainable<any> {
return cy.get('#streamingSelect');
}
streamingSelectBoxOption(country: string): Cypress.Chainable<any> {
return cy.get('#streamingSelect'+country);
}
get qrCode(): Cypress.Chainable<any> {
return cy.get('#qrCode');
}
get noQrCode(): Cypress.Chainable<any> {
return cy.get('#noQrCode');
}
constructor() {
super();
}
visit(options: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
visit(): Cypress.Chainable<Cypress.AUTWindow>;
visit(id: string): Cypress.Chainable<Cypress.AUTWindow>;
visit(id: string, options: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow>;
visit(id?: any, options?: any) {
return cy.visit(`/user-preferences`, options);
}
}
export const userPreferencesPage = new UserPreferencesPage();

View file

@ -129,7 +129,7 @@ describe("TV Requests Grid", function () {
cy.verifyNotification('You need to select some episodes!');
});
it.only("Request single episodes", () => {
it("Request single episodes", () => {
Page.visit('1399');
Page.requestPanel.seasonTab(2).click();

View file

@ -1,5 +1,4 @@
import { searchPage as Page } from "@/integration/page-objects";
import { verify } from "cypress/types/sinon";
describe("Search Tests", () => {
beforeEach(() => {
@ -152,4 +151,17 @@ describe("Search Tests", () => {
expect(+x).to.be.greaterThan(0);
});
});
it("Searching via the search bar", () => {
Page.navbar.searchFilter.applyFilter(true, true, false);
Page.visit(" ");
cy.wait('@searchResponse');
Page.navbar.searchBar.searchInput.type('007');
Page.searchResultsContainer.invoke('attr', 'search-count').then((x: string) => {
expect(+x).to.be.greaterThan(0);
});
});
});

View file

@ -0,0 +1,57 @@
import { userPreferencesPage as Page } from "@/integration/page-objects";
describe("User Preferences Tests", () => {
beforeEach(() => {
cy.login();
});
const langs = [
{ code: 'fr', discover: 'Découvrir'},
{ code: 'de', discover: 'Entdecken'},
{ code: 'en', discover: 'Discover'},
];
langs.forEach((l) => {
it(`Change language to ${l.code}, UI should update`, () => {
cy.intercept('POST','/language').as('langSave');
Page.visit();
Page.languageSelectBox.click();
Page.languageSelectBoxOption(l.code).click();
Page.navbar.discover.contains(l.discover);
cy.wait('@langSave').then((intercept) => {
expect(intercept.request.body.lang).equal(l.code);
})
});
})
const streamingCountries = [
'GB',
'US',
'FR',
'HU'
];
streamingCountries.forEach((country) => {
// derive test name from data
it(`Change streaming to ${country} UI should update`, () => {
cy.intercept('GET','streamingcountry').as('countryApi');
cy.intercept('POST','streamingcountry').as('countryApiSave');
Page.visit();
cy.wait('@countryApi');
Page.streamingSelectBox.click();
Page.streamingSelectBoxOption(country).click();
Page.streamingSelectBox.should('have.attr','ng-reflect-value', country);
cy.wait('@countryApiSave').then((intercept) => {
expect(intercept.request.body.code).equal(country);
})
})
})
});