Skip to content

Commit

Permalink
Merge pull request #264 from sos-lapsikyla/felix/ux-improvements
Browse files Browse the repository at this point in the history
UX improvements
  • Loading branch information
rottabonus authored Nov 14, 2023
2 parents 93281f9 + b390c4f commit bc16222
Show file tree
Hide file tree
Showing 51 changed files with 556 additions and 210 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
'error',
{
args: 'after-used',
argsIgnorePattern: '^_$',
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
Expand Down
6 changes: 3 additions & 3 deletions e2e/archiveTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Archiving', () => {
await element(by.text(mentee.displayName)).atIndex(0).tap();
await element(by.id('main.chat.title.kebabicon')).tap();
await element(by.text('Archive chat')).tap();
await element(by.text('OK')).tap();
await element(by.text('Archive')).tap();

await expect(element(by.text(mentee.displayName))).not.toBeVisible();

Expand Down Expand Up @@ -126,7 +126,7 @@ describe('Archiving', () => {
await element(by.id('main.chat.title.kebabicon')).tap();
await element(by.text('Restore chat')).tap();

await element(by.text('OK')).tap();
await element(by.text('Restore')).tap();

await waitFor(element(by.id('main.folderedlist.back.button')))
.toBeVisible()
Expand Down Expand Up @@ -170,7 +170,7 @@ describe('Archiving', () => {
await element(by.id('main.chat.title.kebabicon')).tap();
await element(by.text('Delete chat')).tap();

await element(by.text('OK')).tap();
await element(by.text('Delete')).tap();

// mentor should not see mentee's name in archived list
await expect(element(by.text(mentee.displayName))).not.toBeVisible();
Expand Down
8 changes: 4 additions & 4 deletions e2e/banTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Banning', () => {
await element(by.text(mentee.displayName)).atIndex(0).tap();
await element(by.id('main.chat.title.kebabicon')).tap();
await element(by.text('Ban chat')).tap();
await element(by.text('OK')).tap();
await element(by.text('Ban')).tap();

await expect(element(by.text(mentee.displayName))).not.toBeVisible();

Expand Down Expand Up @@ -122,7 +122,7 @@ describe('Banning', () => {
await element(by.id('main.chat.title.kebabicon')).tap();
await element(by.text('Restore chat')).tap();

await element(by.text('OK')).tap();
await element(by.text('Restore')).tap();

await waitFor(element(by.id('main.folderedlist.back.button')))
.toBeVisible()
Expand Down Expand Up @@ -167,7 +167,7 @@ describe('Banning', () => {
await element(by.id('main.chat.title.kebabicon')).tap();
await element(by.text('Delete chat')).tap();

await element(by.text('OK')).tap();
await element(by.text('Delete')).tap();

// mentor should not see mentee's name in banned list
await expect(element(by.text(mentee.displayName))).not.toBeVisible();
Expand Down Expand Up @@ -253,7 +253,7 @@ describe('Banning', () => {
await element(by.id('main.folderedlist.kebabicon')).tap();
await element(by.text('Delete all')).tap();

await element(by.text('OK')).tap();
await element(by.text('Delete')).tap();

// mentor should not see mentees' names in banned list
await expect(element(by.text(mentee.displayName))).not.toBeVisible();
Expand Down
20 changes: 19 additions & 1 deletion e2e/browseMentorsTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('Browse mentors', () => {
await signIn(mentee);

await expect(element(by.text(mentor1.displayName))).toBeVisible();
await element(by.text('Read more')).tap();
await element(by.text('Show mentor')).tap();
await element(by.id('components.mentorTitle.chevronLeft')).tap();

await expect(element(by.id('components.mentorList'))).toBeVisible();
Expand Down Expand Up @@ -177,4 +177,22 @@ describe('Browse mentors', () => {
// Name is changed in mentorList
await expect(element(by.text(newDisplayname)).atIndex(0)).toBeVisible();
});

it('mentor can see own profile as first item in list of mentors, but cannot chat with yourself', async () => {
const mentor = accountFixtures.mentors[0];
await APISignUpMentor(mentor);
await APISignUpMentor(accountFixtures.mentors[1]);
await APISignUpMentor(accountFixtures.mentors[2]);

await signIn(mentor);

await expect(element(by.text(mentor.displayName))).toBeVisible();
await element(by.text('Show mentor')).atIndex(0).tap();

await element(by.text('Chat')).tap();
await expect(element(by.id('main.chat.title.kebabicon'))).not.toBeVisible();

await element(by.id('components.mentorTitle.chevronLeft')).tap();
await expect(element(by.id('components.mentorList'))).toBeVisible();
});
});
98 changes: 97 additions & 1 deletion e2e/changePasswordTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ describe('changePassword', () => {
await APIDeleteAccounts();
await device.reloadReactNative();
});
afterEach(async () => {
await forceLogout();
});

it('for a mentee succesfully', async () => {
const mentee = accountFixtures.mentees[0];
const newPassword = 'newpass';
const newPassword = 'newPass!';
await APISignUpMentee(mentee);

await signIn(mentee);
Expand Down Expand Up @@ -73,4 +76,97 @@ describe('changePassword', () => {
mentee.email,
);
});

it('validates new and repeated password are same', async () => {
const mentee = accountFixtures.mentees[0];
const newPassword = 'newPass!';
await APISignUpMentee(mentee);

await signIn(mentee);

await element(by.id('tabs.settings')).tap();

await scrollDownAndTap(
'main.settings.account.password.change',
'main.settings.index.view',
);

await scrollUpTo(
'main.settings.account.password.current',
'main.settings.password.view',
);

await waitAndTypeText(
'main.settings.account.password.current',
`${mentee.password}\n`,
);
await waitAndTypeText(
'main.settings.account.password.new',
`${newPassword}\n`,
);
await waitAndTypeText('main.settings.account.password.repeat', `lolwut\n`);

await scrollDownAndTap(
'main.settings.account.password.save',
'main.settings.password.view',
);

await expect(
element(by.text('Both new passwords should match')),
).toBeVisible();

await forceLogout();

await signIn({ loginName: mentee.loginName, password: newPassword });

await expect(
element(by.id('components.loginCard.errorMessage')),
).toBeVisible();
});

it('validates password-rules', async () => {
const mentee = accountFixtures.mentees[0];
const newPassword = 'newpass1';
await APISignUpMentee(mentee);

await signIn(mentee);

await element(by.id('tabs.settings')).tap();

await scrollDownAndTap(
'main.settings.account.password.change',
'main.settings.index.view',
);

await scrollUpTo(
'main.settings.account.password.current',
'main.settings.password.view',
);

await waitAndTypeText(
'main.settings.account.password.current',
`${mentee.password}\n`,
);
await waitAndTypeText(
'main.settings.account.password.new',
`${newPassword}\n`,
);
await waitAndTypeText(
'main.settings.account.password.repeat',
`${newPassword}\n`,
);

await scrollDownAndTap(
'main.settings.account.password.save',
'main.settings.password.view',
);

await forceLogout();

await signIn({ loginName: mentee.loginName, password: newPassword });

await expect(
element(by.id('components.loginCard.errorMessage')),
).toBeVisible();
});
});
2 changes: 1 addition & 1 deletion e2e/chatTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Chat', () => {

await signIn(mentee);

await element(by.text('Read more')).tap();
await element(by.text('Show mentor')).tap();
await element(by.text('Chat')).tap();

await waitAndTypeText('main.chat.input.input', message_from_mentee, true);
Expand Down
4 changes: 2 additions & 2 deletions e2e/fixtures/accounts.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
{
"loginName": "mentee",
"displayName": "mentee_nick",
"password": "menteementee",
"password": "Menteementee!",
"email": "[email protected]",
"role": "mentee"
},
{
"loginName": "mentee1",
"displayName": "mentee1_nick",
"password": "menteementee",
"password": "Menteementee!",
"email": "[email protected]",
"role": "mentee"
}
Expand Down
37 changes: 35 additions & 2 deletions e2e/signUpTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ describe('SignUp', () => {
await APIDeleteAccounts();
await device.reloadReactNative();
});
afterEach(async () => {
await forceLogout();
});

it('mentee succesfully', async () => {
const mentee = accountFixtures.mentees[0];
Expand Down Expand Up @@ -81,7 +84,38 @@ describe('SignUp', () => {
await expect(element(by.id('main.settings.account.email'))).toHaveText(
mentee.email,
);
await forceLogout();
});

it('password is validated by rules', async () => {
const mentee = accountFixtures.mentees[0];
await scrollDownAndTap(
'onboarding.welcome.button',
'onboarding.welcome.view',
);
await scrollDownAndTap(
'onboarding.mentorlist.start',
'onboarding.mentorlist.view',
);
await scrollDownAndTap('onboarding.sign.up', 'onboarding.mentorlist.view');

await waitAndTypeText(
'onboarding.signUp.userName',
`${mentee.loginName}\n`,
);
await waitAndTypeText('onboarding.signUp.password', `menteementee!\n`);

await scrollDownAndTap(
'onboarding.signUp.button',
'onboarding.signUp.view',
);

await expect(
element(
by.text(
'New password should be a minimum of eight characters in length, include one uppercase letter, one lowercase letter and a special character',
),
),
).toBeVisible();
});

it('cannot go past displayname if display_name is erased', async () => {
Expand Down Expand Up @@ -115,6 +149,5 @@ describe('SignUp', () => {
await expect(
element(by.id('onboarding.displayName.inputTitle')),
).toBeVisible();
await forceLogout();
});
});
4 changes: 2 additions & 2 deletions e2e/userReportTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('reportUser', () => {
await waitAndTypeText(descriptionTestId, reportReason);
await waitAndTypeText(contactTestId, contactInfo);

await element(by.text('Send')).tap();
await element(by.id('main.userreport.send.button')).tap();

// After sending we are back at the chat-view
await expect(element(by.text(mentor.displayName))).toBeVisible();
Expand Down Expand Up @@ -171,7 +171,7 @@ describe('reportUser', () => {
).toBeVisible();

// If no reason, sending is disabled
await element(by.text('Send')).tap();
await element(by.id('main.userreport.send.button')).tap();
await expect(element(by.text('Reason for reporting *'))).toBeVisible();
});

Expand Down
6 changes: 6 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ PODS:
- React-perflogger (= 0.71.6)
- RNCAsyncStorage (1.18.1):
- React-Core
- RNDeviceInfo (10.11.0):
- React-Core
- RNFBApp (18.3.2):
- Firebase/CoreOnly (= 10.14.0)
- React-Core
Expand Down Expand Up @@ -605,6 +607,7 @@ DEPENDENCIES:
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
- "RNFBApp (from `../node_modules/@react-native-firebase/app`)"
- "RNFBMessaging (from `../node_modules/@react-native-firebase/messaging`)"
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
Expand Down Expand Up @@ -715,6 +718,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon"
RNCAsyncStorage:
:path: "../node_modules/@react-native-async-storage/async-storage"
RNDeviceInfo:
:path: "../node_modules/react-native-device-info"
RNFBApp:
:path: "../node_modules/@react-native-firebase/app"
RNFBMessaging:
Expand Down Expand Up @@ -789,6 +794,7 @@ SPEC CHECKSUMS:
React-runtimeexecutor: 8692ac548bec648fa121980ccb4304afd136d584
ReactCommon: 0c43eaeaaee231d7d8dc24fc5a6e4cf2b75bf196
RNCAsyncStorage: b90b71f45b8b97be43bc4284e71a6af48ac9f547
RNDeviceInfo: bf8a32acbcb875f568217285d1793b0e8588c974
RNFBApp: 0b534885354024f4d171ede8da04521d81bc1767
RNFBMessaging: a2ebefff4dd99eba6b16105bbc0b931bfdb0ce74
RNGestureHandler: 071d7a9ad81e8b83fe7663b303d132406a7d8f39
Expand Down
Loading

0 comments on commit bc16222

Please sign in to comment.