Skip to content

Commit

Permalink
[Student][6.7 hotfix] Fix for conferences group crash (#659)
Browse files Browse the repository at this point in the history
* [Student][6.7 hotfix] Fix for conferences group crash

* Revert "[Student][6.7 hotfix] Fix for conferences group crash"

This reverts commit 5aef896.

* [Student][6.7 hotfix] Fix for conferences group crash

* reduced group tests to one case each
  • Loading branch information
TrevorNeedham authored Mar 25, 2020
1 parent 0323a50 commit ccb6307
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/student/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ android {
applicationId "com.instructure.candroid"
minSdkVersion Versions.MIN_SDK
targetSdkVersion Versions.TARGET_SDK
versionCode = 207
versionCode = 208
versionName = '6.7.0'

vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import com.instructure.canvasapi2.models.CanvasContext
import com.instructure.canvasapi2.models.Conference
import com.instructure.canvasapi2.models.Course
import com.instructure.canvasapi2.models.Group
import com.instructure.student.espresso.StudentRenderTest
import com.instructure.student.mobius.conferences.conference_details.ui.ConferenceDetailsFragment
import com.instructure.student.mobius.conferences.conference_details.ui.ConferenceDetailsViewState
Expand All @@ -32,6 +33,7 @@ import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class ConferenceDetailsRenderTest : StudentRenderTest() {
private val canvasContext: CanvasContext = Course(id = 123L, name = "Test Course")
private val canvasContextGroup: CanvasContext = Group(id = 1337L, name = "Test Group")

private lateinit var baseState: ConferenceDetailsViewState
private lateinit var baseRecordingState: ConferenceRecordingViewState
Expand Down Expand Up @@ -182,6 +184,16 @@ class ConferenceDetailsRenderTest : StudentRenderTest() {
conferenceDetailsRenderPage.assertDisplaysRecording(recordingState)
}


@Test
fun displaysToolbarItemsWithGroup() {
val state = baseState
loadPageWithViewState(state, canvasContextGroup)

conferenceDetailsRenderPage.assertDisplaysToolbarTitle("Conference Details")
conferenceDetailsRenderPage.assertDisplaysToolbarSubtitle(canvasContextGroup.name!!)
}

private fun loadPageWithViewState(state: ConferenceDetailsViewState, canvasContext: CanvasContext) {
val emptyEffectRunner = object : WorkRunner {
override fun dispose() = Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.os.Build
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.instructure.canvasapi2.models.CanvasContext
import com.instructure.canvasapi2.models.Course
import com.instructure.canvasapi2.models.Group
import com.instructure.student.espresso.StudentRenderTest
import com.instructure.student.mobius.conferences.conference_list.ui.ConferenceListFragment
import com.instructure.student.mobius.conferences.conference_list.ui.ConferenceListItemViewState
Expand All @@ -31,6 +32,7 @@ import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class ConferenceListRenderTest : StudentRenderTest() {
private val canvasContext: CanvasContext = Course(id = 123L, name = "Test Course")
private val canvasContextGroup: CanvasContext = Group(id = 1337L, name = "Test Group")

@Test
fun displaysToolbarItems() {
Expand Down Expand Up @@ -117,6 +119,16 @@ class ConferenceListRenderTest : StudentRenderTest() {
conferenceListRenderPage.assertDisplaysListItems(itemStates)
}


@Test
fun displaysToolbarItemsWithGroup() {
val state = ConferenceListViewState.Loaded(isLaunchingInBrowser = false, itemStates = emptyList())
loadPageWithViewState(state, canvasContextGroup)
conferenceListRenderPage.assertDisplaysToolbarTitle("Conferences")
conferenceListRenderPage.assertDisplaysToolbarSubtitle(canvasContextGroup.name!!)
conferenceListRenderPage.assertDisplaysLaunching(false)
}

private fun loadPageWithViewState(state: ConferenceListViewState, canvasContext: CanvasContext) {
val emptyEffectRunner = object : WorkRunner {
override fun dispose() = Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import com.instructure.student.mobius.conferences.conference_details.*
class ConferenceDetailsFragment :
MobiusFragment<ConferenceDetailsModel, ConferenceDetailsEvent, ConferenceDetailsEffect, ConferenceDetailsView, ConferenceDetailsViewState>() {

val canvasContext by ParcelableArg<Course>(key = Const.CANVAS_CONTEXT)
val canvasContext by ParcelableArg<CanvasContext>(key = Const.CANVAS_CONTEXT)

val conference by ParcelableArg<Conference>(key = Const.CONFERENCE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import com.instructure.student.mobius.conferences.conference_list.ConferenceList
class ConferenceListFragment :
MobiusFragment<ConferenceListModel, ConferenceListEvent, ConferenceListEffect, ConferenceListView, ConferenceListViewState>() {

val canvasContext by ParcelableArg<Course>(key = Const.CANVAS_CONTEXT)
val canvasContext by ParcelableArg<CanvasContext>(key = Const.CANVAS_CONTEXT)

override fun makeUpdate() =
ConferenceListUpdate()
Expand Down

0 comments on commit ccb6307

Please sign in to comment.