mirror of https://github.com/Ombi-app/Ombi
parent
c6c45b3342
commit
2710d7349f
@ -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();
|
@ -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);
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
});
|
Loading…
Reference in new issue