Skip to content

Commit 7430891

Browse files
committed
Merge branch 'develop' of https://github.com/systers/mentorship-android into patch_two
2 parents 44f10b6 + ade6b6f commit 7430891

File tree

141 files changed

+4107
-1351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+4107
-1351
lines changed

.github/CONTRIBUTING.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
# Contributing Guidelines
2-
* You can join our [slack channel](http://systers.io/slack-systers-opensource/). Each active repo has its own channel to direct questions to (for example #powerup or #portal).
2+
3+
* You can join us on [AnitaB.org Open Source Zulip](https://anitab-org.zulipchat.com/). Each active repo has its own stream to direct questions to (for example #powerup or #portal). Mentorship System stream is [#mentorship-system](https://anitab-org.zulipchat.com/#narrow/stream/222534-mentorship-system).
34
* Remember that this is an inclusive community, committed to creating a safe, positive environment. See the full [Code of Conduct](http://www.systers.io/code-of-conduct.html).
5+
* Follow our [Commit Message Style Guide](https://github.com/anitab-org/mentorship-android/wiki/Commit-Message-Style-Guide) when you commit your changes.
6+
* Please consider raising an issue before submitting a pull request (PR) to solve a problem that is not present in our [issue tracker](https://github.com/anitab-org/mentorship-android/issues). This allows maintainers to first validate the issue you are trying to solve and also reference the PR to a specific issue.
7+
* When developing a new feature, include at least one test when applicable.
8+
* When submitting a PR, please follow [this template](PULL_REQUEST_TEMPLATE.md) (which will probably be already filled up once you create the PR).
9+
* When submitting a PR with changes to user interface (e.g.: new screen, ...), please add screenshots to the PR description.
10+
* When you are finished with your work, please squash your commits otherwise we will squash them on your PR (this can help us maintain a clear commit history).
11+
* When creating an issue to report a bug in the project, please follow our [bug_report.md](ISSUE_TEMPLATE/bug_report.md) template.
12+
* Issues labeled as “First Timers Only” are meant for contributors who have not contributed to the project yet. Please choose other issues to contribute to, if you have already contributed to these type of issues.
13+
414
## General Guidelines
15+
516
* If you’re just getting started work on an issue labeled “First Timers Only” in any project. Additional resources are available on our [website](http://www.systers.io).
617
* In an active repository (not an archived one), choose an open issue from the issue list, claim it in the comments, and a maintainer will assign it to you.
718
* After approval you must make continuous notes on your progress in the issue while working. If there is not at least one comment every 3 days, the maintainer can reassign the issue.
819
* Create a branch specific to the issue you're working on, so that you send a PR from that branch instead of the base branch on your fork.
920
* If you’d like to create a new issue, please go through our issue list first (open as well as closed) and make sure the issues you are reporting do not replicate the existing issues.
1021
* Have a short description on what has gone wrong (like a root cause analysis and description of the fix), if that information is not already present in the issue.
11-
* If you have issues on multiple pages, report them separately. Do not combine them into a single issue.
22+
* If you have issues on multiple pages, report them separately. Do not combine them into a single issue.

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ captures/
4646
.idea/vcs.xml
4747
.idea/runConfigurations.xml
4848
.idea/codeStyles/Project.xml
49+
.idea/codeStyles/codeStyleConfig.xml
50+
.idea/inspectionProfiles/Project_Default.xml
4951

5052
# Keystore files
5153
# Uncomment the following line if you do not want to check your keystore files in.

README.md

+20-9
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
| Branch | [Travis](https://travis-ci.org/) | [Codacy](https://www.codacy.com/) |
44
| :---: | :---: | :---: |
5-
| [master](https://github.com/systers/mentorship-android/tree/master) | [![Build Status](https://travis-ci.org/systers/mentorship-android.svg?branch=master)](https://travis-ci.org/systers/mentorship-android) | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/ee27e44e4ac646e0afe440173ea47823?branch=master)](https://www.codacy.com/app/m-murad/mentorship-android) |
6-
| [develop](https://github.com/systers/mentorship-android/tree/develop) | [![Build Status](https://travis-ci.org/systers/mentorship-android.svg?branch=develop)](https://travis-ci.org/systers/mentorship-android) | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/ee27e44e4ac646e0afe440173ea47823?branch=develop)](https://www.codacy.com/app/m-murad/mentorship-android) |
5+
| [master](https://github.com/anitab-org/mentorship-android/tree/master) | [![Build Status](https://travis-ci.org/anitab-org/mentorship-android.svg?branch=master)](https://travis-ci.org/anitab-org/mentorship-android) | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/ee27e44e4ac646e0afe440173ea47823?branch=master)](https://www.codacy.com/app/m-murad/mentorship-android) |
6+
| [develop](https://github.com/anitab-org/mentorship-android/tree/develop) | [![Build Status](https://travis-ci.org/anitab-org/mentorship-android.svg?branch=develop)](https://travis-ci.org/anitab-org/mentorship-android) | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/ee27e44e4ac646e0afe440173ea47823?branch=develop)](https://www.codacy.com/app/m-murad/mentorship-android) |
77

8-
[Mentorship System](https://github.com/systers/mentorship-backend) is an application that allows women in tech to mentor each other, on career development topics, through 1:1 relations for a certain period.
8+
[Mentorship System](https://github.com/anitab-org/mentorship-backend) is an application that allows women in tech to mentor each other, on career development topics, through 1:1 relations for a certain period.
99

1010
This is the Android client for the Mentorship System.
1111

1212
## Setting up the project
1313

1414
To setup the project locally read these wiki pages and follow the instructions:
1515

16-
- [Fork, Clone and Remote](https://github.com/systers/mentorship-android/wiki/Fork%2C-Clone-%26-Remote)
17-
- [Open project in Android Studio](https://github.com/systers/mentorship-android/wiki/Open-the-project-in-Android-Studio)
16+
- [Fork, Clone and Remote](https://github.com/anitab-org/mentorship-android/wiki/Fork%2C-Clone-%26-Remote)
17+
- [Open project in Android Studio](https://github.com/anitab-org/mentorship-android/wiki/Open-the-project-in-Android-Studio)
1818

1919
## Contributing
2020

21-
Please read our [Contributing guidelines](https://github.com/systers/mentorship-android/blob/develop/.github/CONTRIBUTING.md), [Code of Conduct](http://systers.io/code-of-conduct) and [Reporting Guidelines](http://systers.io/reporting-guidelines)
21+
Please read our [Contributing guidelines](https://github.com/anitab-org/mentorship-android/blob/develop/.github/CONTRIBUTING.md), [Code of Conduct](http://systers.io/code-of-conduct) and [Reporting Guidelines](http://systers.io/reporting-guidelines)
2222

23-
Please follow our [Commit Message Style Guide](https://github.com/systers/mentorship-android/wiki/Commit-Message-Style-Guide) while sending PRs.
23+
Please follow our [Commit Message Style Guide](https://github.com/anitab-org/mentorship-android/wiki/Commit-Message-Style-Guide) while sending PRs.
2424

2525
## Branches
2626

@@ -32,8 +32,19 @@ The repository has the following permanent branches:
3232

3333
* **apk** This branch contains the apks for the code in the develop branch. The apks are automatically updated when a commit is pushed to `develop` branch.
3434

35+
## Screenshots
36+
|![Splashscreen](Screenshots/Splashscreen.png)|![SignUp Screen](Screenshots/SignUp%20Screen.png)|![Login Page](Screenshots/Login%20Page.png)|
37+
|---|---|---|
38+
|![Home Page](Screenshots/Home%20Page.png)|![Profile Page](Screenshots/Profile%20Page.png)|![Edit Profile Page](Screenshots/Edit%20Profile%20Page.png)|
39+
|![Relations Page](Screenshots/Relations%20Page.png)|![Tasks Page](Screenshots/Tasks%20Page.png)|![Members Page](Screenshots/Members%20Page.png)
40+
|![Member Profile](Screenshots/Member%20Profile%20Page.png)|![Send Request Page](Screenshots/Send%20Request%20Page.png)|![Requests Page](Screenshots/Requests%20Page.png)|
41+
![Settings Screen](Screenshots/Settings%20Screen.png)|![About Page](Screenshots/About%20Page.png)|![Change Password Page](Screenshots/Change%20Password%20Page.png)|
3542
## Contact
3643

37-
You can reach maintainers team @mentorship-team on [Systers Open Source Slack](http://systers.io/slack-systers-opensource/) or @systers/maintainers-mentorship-android on GitHub.
44+
You can reach our community at [AnitaB.org Open Source Zulip](https://anitab-org.zulipchat.com/).
3845

39-
We use [#mentorship-system](https://systers-opensource.slack.com/messages/CAE8QK41L/) channel on Slack to discuss this project. If you're interested in contributing to this project, join us there!
46+
We use [#mentorship-system](https://anitab-org.zulipchat.com/#narrow/stream/222534-mentorship-system) stream on Zulip to discuss this project and interact with the community. If you're interested in contributing to this project, join us there!
47+
48+
## License
49+
50+
Mentorship System is licensed under the GNU General Public License v3.0. Learn more about it in the [LICENSE](LICENSE) file.

Screenshots/About Page.png

258 KB
Loading

Screenshots/Change Password Page.png

68.6 KB
Loading

Screenshots/Edit Profile Page.png

124 KB
Loading

Screenshots/Home Page.png

77.6 KB
Loading

Screenshots/Login Page.png

110 KB
Loading

Screenshots/Member Profile Page.png

74.7 KB
Loading

Screenshots/Members Page.png

114 KB
Loading

Screenshots/Profile Page.png

78.2 KB
Loading

Screenshots/Relations Page.png

60.6 KB
Loading

Screenshots/Requests Page.png

69.5 KB
Loading

Screenshots/Send Request Page.png

59.9 KB
Loading

Screenshots/Settings Screen.png

52.2 KB
Loading

Screenshots/SignUp Screen.png

99.6 KB
Loading

Screenshots/Splashscreen.png

283 KB
Loading

Screenshots/Tasks Page.png

74.2 KB
Loading

app/build.gradle

+8-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ android {
2121
release {
2222
minifyEnabled false
2323
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24-
manifestPlaceholders = [usesCleartextTraffic:"false"]
24+
manifestPlaceholders = [usesCleartextTraffic: "false"]
2525
}
2626
debug {
27-
manifestPlaceholders = [usesCleartextTraffic:"true"]
27+
manifestPlaceholders = [usesCleartextTraffic: "true"]
28+
}
29+
debug_localhost {
30+
initWith debug
2831
}
2932
}
3033
dataBinding {
@@ -53,6 +56,8 @@ dependencies {
5356
androidTestImplementation Dependencies.test_runner
5457
androidTestImplementation Dependencies.test_rules
5558
androidTestImplementation Dependencies.espresso
59+
androidTestImplementation Dependencies.espresso_intents
60+
androidTestImplementation Dependencies.ext_junit
5661

5762
implementation Dependencies.rx_java
5863
implementation Dependencies.rx_android
@@ -65,4 +70,5 @@ dependencies {
6570

6671
implementation Dependencies.lifecycle_extensions
6772
implementation Dependencies.lifecycle_viewmodel
73+
implementation Dependencies.circule_image_view
6874
}

app/src/androidTest/java/org/systers/mentorship/LoginActivityTest.kt

+113-37
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
package org.systers.mentorship
22

3+
import android.content.ComponentName
4+
import android.view.View
5+
import android.widget.EditText
36
import androidx.annotation.IdRes
4-
import com.google.android.material.textfield.TextInputLayout
57
import androidx.test.espresso.Espresso.onView
68
import androidx.test.espresso.ViewInteraction
79
import androidx.test.espresso.action.ViewActions.*
810
import androidx.test.espresso.assertion.ViewAssertions.matches
11+
import androidx.test.espresso.intent.Intents.intended
12+
import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent
13+
import androidx.test.espresso.intent.rule.IntentsTestRule
914
import androidx.test.espresso.matcher.ViewMatchers.*
15+
import androidx.test.platform.app.InstrumentationRegistry
1016
import androidx.test.rule.ActivityTestRule
11-
import androidx.test.runner.AndroidJUnit4
12-
import android.view.View
13-
import android.widget.EditText
17+
import androidx.test.ext.junit.runners.AndroidJUnit4
18+
import com.google.android.material.textfield.TextInputLayout
1419
import org.hamcrest.CoreMatchers.allOf
1520
import org.hamcrest.CoreMatchers.not
1621
import org.hamcrest.Description
@@ -20,20 +25,30 @@ import org.junit.Rule
2025
import org.junit.Test
2126
import org.junit.runner.RunWith
2227
import org.systers.mentorship.view.activities.LoginActivity
28+
import org.systers.mentorship.view.activities.MainActivity
29+
2330

2431
/**
2532
* This class specifies the UI test for LoginActivity
2633
*/
2734
@RunWith(AndroidJUnit4::class)
2835
class LoginActivityTest {
29-
private val EMPTY_USERNAME_ERROR: String = "Username cannot be empty"
30-
private val EMPTY_PASSWORD_ERROR: String = "Password cannot be empty"
36+
private val EMPTY_USERNAME_ERROR = "Username cannot be empty"
37+
private val EMPTY_PASSWORD_ERROR = "Password cannot be empty"
38+
private val INCORRECT_CREDENTIALS_ERROR = "Username or password is incorrect."
3139

32-
private val TEST_USERNAME: String = "test user"
33-
private val TEST_PASSWORD: String = "test password"
40+
private val INCORRECT_TEST_USERNAME = "blah"
41+
private val INCORRECT_TEST_PASSWORD = "blah"
42+
43+
private val CORRECT_TEST_USERNAME = "testusername"
44+
private val CORRECT_TEST_PASSWORD = "test_pass"
3445

3546
@get:Rule
36-
var mActivityRule: ActivityTestRule<LoginActivity> = ActivityTestRule(LoginActivity::class.java)
47+
var activityRule = ActivityTestRule(LoginActivity::class.java)
48+
49+
@Rule
50+
@JvmField
51+
var intentsRule = IntentsTestRule(MainActivity::class.java)
3752

3853
private fun findEditTextInTextInputLayout(@IdRes textInputLayoutId : Int) : ViewInteraction {
3954

@@ -50,7 +65,7 @@ class LoginActivityTest {
5065
return object : TypeSafeMatcher<View>() {
5166
/**
5267
* Generates a description of the object. The description may be part of a
53-
* a description of a larger object of which this is just a component, so it
68+
* larger object of which this is just a component, so it
5469
* should be worded appropriately.
5570
*
5671
* @param description
@@ -84,17 +99,13 @@ class LoginActivityTest {
8499

85100
/**
86101
* This test checks that error messages are shown after the Login button is clicked
87-
* with empty username and password fields.
102+
* with:
103+
* username: EMPTY
104+
* password: EMPTY
88105
*/
89106
@Test
90107
fun testLoginButtonClickedWhenUsernameAndPasswordAreEmpty() {
91-
92-
// Type empty string in both the editTexts
93-
findEditTextInTextInputLayout(R.id.tiUsername).perform(typeText(""), closeSoftKeyboard())
94-
findEditTextInTextInputLayout(R.id.tiPassword).perform(typeText(""), closeSoftKeyboard())
95-
96-
// Perform Click operation on Login Button
97-
onView(withId(R.id.btnLogin)).perform(click())
108+
enterCredentials("", "")
98109

99110
// Checks that the error message in both the editTexts appears after button click
100111
onView(withId(R.id.tiUsername)).check(matches(hasTextInputLayoutErrorText(EMPTY_USERNAME_ERROR)))
@@ -104,41 +115,106 @@ class LoginActivityTest {
104115

105116
/**
106117
* This test checks that error messages are shown after the Login button is clicked
107-
* with empty username and a password.
118+
* with:
119+
* username: EMPTY
120+
* password: PRESENT
108121
*/
109122
@Test
110123
fun testLoginButtonClickedWhenUsernameIsEmptyAndPasswordIsFilled() {
111-
// Type in no username
112-
findEditTextInTextInputLayout(R.id.tiUsername).perform(typeText(""), closeSoftKeyboard())
113-
114-
// Type in a password
115-
findEditTextInTextInputLayout(R.id.tiPassword).perform(typeText(TEST_PASSWORD), closeSoftKeyboard())
116-
117-
// Perform Click operation on Login Button
118-
onView(withId(R.id.btnLogin)).perform(click())
124+
enterCredentials("", CORRECT_TEST_PASSWORD)
119125

120126
// Check for error message on username and not on password
121127
onView(withId(R.id.tiUsername)).check(matches(hasTextInputLayoutErrorText(EMPTY_USERNAME_ERROR)))
122128
onView(withId(R.id.tiPassword)).check(matches(not(hasTextInputLayoutErrorText(EMPTY_PASSWORD_ERROR))))
123129
}
124130

125131
/**
126-
* This test checks that error messages are shown after the Login button is clicked
127-
* with a username and an empty password.
132+
* This test checks that error messages are shown after the Login button is clicked
133+
* with:
134+
* username: PRESENT, correct
135+
* password: EMPTY
128136
*/
129137
@Test
130138
fun testLoginButtonClickedWhenUsernameIsFilledAndPasswordIsEmpty() {
131-
// Type in a username
132-
findEditTextInTextInputLayout(R.id.tiUsername).perform(typeText(TEST_USERNAME), closeSoftKeyboard())
133-
134-
// Type in no password
135-
findEditTextInTextInputLayout(R.id.tiPassword).perform(typeText(""), closeSoftKeyboard())
136-
137-
// Perform Click operation on Login Button
138-
onView(withId(R.id.btnLogin)).perform(click())
139+
enterCredentials(CORRECT_TEST_USERNAME, "")
139140

140141
// Check for no error message on username with an error message on password
141142
onView(withId(R.id.tiUsername)).check(matches(not(hasTextInputLayoutErrorText(EMPTY_USERNAME_ERROR))))
142143
onView(withId(R.id.tiPassword)).check(matches(hasTextInputLayoutErrorText(EMPTY_PASSWORD_ERROR)))
143144
}
145+
146+
/**
147+
* This test checks that error messages are shown after the Login button is clicked
148+
* with:
149+
* username: PRESENT, incorrect
150+
* password: PRESENT, incorrect
151+
*/
152+
@Test
153+
fun testLoginButtonClickedWhenDataIsIncorrect() {
154+
enterCredentials(INCORRECT_TEST_USERNAME, INCORRECT_TEST_PASSWORD)
155+
156+
// Verify that a Snackbar with a proper message is shown
157+
onView(withId(com.google.android.material.R.id.snackbar_text))
158+
.check(matches(withText("Username or password is wrong.")))
159+
}
160+
161+
/**
162+
* This test checks that the MainActivity is started when the credentials entered
163+
* by the user are correct.
164+
* username: PRESENT
165+
* password: PRESENT
166+
*/
167+
@Test
168+
fun testLoginButtonClickedWhenDataIsCorrect() {
169+
enterCredentials(CORRECT_TEST_USERNAME, CORRECT_TEST_PASSWORD)
170+
171+
// Verify that MainActivity is started
172+
intended(hasComponent(
173+
ComponentName(InstrumentationRegistry.getInstrumentation().context, MainActivity::class.java))
174+
)
175+
}
176+
177+
/**
178+
* This test checks that the Snackbar with an error message is shown after the Login
179+
* button is clicked with:
180+
* username: PRESENT, incorrect
181+
* password: PRESENT, correct
182+
*/
183+
@Test
184+
fun testLoginButtonWhenOnlyUsernameIsIncorrect() {
185+
enterCredentials(INCORRECT_TEST_USERNAME, CORRECT_TEST_PASSWORD)
186+
187+
// Verify that a Snackbar with a proper message is shown
188+
onView(withId(com.google.android.material.R.id.snackbar_text))
189+
.check(matches(withText("Username or password is wrong.")))
190+
}
191+
192+
/**
193+
* This test checks that the Snackbar with an error message is shown after the Login
194+
* button is clicked with:
195+
* username: PRESENT, correct
196+
* password: PRESENT, incorrect
197+
*/
198+
@Test
199+
fun testLoginButtonWhenOnlyPasswordIsIncorrect() {
200+
enterCredentials(CORRECT_TEST_USERNAME, INCORRECT_TEST_PASSWORD)
201+
202+
// Verify that a Snackbar with a proper message is shown
203+
onView(withId(com.google.android.material.R.id.snackbar_text))
204+
.check(matches(withText(INCORRECT_CREDENTIALS_ERROR)))
205+
}
206+
207+
/**
208+
* Convenience method which enters credentials and click on the Login Button.
209+
*/
210+
private fun enterCredentials(username: String, password: String) {
211+
// Type in a username
212+
findEditTextInTextInputLayout(R.id.tiUsername).perform(typeText(username), closeSoftKeyboard())
213+
214+
// Type in a password
215+
findEditTextInTextInputLayout(R.id.tiPassword).perform(typeText(password), closeSoftKeyboard())
216+
217+
// Perform a click on the Login Button
218+
onView(withId(R.id.btnLogin)).perform(click())
219+
}
144220
}

0 commit comments

Comments
 (0)