Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle committed Mar 14, 2024
1 parent 65c82e3 commit e67f19e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.test.platform.app.InstrumentationRegistry
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
import im.vector.app.R
import im.vector.app.core.resources.BooleanProvider
import im.vector.app.core.resources.DefaultAppNameProvider
import im.vector.app.core.resources.StringArrayProvider
import im.vector.app.espresso.tools.waitUntilViewVisible
import im.vector.app.features.DefaultVectorFeatures
Expand All @@ -33,7 +34,8 @@ class NewRoomRobot(
private val labsPreferences: LabFeaturesPreferences
) {
private val context = InstrumentationRegistry.getInstrumentation().targetContext
private val features: VectorFeatures = DefaultVectorFeatures(StringArrayProvider(context.resources), BooleanProvider(context.resources))
private val features: VectorFeatures =
DefaultVectorFeatures(DefaultAppNameProvider(context), StringArrayProvider(context.resources), BooleanProvider(context.resources))

fun createNewRoom(block: CreateNewRoomRobot.() -> Unit) {
clickOn(R.string.create_new_room)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
import com.adevinta.android.barista.interaction.BaristaEditTextInteractions.writeTo
import im.vector.app.R
import im.vector.app.core.resources.BooleanProvider
import im.vector.app.core.resources.DefaultAppNameProvider
import im.vector.app.core.resources.StringArrayProvider
import im.vector.app.espresso.tools.waitUntilViewVisible
import im.vector.app.features.DefaultVectorFeatures
Expand All @@ -42,7 +43,10 @@ class OnboardingRobot {
// Tchap: Override default feature values for tests
private val context = InstrumentationRegistry.getInstrumentation().targetContext
private val defaultVectorFeatures =
DebugVectorFeatures(context, DefaultVectorFeatures(StringArrayProvider(context.resources), BooleanProvider(context.resources))).apply {
DebugVectorFeatures(
context,
DefaultVectorFeatures(DefaultAppNameProvider(context), StringArrayProvider(context.resources), BooleanProvider(context.resources))
).apply {
override(true, DebugFeatureKeys.tchapIsKeyBackupEnabled)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import com.adevinta.android.barista.interaction.BaristaDrawerInteractions.openDr
import com.adevinta.android.barista.internal.viewaction.ClickChildAction
import im.vector.app.R
import im.vector.app.core.resources.BooleanProvider
import im.vector.app.core.resources.DefaultAppNameProvider
import im.vector.app.core.resources.StringArrayProvider
import im.vector.app.espresso.tools.waitUntilDialogVisible
import im.vector.app.espresso.tools.waitUntilViewVisible
Expand All @@ -38,7 +39,8 @@ import org.hamcrest.Matchers

class SpaceRobot(private val labsPreferences: LabFeaturesPreferences) {
private val context = InstrumentationRegistry.getInstrumentation().targetContext
private val features: VectorFeatures = DefaultVectorFeatures(StringArrayProvider(context.resources), BooleanProvider(context.resources))
private val features: VectorFeatures =
DefaultVectorFeatures(DefaultAppNameProvider(context), StringArrayProvider(context.resources), BooleanProvider(context.resources))

fun createSpace(isFirstSpace: Boolean, block: SpaceCreateRobot.() -> Unit) {
if (labsPreferences.isNewAppLayoutEnabled) {
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.platform.app.InstrumentationRegistry
import im.vector.app.TestBuildVersionSdkIntProvider
import im.vector.app.core.resources.BooleanProvider
import im.vector.app.core.resources.DefaultAppNameProvider
import im.vector.app.core.resources.StringArrayProvider
import im.vector.app.features.DefaultVectorFeatures
import io.mockk.every
Expand All @@ -34,7 +35,7 @@ class VoiceRecorderProviderTests {
private val provider = spyk(
VoiceRecorderProvider(
context,
DefaultVectorFeatures(StringArrayProvider(context.resources), BooleanProvider(context.resources)),
DefaultVectorFeatures(DefaultAppNameProvider(context),StringArrayProvider(context.resources), BooleanProvider(context.resources)),
buildVersionSdkIntProvider
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import io.mockk.every
import io.mockk.mockk
import io.mockk.spyk

class FakeVectorFeatures : VectorFeatures by spyk(DefaultVectorFeatures(mockk(), mockk())) {
class FakeVectorFeatures : VectorFeatures by spyk(DefaultVectorFeatures(mockk(), mockk(), mockk())) {

fun givenPersonalisationEnabled() {
every { isOnboardingPersonalizeEnabled() } returns true
Expand Down

0 comments on commit e67f19e

Please sign in to comment.