-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📝 The robots were separated according to their roles.
- Loading branch information
Showing
4 changed files
with
266 additions
and
185 deletions.
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
.../main/java/io/github/droidkaigi/confsched/testing/robot/action/SearchScreenActionRobot.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,115 @@ | ||
package io.github.droidkaigi.confsched.testing.robot.action | ||
|
||
import androidx.compose.ui.test.filter | ||
import androidx.compose.ui.test.hasTestTag | ||
import androidx.compose.ui.test.hasText | ||
import androidx.compose.ui.test.onFirst | ||
import androidx.compose.ui.test.onNodeWithTag | ||
import androidx.compose.ui.test.performClick | ||
import androidx.compose.ui.test.performScrollToNode | ||
import androidx.compose.ui.test.performTextInput | ||
import io.github.droidkaigi.confsched.droidkaigiui.Inject | ||
import io.github.droidkaigi.confsched.sessions.component.DropdownFilterChipTestTagPrefix | ||
import io.github.droidkaigi.confsched.sessions.component.SearchFiltersFilterCategoryChipTestTag | ||
import io.github.droidkaigi.confsched.sessions.component.SearchFiltersFilterDayChipTestTag | ||
import io.github.droidkaigi.confsched.sessions.component.SearchFiltersFilterLanguageChipTestTag | ||
import io.github.droidkaigi.confsched.sessions.component.SearchFiltersLazyRowTestTag | ||
import io.github.droidkaigi.confsched.sessions.component.SearchTextFieldAppBarTextFieldTestTag | ||
import io.github.droidkaigi.confsched.testing.robot.DefaultScreenRobot | ||
import io.github.droidkaigi.confsched.testing.robot.ScreenRobot | ||
import io.github.droidkaigi.confsched.testing.robot.core.SearchScreenCoreRobot.Category | ||
import io.github.droidkaigi.confsched.testing.robot.core.SearchScreenCoreRobot.ConferenceDay | ||
import io.github.droidkaigi.confsched.testing.robot.TimetableItemCardRobot.Language | ||
import io.github.droidkaigi.confsched.testing.robot.core.DemoSearchWord | ||
import io.github.droidkaigi.confsched.testing.utils.hasTestTag | ||
|
||
class SearchScreenActionRobot @Inject constructor( | ||
private val screenRobot: DefaultScreenRobot, | ||
) : ScreenRobot by screenRobot { | ||
fun inputDemoSearchWord() { | ||
inputSearchWord(DemoSearchWord) | ||
} | ||
|
||
private fun inputSearchWord(text: String) { | ||
composeTestRule | ||
.onNodeWithTag(SearchTextFieldAppBarTextFieldTestTag) | ||
.performTextInput(text) | ||
waitUntilIdle() | ||
} | ||
|
||
fun scrollToFilterLanguageChip() { | ||
composeTestRule | ||
.onNode(hasTestTag(SearchFiltersLazyRowTestTag)) | ||
.performScrollToNode(hasTestTag(SearchFiltersFilterLanguageChipTestTag)) | ||
waitUntilIdle() | ||
} | ||
|
||
fun clickFilterDayChip() { | ||
composeTestRule | ||
.onNode(hasTestTag(SearchFiltersFilterDayChipTestTag)) | ||
.performClick() | ||
waitUntilIdle() | ||
} | ||
|
||
fun clickFilterCategoryChip() { | ||
composeTestRule | ||
.onNode(hasTestTag(SearchFiltersFilterCategoryChipTestTag)) | ||
.performClick() | ||
waitUntilIdle() | ||
} | ||
|
||
fun clickFilterLanguageChip() { | ||
composeTestRule | ||
.onNode(hasTestTag(SearchFiltersFilterLanguageChipTestTag)) | ||
.performClick() | ||
waitUntilIdle() | ||
} | ||
|
||
fun clickConferenceDay( | ||
clickDay: ConferenceDay, | ||
) { | ||
composeTestRule | ||
.onAllNodes( | ||
hasTestTag( | ||
testTag = DropdownFilterChipTestTagPrefix, | ||
substring = true, | ||
), | ||
) | ||
.filter(matcher = hasText(clickDay.dateText)) | ||
.onFirst() | ||
.performClick() | ||
waitUntilIdle() | ||
} | ||
|
||
fun clickCategory( | ||
category: Category, | ||
) { | ||
composeTestRule | ||
.onAllNodes( | ||
hasTestTag( | ||
testTag = DropdownFilterChipTestTagPrefix, | ||
substring = true, | ||
), | ||
) | ||
.filter(matcher = hasText(category.categoryName)) | ||
.onFirst() | ||
.performClick() | ||
waitUntilIdle() | ||
} | ||
|
||
fun clickLanguage( | ||
language: Language, | ||
) { | ||
composeTestRule | ||
.onAllNodes( | ||
hasTestTag( | ||
testTag = DropdownFilterChipTestTagPrefix, | ||
substring = true, | ||
), | ||
) | ||
.filter(matcher = hasText(language.tagName)) | ||
.onFirst() | ||
.performClick() | ||
waitUntilIdle() | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
.../src/main/java/io/github/droidkaigi/confsched/testing/robot/core/SearchScreenCoreRobot.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,58 @@ | ||
package io.github.droidkaigi.confsched.testing.robot.core | ||
|
||
import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme | ||
import io.github.droidkaigi.confsched.droidkaigiui.Inject | ||
import io.github.droidkaigi.confsched.sessions.SearchScreen | ||
import io.github.droidkaigi.confsched.testing.robot.DefaultDeviceSetupRobot | ||
import io.github.droidkaigi.confsched.testing.robot.DefaultScreenRobot | ||
import io.github.droidkaigi.confsched.testing.robot.DefaultTimetableItemCardRobot | ||
import io.github.droidkaigi.confsched.testing.robot.DefaultTimetableServerRobot | ||
import io.github.droidkaigi.confsched.testing.robot.DeviceSetupRobot | ||
import io.github.droidkaigi.confsched.testing.robot.ScreenRobot | ||
import io.github.droidkaigi.confsched.testing.robot.action.SearchScreenActionRobot | ||
import io.github.droidkaigi.confsched.testing.robot.verify.SearchScreenVerifyRobot | ||
import io.github.droidkaigi.confsched.testing.robot.TimetableItemCardRobot | ||
import io.github.droidkaigi.confsched.testing.robot.TimetableServerRobot | ||
|
||
const val DemoSearchWord = "Demo" | ||
|
||
class SearchScreenCoreRobot @Inject constructor( | ||
private val screenRobot: DefaultScreenRobot, | ||
private val timetableServerRobot: DefaultTimetableServerRobot, | ||
private val deviceSetupRobot: DefaultDeviceSetupRobot, | ||
timetableItemRobot: DefaultTimetableItemCardRobot, | ||
) : ScreenRobot by screenRobot, | ||
TimetableServerRobot by timetableServerRobot, | ||
DeviceSetupRobot by deviceSetupRobot, | ||
TimetableItemCardRobot by timetableItemRobot { | ||
@Inject lateinit var actionRobot: SearchScreenActionRobot | ||
@Inject lateinit var verifyRobot: SearchScreenVerifyRobot | ||
|
||
enum class ConferenceDay( | ||
val day: Int, | ||
val dateText: String, | ||
) { | ||
Day1(1, "9/12"), | ||
Day2(2, "9/13"), | ||
} | ||
|
||
enum class Category( | ||
val categoryName: String, | ||
) { | ||
AppArchitecture("App Architecture en"), | ||
JetpackCompose("Jetpack Compose en"), | ||
Other("Other en"), | ||
} | ||
|
||
fun setupSearchScreenContent() { | ||
robotTestRule.setContent { | ||
KaigiTheme { | ||
SearchScreen( | ||
onTimetableItemClick = {}, | ||
onBackClick = {}, | ||
) | ||
} | ||
} | ||
waitUntilIdle() | ||
} | ||
} |
144 changes: 8 additions & 136 deletions
144
...fsched/testing/robot/SearchScreenRobot.kt → ...g/robot/verify/SearchScreenVerifyRobot.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
Oops, something went wrong.