Skip to content

Commit

Permalink
[fix]: final one i hope
Browse files Browse the repository at this point in the history
  • Loading branch information
F0x1d committed Jul 6, 2024
1 parent 0a92eee commit ee9492c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 30 deletions.
47 changes: 22 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,28 @@ jobs:
path: app/build/outputs/apk/release/app-release.apk

send:
name: Send APK
runs-on: macos-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
name: Send APK
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download APK
uses: actions/download-artifact@v4
with:
name: logfox-release
- name: Download APK
uses: actions/download-artifact@v4
with:
name: logfox-release

- name: Check directory
run: ls -a
- name: Send APK to Telegram
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
document: app-release.apk
disable_web_page_preview: true
message: |
*${{ github.actor }}* committed to *${{ github.repository }}*
- name: Send APK to Telegram
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
document: app-release.apk
disable_web_page_preview: true
message: |
*${{ github.actor }}* committed to *${{ github.repository }}*
Branch: *${{ github.head_ref }}*
Commit message: `${{ github.event.pull_request.head.label }}`
Branch: *${{ github.head_ref }}*
Commit message: `${{ github.event.pull_request.head.label }}`
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import org.robolectric.annotation.GraphicsMode
qualifiers = RobolectricDeviceQualifiers.Pixel7,
)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
abstract class ScreenshotTestOf {
abstract class ScreenshotTest {

@JvmField
@Rule
Expand All @@ -45,11 +45,13 @@ abstract class ScreenshotTestOf {
composeRule.setContent { content() }

composeRule.actions()
composeRule.waitForIdle()
waitForIdle()

composeRule.whatToCapture().captureRoboImage()
}

protected fun waitForIdle() = composeRule.waitForIdle()

protected fun String.node(): SemanticsNodeInteraction = composeRule.onNode(this)

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.f0x1d.logfox.core.tests.ScreenshotTestOf
import com.f0x1d.logfox.core.tests.ScreenshotTest
import com.f0x1d.logfox.core.tests.compose.clickOn
import com.f0x1d.logfox.feature.setup.ui.fragment.setup.compose.MockSetupScreenListener
import com.f0x1d.logfox.feature.setup.ui.fragment.setup.compose.SetupAdbButtonTestTag
Expand All @@ -14,7 +14,7 @@ import com.f0x1d.logfox.feature.setup.ui.fragment.setup.compose.SetupScreenState
import com.f0x1d.logfox.ui.compose.theme.LogFoxTheme
import org.junit.Test

class SetupScreenContentTest : ScreenshotTestOf() {
class SetupScreenContentTest : ScreenshotTest() {

@Test
fun shouldShowSetupScreenContent() = screenshotTestOf {
Expand All @@ -25,6 +25,17 @@ class SetupScreenContentTest : ScreenshotTestOf() {

@Test
fun shouldShowAdbDialogOnSetupScreenContent() = screenshotTestOf(
whatToCapture = { SetupAdbDialogTestTag.node() },
) {
LogFoxTheme {
SetupScreenContent(
state = SetupScreenState(showAdbDialog = true),
)
}
}

@Test
fun shouldOpenAdbDialogOnSetupScreenContent() = screenshotTestOf(
actions = { clickOn(SetupAdbButtonTestTag) },
whatToCapture = { SetupAdbDialogTestTag.node() },
) {
Expand All @@ -37,7 +48,7 @@ class SetupScreenContentTest : ScreenshotTestOf() {
state = state,
listener = MockSetupScreenListener.copy(
onAdbClick = { state = state.copy(showAdbDialog = true) },
)
),
)
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ee9492c

Please sign in to comment.