Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<img width="3709" height="1071" alt="Kherkin Logo Text" src="https://github.com/user-attachments/assets/6104773a-a805-4fe0-91f7-d80b9724e997" />

# Kherkin

Kherkin ([Kotlin](https://kotlinlang.org/) + [Gherkin](https://cucumber.io/docs/gherkin/)) is an instrumentation testing framework that simplifies writing UI tests for Android. The Gherkin-like syntax makes it easier to build the test scenarios as a collaboration between developers and non-developers. Predefined step definitions allow for writing tests without having to fiddle with the [Espresso testing framework](https://developer.android.com/training/testing/espresso) or the [Jetpack Compose testing APIs](https://developer.android.com/develop/ui/compose/testing). Tests can start from any activity without navigating the entire application.
Expand Down Expand Up @@ -203,3 +205,7 @@ Please see the [contributing file](CONTRIBUTING.md) on how to contribute to this
## Code of Conduct

Help us make this project open and inclusive. Please follow our [Code of Conduct](CODE_OF_CONDUCT.md).

<p align="center">
<img width="320" height="320" alt="Kherkin Logo" src="https://github.com/user-attachments/assets/de27771f-f270-49d7-8ff8-39a95f6bd298" />
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class TestScrollSteps : SampleBaseIntegrationTestCase() {
fun testScrollOnNode() {
Given.IRenderScreen(BasicComposeScreen(), composeTestRule)
When.IScrollOnNodeUntillISee("Scroll Box", "Scroll Item 9", composeTestRule)
Then.IShouldSeeNodeWithText("Scroll Item 9", "Item 9", composeTestRule)
Then.IShouldSeeNodeWithText("Scroll Item 9", "Scroll item 9", composeTestRule)
}

@Test
fun testScrollOnNodeWithText() {
Given.IRenderScreen(BasicComposeScreen(), composeTestRule)
When.IScrollOnNodeUntillISeeText("Scroll Box", "Item 9", composeTestRule)
Then.IShouldSeeNodeWithText("Scroll Item 9", "Item 9", composeTestRule)
When.IScrollOnNodeUntillISeeText("Scroll Box", "Scroll item 9", composeTestRule)
Then.IShouldSeeNodeWithText("Scroll Item 9", "Scroll item 9", composeTestRule)
}
}
Binary file added sampleapp/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
Expand Down Expand Up @@ -35,6 +36,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.LinkAnnotation
Expand Down Expand Up @@ -92,6 +94,7 @@ fun SmallTopAppBar() {
ScrollBoxes()
NavigateButton()
Link()
Logo()
}
}
}
Expand Down Expand Up @@ -194,16 +197,16 @@ private fun TextFieldPrefilled() {
private fun ScrollBoxes() {
Column(
modifier = Modifier
.background(Color.LightGray)
.size(100.dp)
.padding(20.dp)
.size(120.dp)
.padding(10.dp, 4.dp)
.verticalScroll(rememberScrollState())
.background(Color.LightGray)
.testTag("Scroll Box")
) {
repeat(10) {
Text("Item $it",
Text("Scroll item $it",
modifier = Modifier
.padding(2.dp)
.padding(8.dp, 4.dp)
.testTag("Scroll Item $it")
)
}
Expand Down Expand Up @@ -260,6 +263,17 @@ private fun Link() {
}
}

@Composable
private fun Logo() {
Image(
painter = painterResource(id = R.drawable.kherkin_logo),
contentDescription = stringResource(id = R.string.kherkin_logo_content_description),
modifier = Modifier
.size(120.dp)
.testTag("Logo")
)
}

@Preview(showBackground = true)
@Composable
private fun DefaultPreview() {
Expand Down
56 changes: 29 additions & 27 deletions sampleapp/src/main/res/drawable/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
android:viewportWidth="1000"
android:viewportHeight="1000">
<group android:scaleX="0.71"
android:scaleY="0.71"
android:translateX="145"
android:translateY="145">>

<path android:fillColor="#55a971" android:pathData="M186.7,517.5c9.1,165.1 145.9,296.3 313.3,296.3s304.2,-131.1 313.3,-296.3H186.7Z"/>

<path android:fillColor="#55a971" android:pathData="M813.3,482.5c-9.1,-165.1 -145.9,-296.3 -313.3,-296.3S195.8,317.4 186.7,482.5h626.6Z"/>

<path android:fillColor="#a1dcb7" android:pathData="M252.7,517.5c9,128.8 116.3,230.4 247.3,230.4s238.4,-101.7 247.3,-230.4H252.7Z"/>

<path android:fillColor="#fff" android:pathData="M615.8,340.3c21.1,0 38.2,17.1 38.2,38.2s-17.1,38.2 -38.2,38.2 -38.2,-17.1 -38.2,-38.2 17.1,-38.2 38.2,-38.2Z"/>

<path android:fillColor="#fff" android:pathData="M380.3,340.3c21.1,0 38.2,17.1 38.2,38.2s-17.1,38.2 -38.2,38.2 -38.2,-17.1 -38.2,-38.2 17.1,-38.2 38.2,-38.2Z"/>

<path android:fillColor="#fff" android:pathData="M479,674.8a18.4,46 0,1 0,36.7 0a18.4,46 0,1 0,-36.7 0z"/>

<path android:fillColor="#fff" android:pathData="M602.1,631.6a18.4,46 135,1 0,26 -26a18.4,46 135,1 0,-26 26z"/>

<path android:fillColor="#fff" android:pathData="M341.6,644.9a18.4,46 50.4,1 0,70.9 -58.6a18.4,46 50.4,1 0,-70.9 58.6z"/>

<path android:fillColor="#55a971" android:pathData="M298.6,331.6c-8.9,0 -17.9,-3.4 -24.7,-10.2l-75.6,-75.6c-13.6,-13.6 -13.6,-35.7 0,-49.4 13.6,-13.6 35.7,-13.6 49.4,0l75.6,75.6c13.6,13.6 13.6,35.7 0,49.4 -6.8,6.8 -15.8,10.2 -24.7,10.2Z"/>

<path android:fillColor="#55a971" android:pathData="M697.6,331.6c-8.9,0 -17.9,-3.4 -24.7,-10.2 -13.6,-13.6 -13.6,-35.7 0,-49.4l75.6,-75.6c13.6,-13.6 35.7,-13.6 49.4,0 13.6,13.6 13.6,35.7 0,49.4l-75.6,75.6c-6.8,6.8 -15.8,10.2 -24.7,10.2Z"/>

</group>
</vector>
23 changes: 23 additions & 0 deletions sampleapp/src/main/res/drawable/kherkin_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="32dp" android:viewportHeight="1000" android:viewportWidth="1000" android:width="32dp">

<path android:fillColor="#55a971" android:pathData="M186.7,517.5c9.1,165.1 145.9,296.3 313.3,296.3s304.2,-131.1 313.3,-296.3H186.7Z"/>

<path android:fillColor="#55a971" android:pathData="M813.3,482.5c-9.1,-165.1 -145.9,-296.3 -313.3,-296.3S195.8,317.4 186.7,482.5h626.6Z"/>

<path android:fillColor="#a1dcb7" android:pathData="M252.7,517.5c9,128.8 116.3,230.4 247.3,230.4s238.4,-101.7 247.3,-230.4H252.7Z"/>

<path android:fillColor="#fff" android:pathData="M615.8,340.3c21.1,0 38.2,17.1 38.2,38.2s-17.1,38.2 -38.2,38.2 -38.2,-17.1 -38.2,-38.2 17.1,-38.2 38.2,-38.2Z"/>

<path android:fillColor="#fff" android:pathData="M380.3,340.3c21.1,0 38.2,17.1 38.2,38.2s-17.1,38.2 -38.2,38.2 -38.2,-17.1 -38.2,-38.2 17.1,-38.2 38.2,-38.2Z"/>

<path android:fillColor="#fff" android:pathData="M479,674.8a18.4,46 0,1 0,36.7 0a18.4,46 0,1 0,-36.7 0z"/>

<path android:fillColor="#fff" android:pathData="M602.1,631.6a18.4,46 135,1 0,26 -26a18.4,46 135,1 0,-26 26z"/>

<path android:fillColor="#fff" android:pathData="M341.6,644.9a18.4,46 50.4,1 0,70.9 -58.6a18.4,46 50.4,1 0,-70.9 58.6z"/>

<path android:fillColor="#55a971" android:pathData="M298.6,331.6c-8.9,0 -17.9,-3.4 -24.7,-10.2l-75.6,-75.6c-13.6,-13.6 -13.6,-35.7 0,-49.4 13.6,-13.6 35.7,-13.6 49.4,0l75.6,75.6c13.6,13.6 13.6,35.7 0,49.4 -6.8,6.8 -15.8,10.2 -24.7,10.2Z"/>

<path android:fillColor="#55a971" android:pathData="M697.6,331.6c-8.9,0 -17.9,-3.4 -24.7,-10.2 -13.6,-13.6 -13.6,-35.7 0,-49.4l75.6,-75.6c13.6,-13.6 35.7,-13.6 49.4,0 13.6,13.6 13.6,35.7 0,49.4l-75.6,75.6c-6.8,6.8 -15.8,10.2 -24.7,10.2Z"/>

</vector>
31 changes: 31 additions & 0 deletions sampleapp/src/main/res/drawable/kherkin_wordmark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="120dp" android:viewportHeight="1000" android:viewportWidth="1000" android:width="120dp">

<path android:fillColor="#55a971" android:pathData="M203.7,590.6l-61.7,-80.2 -24,29.5v50.7h-18.5v-184.8h18.5v106.2h0.5l84.7,-106.2h23.7l-73.2,90.2 73.2,94.7h-23.2Z"/>

<path android:fillColor="#55a971" android:pathData="M343.6,590.6v-76.2c0,-30.7 -18.5,-48.2 -42.5,-48.2 -26.5,0 -42.7,20.2 -42.7,47v77.4h-17.5v-184.8h17.5v65.7h0.5c8.7,-13.2 24.2,-21 42,-21 37.7,0 60.2,26 60.2,63.9v76.2h-17.5Z"/>

<path android:fillColor="#55a971" android:pathData="M539.3,590.6v-136.6h17.5v19.7h0.5c6,-14.2 16.5,-22 38.5,-23.2v18.5h-0.3c-25.2,2.5 -38.7,19 -38.7,41v80.7h-17.5Z"/>

<path android:fillColor="#55a971" android:pathData="M697.7,590.6l-45,-54 -22,28v26h-17.5v-184.8h17.5v131.6h0.5l63.7,-83.4h22.5l-54,68.9 56.7,67.7h-22.5Z"/>

<path android:fillColor="#55a971" android:pathData="M735.7,437.2v-31.5h17.5v31.5h-17.5ZM735.7,590.6v-136.6h17.5v136.6h-17.5Z"/>

<path android:fillColor="#55a971" android:pathData="M881,590.6v-76.2c0,-30.7 -18.5,-48.2 -42.5,-48.2 -26.5,0 -42.7,20.2 -42.7,47v77.4h-17.5v-136.6h17.5v17.5h0.5c8.7,-13.2 24.2,-21 42,-21 37.7,0 60.2,26 60.2,63.9v76.2h-17.5Z"/>

<path android:fillColor="#55a971" android:pathData="M396.7,528.9c1.5,27.3 26.5,49.6 53.1,49.6 21.3,0 41.6,-12.3 49.1,-32.3h18.5c-10.5,29.5 -38.1,48.1 -67.4,48.1 -38.8,0 -71.4,-31.6 -71.4,-71.6s32.8,-72.1 71.1,-72.1c41.1,0 71.9,35.3 71.9,73.1 0,1.8 -0.3,3.5 -0.3,5.3h-124.7ZM503.6,513.1c-5,-27.5 -26.8,-46.8 -53.8,-46.8 -25.5,0 -48.3,18.5 -53.1,46.8h106.9Z"/>

<path android:fillColor="#55a971" android:pathData="M476.7,485.7c4.8,0 8.8,3.9 8.8,8.8s-3.9,8.8 -8.8,8.8 -8.8,-3.9 -8.8,-8.8 3.9,-8.8 8.8,-8.8Z"/>

<path android:fillColor="#55a971" android:pathData="M422.8,485.7c4.8,0 8.8,3.9 8.8,8.8s-3.9,8.8 -8.8,8.8 -8.8,-3.9 -8.8,-8.8 3.9,-8.8 8.8,-8.8Z"/>

<path android:fillColor="#00000000" android:pathData="M404,475.7L386.7,458.4" android:strokeColor="#55a971" android:strokeLineCap="round" android:strokeWidth="16"/>

<path android:fillColor="#00000000" android:pathData="M495.5,475.7L512.8,458.4" android:strokeColor="#55a971" android:strokeLineCap="round" android:strokeWidth="16"/>

<path android:fillColor="#55a971" android:pathData="M445.4,562.4a4.2,10.5 0,1 0,8.4 0a4.2,10.5 0,1 0,-8.4 0z"/>

<path android:fillColor="#55a971" android:pathData="M470.3,556.1a10.5,4.2 50.3,1 0,6.5 -5.4a10.5,4.2 50.3,1 0,-6.5 5.4z"/>

<path android:fillColor="#55a971" android:pathData="M419.7,561.3a10.5,4.2 130.5,1 0,13.7 -16a10.5,4.2 130.5,1 0,-13.7 16z"/>

</vector>
11 changes: 11 additions & 0 deletions sampleapp/src/main/res/layout/fragment_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/buttonNav" />

<ImageView
android:id="@+id/kherkin_logo"
android:layout_width="320dp"
android:layout_height="320dp"
android:contentDescription="@string/kherkin_logo_content_description"
android:src="@drawable/kherkin_logo"
android:layout_marginTop="32dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/buttonNavCompose"/>

</androidx.constraintlayout.widget.ConstraintLayout>
4 changes: 2 additions & 2 deletions sampleapp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
6 changes: 0 additions & 6 deletions sampleapp/src/main/res/mipmap-anydpi-v33/ic_launcher.xml

This file was deleted.

Binary file modified sampleapp/src/main/res/mipmap-hdpi/ic_launcher.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sampleapp/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sampleapp/src/main/res/mipmap-mdpi/ic_launcher.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sampleapp/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sampleapp/src/main/res/mipmap-xhdpi/ic_launcher.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sampleapp/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sampleapp/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sampleapp/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sampleapp/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sampleapp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sampleapp/src/main/res/values/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#3DDC84</color>
</resources>
1 change: 1 addition & 0 deletions sampleapp/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,5 @@

<!-- FinalComposeActivity -->
<string name="final_title">Final Compose Activity</string>
<string name="kherkin_logo_content_description">Kherkin Logo</string>
</resources>