mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 18:47:15 -07:00
Started adding the ability for them to self manage their accounts
This commit is contained in:
parent
612fbb213f
commit
27f0d6e225
15 changed files with 385 additions and 181 deletions
|
@ -73,7 +73,7 @@ class NavBar {
|
|||
}
|
||||
|
||||
get userPreferences(): Cypress.Chainable<any> {
|
||||
return cy.get('#nav-userPreferences');
|
||||
return cy.get('#profile-image');
|
||||
}
|
||||
|
||||
get logout(): Cypress.Chainable<any> {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { BasePage } from "../base.page";
|
||||
|
||||
class UserPreferencesPage extends BasePage {
|
||||
|
||||
class ProfileTab {
|
||||
get languageSelectBox(): Cypress.Chainable<any> {
|
||||
return cy.get('#langSelect');
|
||||
}
|
||||
|
@ -17,6 +16,9 @@ class UserPreferencesPage extends BasePage {
|
|||
streamingSelectBoxOption(country: string): Cypress.Chainable<any> {
|
||||
return cy.get('#streamingSelect'+country);
|
||||
}
|
||||
}
|
||||
|
||||
class MobileTab {
|
||||
|
||||
get qrCode(): Cypress.Chainable<any> {
|
||||
return cy.get('#qrCode');
|
||||
|
@ -25,6 +27,59 @@ class UserPreferencesPage extends BasePage {
|
|||
get noQrCode(): Cypress.Chainable<any> {
|
||||
return cy.get('#noQrCode');
|
||||
}
|
||||
}
|
||||
|
||||
class SecurityTab {
|
||||
get currentPassword(): Cypress.Chainable<any> {
|
||||
return cy.get('#currentPassword');
|
||||
}
|
||||
|
||||
get email(): Cypress.Chainable<any> {
|
||||
return cy.get('#email');
|
||||
}
|
||||
|
||||
get newPassword(): Cypress.Chainable<any> {
|
||||
return cy.get('#newPassword');
|
||||
}
|
||||
|
||||
get confirmPassword(): Cypress.Chainable<any> {
|
||||
return cy.get('#confirmPassword');
|
||||
}
|
||||
|
||||
get submitButton(): Cypress.Chainable<any> {
|
||||
return cy.get('#submitSecurity');
|
||||
}
|
||||
}
|
||||
|
||||
class UserPreferencesPage extends BasePage {
|
||||
|
||||
|
||||
get username(): Cypress.Chainable<any> {
|
||||
return cy.get('#usernameTitle');
|
||||
}
|
||||
get email(): Cypress.Chainable<any> {
|
||||
return cy.get('#emailTitle');
|
||||
}
|
||||
|
||||
get profileTab(): Cypress.Chainable<any> {
|
||||
return cy.get('[role="tab"]').eq(0);
|
||||
}
|
||||
|
||||
get securityTab(): Cypress.Chainable<any> {
|
||||
return cy.get('[role="tab"]').eq(1);
|
||||
}
|
||||
|
||||
get preferencesTab(): Cypress.Chainable<any> {
|
||||
return cy.get('[role="tab"]').eq(2);
|
||||
}
|
||||
|
||||
get mobileTab(): Cypress.Chainable<any> {
|
||||
return cy.get('[role="tab"]').eq(3);
|
||||
}
|
||||
|
||||
profile = new ProfileTab();
|
||||
mobile = new MobileTab();
|
||||
security = new SecurityTab();
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
|
|
@ -120,4 +120,6 @@ Cypress.Commands.add("getByData", (selector) => {
|
|||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { userPreferencesPage as Page } from "@/integration/page-objects";
|
||||
|
||||
describe("User Preferences Tests", () => {
|
||||
describe("User Preferences Profile Tests", () => {
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
});
|
||||
|
@ -16,8 +16,8 @@ langs.forEach((l) => {
|
|||
cy.intercept('POST','/language').as('langSave');
|
||||
Page.visit();
|
||||
|
||||
Page.languageSelectBox.click();
|
||||
Page.languageSelectBoxOption(l.code).click();
|
||||
Page.profile.languageSelectBox.click();
|
||||
Page.profile.languageSelectBoxOption(l.code).click();
|
||||
|
||||
Page.navbar.discover.contains(l.discover);
|
||||
|
||||
|
@ -42,10 +42,10 @@ streamingCountries.forEach((country) => {
|
|||
Page.visit();
|
||||
cy.wait('@countryApi');
|
||||
|
||||
Page.streamingSelectBox.click();
|
||||
Page.streamingSelectBoxOption(country).click();
|
||||
Page.profile.streamingSelectBox.click();
|
||||
Page.profile.streamingSelectBoxOption(country).click();
|
||||
|
||||
Page.streamingSelectBox.should('have.attr','ng-reflect-value', country);
|
||||
Page.profile.streamingSelectBox.should('have.attr','ng-reflect-value', country);
|
||||
|
||||
cy.wait('@countryApiSave').then((intercept) => {
|
||||
expect(intercept.request.body.code).equal(country);
|
|
@ -0,0 +1,69 @@
|
|||
import { userPreferencesPage as Page } from "@/integration/page-objects";
|
||||
|
||||
describe("User Preferences Security Tests", () => {
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
Page.visit();
|
||||
Page.securityTab.click();
|
||||
});
|
||||
|
||||
|
||||
it(`Change Email Address Requires Current Password`, () => {
|
||||
Page.security.email.clear();
|
||||
Page.security.email.type('test@test.com');
|
||||
Page.security.submitButton.click();
|
||||
|
||||
Page.security.currentPassword.should('have.class', 'ng-invalid');
|
||||
});
|
||||
|
||||
it(`Change Password Requires Current Password`, () => {
|
||||
Page.security.newPassword.type('test@test.com');
|
||||
Page.security.confirmPassword.type('test@test.com');
|
||||
Page.security.submitButton.click();
|
||||
|
||||
Page.security.currentPassword.should('have.class', 'ng-invalid');
|
||||
});
|
||||
|
||||
it(`Change Email incorrect password`, () => {
|
||||
Page.security.currentPassword.type('incorrect');
|
||||
Page.security.email.clear();
|
||||
Page.security.email.type('test@test.com');
|
||||
Page.security.submitButton.click();
|
||||
cy.verifyNotification('password is incorrect');
|
||||
});
|
||||
|
||||
it(`Change password, existing password incorrect`, () => {
|
||||
Page.security.currentPassword.type('incorrect');
|
||||
Page.security.newPassword.type('test@test.com');
|
||||
Page.security.confirmPassword.type('test@test.com');
|
||||
Page.security.submitButton.click();
|
||||
cy.verifyNotification('password is incorrect');
|
||||
});
|
||||
|
||||
it("Change password of user", () => {
|
||||
cy.generateUniqueId().then((id) => {
|
||||
const roles = [];
|
||||
roles.push({ value: "RequestMovie", enabled: true });
|
||||
cy.createUser(id, "a", roles).then(() => {
|
||||
cy.removeLogin();
|
||||
cy.loginWithCreds(id, "a");
|
||||
|
||||
Page.visit();
|
||||
Page.securityTab.click();
|
||||
|
||||
Page.security.currentPassword.type('a');
|
||||
Page.security.email.clear();
|
||||
Page.security.email.type('test@test.com');
|
||||
Page.security.newPassword.type('b');
|
||||
Page.security.confirmPassword.type('b');
|
||||
Page.security.submitButton.click();
|
||||
|
||||
cy.verifyNotification('Updated your information');
|
||||
|
||||
Page.email.should('have.text','(test@test.com)')
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue