-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from DroidKaigi/feature/implement-about
Implement about screen roughly
- Loading branch information
Showing
21 changed files
with
1,245 additions
and
1 deletion.
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
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
49 changes: 49 additions & 0 deletions
49
core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/AboutScreenRobot.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,49 @@ | ||
package io.github.droidkaigi.confsched.testing.robot | ||
|
||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.hasTestTag | ||
import io.github.droidkaigi.confsched.about.AboutScreen | ||
import io.github.droidkaigi.confsched.about.AboutTestTag | ||
import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme | ||
import io.github.droidkaigi.confsched.testing.DefaultScreenRobot | ||
import io.github.droidkaigi.confsched.testing.ScreenRobot | ||
import javax.inject.Inject | ||
|
||
class AboutScreenRobot @Inject constructor( | ||
screenRobot: DefaultScreenRobot, | ||
) : ScreenRobot by screenRobot { | ||
fun setupScreenContent() { | ||
robotTestRule.setContent { | ||
KaigiTheme { | ||
AboutScreen( | ||
onAboutItemClick = {}, | ||
) | ||
} | ||
} | ||
waitUntilIdle() | ||
} | ||
|
||
fun checkDetailScreenDisplayed() { | ||
composeTestRule | ||
.onNode(hasTestTag(AboutTestTag.DetailScreen.SCREEN)) | ||
.assertIsDisplayed() | ||
} | ||
|
||
fun checkCreditsScreenDisplayed() { | ||
composeTestRule | ||
.onNode(hasTestTag(AboutTestTag.CreditsScreen.SCREEN)) | ||
.assertIsDisplayed() | ||
} | ||
|
||
fun checkOthersScreenDisplayed() { | ||
composeTestRule | ||
.onNode(hasTestTag(AboutTestTag.OthersScreen.SCREEN)) | ||
.assertIsDisplayed() | ||
} | ||
|
||
fun checkFooterLinksScreenDisplayed() { | ||
composeTestRule | ||
.onNode(hasTestTag(AboutTestTag.FooterLinksScreen.SCREEN)) | ||
.assertIsDisplayed() | ||
} | ||
} |
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 @@ | ||
/build |
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,30 @@ | ||
plugins { | ||
id("droidkaigi.convention.kmpfeature") | ||
} | ||
|
||
android.namespace = "io.github.droidkaigi.confsched.feature.about" | ||
roborazzi.generateComposePreviewRobolectricTests.packages = listOf("io.github.droidkaigi.confsched.about") | ||
kotlin { | ||
sourceSets { | ||
commonMain { | ||
dependencies { | ||
implementation(projects.core.designsystem) | ||
implementation(projects.core.ui) | ||
implementation(projects.core.model) | ||
|
||
implementation(libs.composeNavigation) | ||
implementation(compose.materialIconsExtended) | ||
} | ||
} | ||
androidTarget { | ||
dependencies { | ||
implementation(libs.composeMaterialWindowSize) | ||
} | ||
} | ||
androidUnitTest { | ||
dependencies { | ||
implementation(projects.core.testing) | ||
} | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
.../about/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/about/AboutScreenTest.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,57 @@ | ||
package io.github.droidkaigi.confsched.about | ||
|
||
import dagger.hilt.android.testing.BindValue | ||
import dagger.hilt.android.testing.HiltAndroidTest | ||
import io.github.droidkaigi.confsched.testing.DescribedBehavior | ||
import io.github.droidkaigi.confsched.testing.RobotTestRule | ||
import io.github.droidkaigi.confsched.testing.describeBehaviors | ||
import io.github.droidkaigi.confsched.testing.execute | ||
import io.github.droidkaigi.confsched.testing.robot.AboutScreenRobot | ||
import io.github.droidkaigi.confsched.testing.runRobot | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.robolectric.ParameterizedRobolectricTestRunner | ||
import javax.inject.Inject | ||
|
||
@RunWith(ParameterizedRobolectricTestRunner::class) | ||
@HiltAndroidTest | ||
class AboutScreenTest( | ||
private val testCase: DescribedBehavior<AboutScreenRobot>, | ||
) { | ||
|
||
@get:Rule | ||
@BindValue | ||
val robotTestRule: RobotTestRule = RobotTestRule(this) | ||
|
||
@Inject | ||
lateinit var aboutScreenRobot: AboutScreenRobot | ||
|
||
@Test | ||
fun runTest() { | ||
runRobot(aboutScreenRobot) { | ||
testCase.execute(aboutScreenRobot) | ||
} | ||
} | ||
|
||
companion object { | ||
@JvmStatic | ||
@ParameterizedRobolectricTestRunner.Parameters(name = "{0}") | ||
fun behaviors(): List<DescribedBehavior<AboutScreenRobot>> { | ||
return describeBehaviors("AboutScreen") { | ||
describe("when launch") { | ||
run { | ||
captureScreenWithChecks { | ||
setupScreenContent() | ||
} | ||
} | ||
itShould("show detail screen") { | ||
captureScreenWithChecks { | ||
checkDetailScreenDisplayed() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
feature/about/src/androidUnitTest/resources/robolectric.properties
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,7 @@ | ||
sdk=34 | ||
# RobolectricDeviceQualifiers.NexusOne | ||
qualifiers=w320dp-h533dp-normal-long-notround-any-hdpi-keyshidden-trackball | ||
|
||
application=dagger.hilt.android.testing.HiltTestApplication | ||
# https://github.com/robolectric/robolectric/issues/6593 | ||
instrumentedPackages=androidx.loader.content |
Oops, something went wrong.