add login and board_list #26
@ -68,11 +68,10 @@ dependencies {
|
||||
testImplementation "com.squareup.okhttp3:mockwebserver:4.2.1"
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
|
||||
androidTestImplementation 'androidx.test:runner:1.2.0'
|
||||
androidTestImplementation 'androidx.test:rules:1.2.0'
|
||||
|
||||
|
||||
|
||||
implementation "com.squareup.retrofit2:retrofit:2.6.2"
|
||||
implementation "com.squareup.retrofit2:converter-gson:2.6.2"
|
||||
|
||||
|
@ -0,0 +1,52 @@
|
||||
package it.unisannio.ding.ids.wedroid.app.view
|
||||
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.action.ViewActions.swipeDown
|
||||
import androidx.test.espresso.action.ViewActions.swipeLeft
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.contrib.RecyclerViewActions
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import it.unisannio.ding.ids.wedroid.app.R
|
||||
import it.unisannio.ding.ids.wedroid.app.view.adapter.BoardsListAdapter
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@LargeTest
|
||||
class BoardsListsActivityTest {
|
||||
|
||||
@get:Rule
|
||||
val activityRule = ActivityTestRule(BoardsListsActivity::class.java)
|
||||
|
||||
fun swipeLeftToDelete() {
|
||||
onView(withId(R.id.boardList))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItemAtPosition<BoardsListAdapter.BoardViewHolder>(
|
||||
0, swipeLeft()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun pullToRefresh() {
|
||||
onView(withId(R.id.pullToRefresh))
|
||||
.perform(swipeDown())
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
fun openNewBoardActivity() {
|
||||
onView(withId(R.id.fab))
|
||||
.perform(click())
|
||||
|
||||
onView(withId(R.id.newBoardName))
|
||||
.check(matches(isDisplayed()))
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
package it.unisannio.ding.ids.wedroid.app.view
|
||||
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.RootMatchers.withDecorView
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import it.unisannio.ding.ids.wedroid.app.R
|
||||
import org.hamcrest.core.IsNot.not
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@LargeTest
|
||||
class NewBoardActivityTest {
|
||||
|
||||
@get:Rule
|
||||
val activityRule = ActivityTestRule(NewBoardActivity::class.java)
|
||||
|
||||
@Test
|
||||
fun showToastOnEmptyName() {
|
||||
onView(withId(R.id.newBoardDone))
|
||||
.perform(click())
|
||||
|
||||
onView(withText(R.string.on_add_new_board_empty_name))
|
||||
.inRoot(withDecorView(not(activityRule.activity.window.decorView)))
|
||||
.check(matches(isDisplayed()))
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import androidx.appcompat.widget.Toolbar;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Switch;
|
||||
import android.widget.Toast;
|
||||
|
||||
import it.unisannio.ding.ids.wedroid.app.R;
|
||||
|
||||
@ -28,6 +29,12 @@ public class NewBoardActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
public void onDone(View v) {
|
||||
if (boardName.getText().toString().equals("")) {
|
||||
Toast.makeText(this, R.string.on_add_new_board_empty_name, Toast.LENGTH_LONG)
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
|
||||
Intent data = new Intent();
|
||||
data.putExtra(BOARD_NAME, boardName.getText().toString());
|
||||
data.putExtra(BOARD_PRIVATE, isPrivate.isChecked());
|
||||
|
@ -33,6 +33,9 @@ class BoardsListAdapter internal constructor(
|
||||
|
||||
override fun onBindViewHolder(holder: BoardViewHolder, position: Int) {
|
||||
val board = boards[position]
|
||||
holder.itemView.setOnClickListener {
|
||||
// TODO start board activity
|
||||
}
|
||||
holder.boardTitle.text = board.title
|
||||
}
|
||||
|
||||
|
9
app/src/main/res/drawable/ic_add_black_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_add_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||
</vector>
|
@ -28,6 +28,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:srcCompat="@android:drawable/ic_dialog_email" />
|
||||
app:srcCompat="@drawable/ic_add_black_24dp" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -8,4 +8,5 @@
|
||||
<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="on_add_new_board_empty_name">Name cannot be empty</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user