Skip to content

Commit

Permalink
Added Cypress Test For Edit Profile Details
Browse files Browse the repository at this point in the history
  • Loading branch information
saithsab877 committed Mar 18, 2024
1 parent 4ad6121 commit cdc67a2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
47 changes: 47 additions & 0 deletions cypress/e2e/14_edit_profile_details.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
describe('User profile editing', () => {
let activeUser = 'alice';

const UserProfile = {
description: 'An organization focused on amazing projects.',
twitter: 'Abubakar80461830',
github: 'amazing',
coding_language: ['Lightning', 'Typescript', 'Golang']
};

beforeEach(() => {
cy.login(activeUser);
});

it('Allows a user to edit their profile details', () => {
cy.contains(activeUser).click();
cy.wait(1000);

cy.contains('Edit Profile').click();
cy.wait(1000);

cy.get('[data-testid="checktextarea"]').clear().type(UserProfile.description);
cy.wait(1000);

cy.get('.euiFormLabel').contains('Coding Languages').click();

for (let i = 0; i < UserProfile.coding_language.length; i++) {
cy.get('#react-select-3-input').type(`${UserProfile.coding_language[i]}{enter}`, {
force: true
});
}
cy.get('body').click();
cy.get('[data-testid="github"]').type(UserProfile.github);
cy.wait(1000);

cy.get('[data-testid="twitter"]').type(UserProfile.twitter);
cy.wait(1000);

cy.contains('Save').click();
cy.wait(1000);

// click outside the modal
cy.get('body').click(0, 0);

cy.logout(activeUser);
});
});
1 change: 1 addition & 0 deletions src/components/form/about/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ function Form(props: FormProps) {
{...item}
key={item.name}
values={values}
testId={item.name}
errors={errors}
scrollToTop={scrollToTop}
value={values[item.name]}
Expand Down

0 comments on commit cdc67a2

Please sign in to comment.