-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/run-ios-test-on-ci
- Loading branch information
Showing
24 changed files
with
871 additions
and
461 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
...sting/src/main/java/io/github/droidkaigi/confsched2023/testing/robot/SearchScreenRobot.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package io.github.droidkaigi.confsched2023.testing.robot | ||
|
||
import androidx.compose.ui.test.hasTestTag | ||
import androidx.compose.ui.test.isRoot | ||
import androidx.compose.ui.test.junit4.AndroidComposeTestRule | ||
import androidx.compose.ui.test.onFirst | ||
import androidx.compose.ui.test.onLast | ||
import androidx.compose.ui.test.performClick | ||
import androidx.compose.ui.test.performTouchInput | ||
import androidx.compose.ui.test.swipeLeft | ||
import com.github.takahirom.roborazzi.captureRoboImage | ||
import io.github.droidkaigi.confsched2023.designsystem.theme.KaigiTheme | ||
import io.github.droidkaigi.confsched2023.sessions.SearchScreen | ||
import io.github.droidkaigi.confsched2023.sessions.SearchScreenTestTag | ||
import io.github.droidkaigi.confsched2023.sessions.component.DropdownFilterChipItemTestTag | ||
import io.github.droidkaigi.confsched2023.sessions.section.SearchFilterTestTag | ||
import io.github.droidkaigi.confsched2023.testing.RobotTestRule | ||
import io.github.droidkaigi.confsched2023.testing.coroutines.runTestWithLogging | ||
import kotlinx.coroutines.test.TestDispatcher | ||
import javax.inject.Inject | ||
import kotlin.time.Duration.Companion.seconds | ||
|
||
class SearchScreenRobot @Inject constructor( | ||
private val testDispatcher: TestDispatcher, | ||
) { | ||
@Inject lateinit var robotTestRule: RobotTestRule | ||
|
||
private lateinit var composeTestRule: AndroidComposeTestRule<*, *> | ||
|
||
operator fun invoke( | ||
block: SearchScreenRobot.() -> Unit, | ||
) { | ||
runTestWithLogging(timeout = 30.seconds) { | ||
this@SearchScreenRobot.composeTestRule = robotTestRule.composeTestRule | ||
block() | ||
} | ||
} | ||
|
||
fun setupSearchScreenContent() { | ||
composeTestRule.setContent { | ||
KaigiTheme { | ||
SearchScreen( | ||
onBackClick = {}, | ||
onTimetableItemClick = {}, | ||
) | ||
} | ||
} | ||
waitUntilIdle() | ||
} | ||
|
||
fun clickFilterChip(filterChipTestTag: String) { | ||
composeTestRule | ||
.onNode(hasTestTag(filterChipTestTag)) | ||
.performClick() | ||
waitUntilIdle() | ||
} | ||
|
||
fun scrollSearchFilterToLeft() { | ||
composeTestRule | ||
.onNode(hasTestTag(SearchFilterTestTag)) | ||
.performTouchInput { | ||
swipeLeft( | ||
startX = visibleSize.width.toFloat(), | ||
endX = visibleSize.width / 2f, | ||
) | ||
} | ||
} | ||
|
||
fun clickFirstDropdownMenuItem() { | ||
composeTestRule | ||
.onAllNodes(hasTestTag(DropdownFilterChipItemTestTag)) | ||
.onFirst() | ||
.performClick() | ||
waitUntilIdle() | ||
} | ||
|
||
fun clickLastDropdownMenuItem() { | ||
composeTestRule | ||
.onAllNodes(hasTestTag(DropdownFilterChipItemTestTag)) | ||
.onLast() | ||
.performClick() | ||
waitUntilIdle() | ||
} | ||
|
||
fun checkScreenCapture() { | ||
composeTestRule | ||
.onNode(isRoot()) | ||
.captureRoboImage() | ||
} | ||
|
||
fun checkSearchScreenCapture() { | ||
composeTestRule | ||
.onNode(hasTestTag(SearchScreenTestTag)) | ||
.captureRoboImage() | ||
} | ||
|
||
fun waitUntilIdle() { | ||
composeTestRule.waitForIdle() | ||
testDispatcher.scheduler.advanceUntilIdle() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
.../droidkaigi/confsched2023/floormap/component/PreviewFloorMapSwitcherFloorLevelProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.github.droidkaigi.confsched2023.floormap.component | ||
|
||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider | ||
import io.github.droidkaigi.confsched2023.model.FloorLevel | ||
|
||
class PreviewFloorMapSwitcherFloorLevelProvider : PreviewParameterProvider<FloorLevel> { | ||
override val values: Sequence<FloorLevel> | ||
get() = FloorLevel.values().asSequence() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.