Browse Source

chore(tests): cleanup

pull/3933/head
braks 2 years ago
parent
commit
4cd2f21447
  1. 4
      packages/nc-gui/assets/style.scss
  2. 2
      packages/nc-gui/pages/index/index/user.vue
  3. 0
      packages/nc-gui/pages/index/user/index.vue
  4. 25
      scripts/cypress/integration/common/6h_change_password.js

4
packages/nc-gui/assets/style.scss

@ -214,11 +214,11 @@ a {
} }
&:hover::after { &:hover::after {
@apply !border-0 transform scale-110 ring ring-accent ring-opacity-100; @apply transform scale-110 ring ring-accent;
} }
&:active::after { &:active::after {
@apply ring ring-accent ring-opacity-100; @apply ring ring-accent;
} }
} }

2
packages/nc-gui/pages/index/index/user.vue

@ -147,7 +147,7 @@ const resetError = () => {
.create { .create {
.ant-input-affix-wrapper, .ant-input-affix-wrapper,
.ant-input { .ant-input {
@apply !appearance-none my-1 border-1 border-solid rounded; @apply !appearance-none my-1 border-1 border-solid border-primary border-opacity-50 rounded;
} }
} }
} }

0
packages/nc-gui/pages/index/user/index.vue

25
scripts/cypress/integration/common/6h_change_password.js

@ -2,12 +2,14 @@ import { isTestSuiteActive, roles } from "../../support/page_objects/projectCons
const newPassword = `${roles.owner.credentials.password}1`; const newPassword = `${roles.owner.credentials.password}1`;
const currentPasswordIsWrong = "Current password is wrong";
const passwordsNotMatching = "Passwords do not match";
export const genTest = (apiType, dbType) => { export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return; if (!isTestSuiteActive(apiType, dbType)) return;
describe('User settings test', () => { describe('User settings', () => {
it('Visit user settings', () => { it('Visit user settings page', () => {
cy.get("[data-cy='nc-noco-brand-icon']").click(); cy.get("[data-cy='nc-noco-brand-icon']").click();
cy.get("[data-cy='nc-menu-accounts']").click(); cy.get("[data-cy='nc-menu-accounts']").click();
@ -16,7 +18,7 @@ export const genTest = (apiType, dbType) => {
cy.get("[data-cy='nc-user-settings-form']").should("exist"); cy.get("[data-cy='nc-user-settings-form']").should("exist");
}); });
describe('Change password', () => { describe('Update password and verify user settings form validation', () => {
beforeEach(() => { beforeEach(() => {
cy.get("[data-cy='nc-user-settings-form__current-password']").clear(); cy.get("[data-cy='nc-user-settings-form__current-password']").clear();
cy.get("[data-cy='nc-user-settings-form__new-password']").clear(); cy.get("[data-cy='nc-user-settings-form__new-password']").clear();
@ -28,29 +30,34 @@ export const genTest = (apiType, dbType) => {
cy.get("[data-cy='nc-user-settings-form__new-password']").type(newPassword); cy.get("[data-cy='nc-user-settings-form__new-password']").type(newPassword);
cy.get("[data-cy='nc-user-settings-form__new-password-repeat']").type(newPassword); cy.get("[data-cy='nc-user-settings-form__new-password-repeat']").type(newPassword);
cy.get("[data-cy='nc-user-settings-form__submit']").click(); cy.get("[data-cy='nc-user-settings-form__submit']").click();
cy.get("[data-cy='nc-user-settings-form__error']").should("exist").should("contain", "Current password is wrong"); cy.get("[data-cy='nc-user-settings-form__error']").should("exist").should("contain", currentPasswordIsWrong);
}); });
it('Verifies matching passwords', () => { it('Verifies passwords match', () => {
cy.get("[data-cy='nc-user-settings-form__current-password']").type(roles.owner.credentials.password); cy.get("[data-cy='nc-user-settings-form__current-password']").type(roles.owner.credentials.password);
cy.get("[data-cy='nc-user-settings-form__new-password']").type(newPassword); cy.get("[data-cy='nc-user-settings-form__new-password']").type(newPassword);
cy.get("[data-cy='nc-user-settings-form__new-password-repeat']").type(newPassword + 'NotMatching'); cy.get("[data-cy='nc-user-settings-form__new-password-repeat']").type(`${newPassword}NotMatching`);
cy.get("[data-cy='nc-user-settings-form__submit']").click(); cy.get("[data-cy='nc-user-settings-form__submit']").click();
cy.get(".ant-form-item-explain-error").should("exist").should("contain", "Passwords do not match"); cy.get(".ant-form-item-explain-error").should("exist").should("contain", passwordsNotMatching);
}); });
it('Change user password using valid password', () => { it('Changes user password & signs out', () => {
cy.get("[data-cy='nc-user-settings-form__current-password']").type(roles.owner.credentials.password); cy.get("[data-cy='nc-user-settings-form__current-password']").type(roles.owner.credentials.password);
cy.get("[data-cy='nc-user-settings-form__new-password']").type(newPassword); cy.get("[data-cy='nc-user-settings-form__new-password']").type(newPassword);
cy.get("[data-cy='nc-user-settings-form__new-password-repeat']").type(newPassword); cy.get("[data-cy='nc-user-settings-form__new-password-repeat']").type(newPassword);
cy.get("[data-cy='nc-user-settings-form__submit']").click(); cy.get("[data-cy='nc-user-settings-form__submit']").click();
cy.get("[data-cy='nc-user-settings-form__submit']").should("not.exist"); cy.get("[data-cy='nc-user-settings-form__submit']").should("not.exist");
});
})
describe('Sign in with new password', () => {
it('Verifies new password works', () => {
cy.get("[data-cy='nc-form-signin']").should("exist"); cy.get("[data-cy='nc-form-signin']").should("exist");
cy.get("[data-cy='nc-form-signin__email']").type(roles.owner.credentials.username); cy.get("[data-cy='nc-form-signin__email']").type(roles.owner.credentials.username);
cy.get("[data-cy='nc-form-signin__password']").type(newPassword); cy.get("[data-cy='nc-form-signin__password']").type(newPassword);
cy.get("[data-cy='nc-form-signin__submit']").click(); cy.get("[data-cy='nc-form-signin__submit']").click();
cy.get("[data-cy='nc-menu-accounts']").should("exist"); cy.get("[data-cy='nc-menu-accounts']").should("exist");
}); })
}) })
}); });
}; };

Loading…
Cancel
Save