add login and board_list #26
@ -32,7 +32,7 @@ class LoginActivityTest {
|
||||
onView(withId(R.id.button))
|
||||
.perform(click())
|
||||
|
||||
onView(withText("Riempire tutti i campi"))
|
||||
onView(withText(R.string.login_empty_field))
|
||||
.inRoot(withDecorView(not(activityRule.activity.window.decorView)))
|
||||
.check(matches(isDisplayed()))
|
||||
}
|
||||
@ -40,13 +40,14 @@ class LoginActivityTest {
|
||||
@Test
|
||||
fun loginWithEmptyUsername() {
|
||||
onView(withId(R.id.instanceServer))
|
||||
.perform(typeText("instanceServer"))
|
||||
.perform(typeText("https://wekan.com"))
|
||||
onView(withId(R.id.password))
|
||||
.perform(typeText("password"))
|
||||
closeSoftKeyboard()
|
||||
onView(withId(R.id.button))
|
||||
.perform(click())
|
||||
onView(withText("Riempire tutti i campi"))
|
||||
|
||||
onView(withText(R.string.login_empty_field))
|
||||
.inRoot(withDecorView(not(activityRule.activity.window.decorView)))
|
||||
.check(matches(isDisplayed()))
|
||||
|
||||
@ -55,15 +56,32 @@ class LoginActivityTest {
|
||||
@Test
|
||||
fun loginWithEmptyPassword() {
|
||||
onView(withId(R.id.instanceServer))
|
||||
.perform(typeText("instanceServer"))
|
||||
.perform(typeText("https://wekan.com"))
|
||||
onView(withId(R.id.username))
|
||||
.perform(typeText("username"))
|
||||
closeSoftKeyboard()
|
||||
onView(withId(R.id.button))
|
||||
.perform(click())
|
||||
onView(withText("Riempire tutti i campi"))
|
||||
|
||||
onView(withText(R.string.login_empty_field))
|
||||
.inRoot(withDecorView(not(activityRule.activity.window.decorView)))
|
||||
.check(matches(isDisplayed()))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun loginWithUnformedInstance(){
|
||||
onView(withId(R.id.instanceServer))
|
||||
.perform(typeText("not an URL"))
|
||||
onView(withId(R.id.username))
|
||||
.perform(typeText("username"))
|
||||
onView(withId(R.id.password))
|
||||
.perform(typeText("password"))
|
||||
closeSoftKeyboard()
|
||||
onView(withId(R.id.button))
|
||||
.perform(click())
|
||||
|
||||
onView(withText(R.string.login_unformed_instance))
|
||||
.inRoot(withDecorView(not(activityRule.activity.window.decorView)))
|
||||
.check(matches(isDisplayed()))
|
||||
}
|
||||
|
||||
}
|
@ -33,7 +33,7 @@ class LoginActivity : AppCompatActivity() {
|
||||
|
||||
fun loginButton(v: View) {
|
||||
if (username.text.isBlank() || instanceServer.text.isBlank() || password.text.isBlank()) {
|
||||
Toast.makeText(this, "Riempire tutti i campi", Toast.LENGTH_LONG)
|
||||
Toast.makeText(this, R.string.login_empty_field, Toast.LENGTH_LONG)
|
||||
.show()
|
||||
return
|
||||
}
|
||||
@ -43,9 +43,9 @@ class LoginActivity : AppCompatActivity() {
|
||||
val instanceServerText = instanceServer.text.toString()
|
||||
|
||||
if (!URLUtil.isValidUrl(instanceServerText)){
|
||||
Toast.makeText(this, "Formato URL non valido", Toast.LENGTH_LONG)
|
||||
Toast.makeText(this, R.string.login_unformed_instance, Toast.LENGTH_LONG)
|
||||
.show()
|
||||
return
|
||||
return
|
||||
}
|
||||
|
||||
val service = Retrofit.Builder()
|
||||
@ -58,7 +58,7 @@ class LoginActivity : AppCompatActivity() {
|
||||
override fun onFailure(call: Call<UserPrototype>, t: Throwable) {
|
||||
Toast.makeText(
|
||||
applicationContext,
|
||||
"Controlla la tua connessione internet",
|
||||
R.string.login_network_error,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
@ -68,7 +68,7 @@ class LoginActivity : AppCompatActivity() {
|
||||
if (response.code() != 200) {
|
||||
Toast.makeText(
|
||||
applicationContext,
|
||||
"Credenziali non corrette",
|
||||
R.string.login_wrong_field,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
return
|
||||
@ -80,7 +80,7 @@ class LoginActivity : AppCompatActivity() {
|
||||
|
||||
Toast.makeText(
|
||||
applicationContext,
|
||||
"Login effettuato con successo",
|
||||
R.string.login_success,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
|
||||
|
@ -8,4 +8,9 @@
|
||||
<string name="new_board_done_button">Done</string>
|
||||
<string name="on_null_new_board_name">There was a problem with the name of the new board</string>
|
||||
<string name="on_add_new_board_error">It was not possible to add a new board</string>
|
||||
<string name="login_empty_field">Riempire tutti i campi</string>
|
||||
<string name="login_unformed_instance">Formato URL non valido</string>
|
||||
<string name="login_network_error">Controlla la tua connessione internet</string>
|
||||
<string name="login_wrong_field">Credenziali non corrette</string>
|
||||
<string name="login_success">Login effettuato con successo</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user