Skip to content

Commit 4c788b5

Browse files
committed
refactor: Move UI test case definitions to common code
- The common UI test case logic, including `crudNoteTest`, `editTitleAfterCreateTest`, `flowAfterCryptTest`, `settingPasswordTest`, and `localeTest`, has been moved from `AbstractJvmUiTests.kt` to the common `AbstractUITests.kt`. - This change centralizes the test case implementations in the `ui/test/src/commonMain` module, allowing them to be shared across different platforms. - The platform-specific `AbstractJvmUiTests.kt` now only contains JVM-specific logic and inherits the common test definitions.
1 parent d15747a commit 4c788b5

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

ui/test-jvm/src/main/kotlin/com/softartdev/notedelight/ui/AbstractJvmUiTests.kt

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,8 @@ import androidx.compose.ui.test.ExperimentalTestApi
77
import androidx.compose.ui.test.junit4.ComposeContentTestRule
88
import com.softartdev.notedelight.AbstractUITests
99
import com.softartdev.notedelight.reflect
10-
import com.softartdev.notedelight.ui.cases.CrudTestCase
11-
import com.softartdev.notedelight.ui.cases.EditTitleAfterCreateTestCase
12-
import com.softartdev.notedelight.ui.cases.EditTitleAfterSaveTestCase
13-
import com.softartdev.notedelight.ui.cases.FlowAfterCryptTestCase
14-
import com.softartdev.notedelight.ui.cases.LocaleTestCase
15-
import com.softartdev.notedelight.ui.cases.PrepopulateDbTestCase
16-
import com.softartdev.notedelight.ui.cases.SettingPasswordTestCase
1710

1811
abstract class AbstractJvmUiTests : AbstractUITests() {
1912
abstract val composeTestRule: ComposeContentTestRule
2013
override val composeUiTest: ComposeUiTest by lazy { reflect(composeTestRule) }
21-
22-
open fun setUp() = Unit
23-
24-
open fun tearDown() = Unit
25-
26-
open fun crudNoteTest() = CrudTestCase(composeUiTest).invoke()
27-
28-
open fun editTitleAfterCreateTest() = EditTitleAfterCreateTestCase(composeUiTest).invoke()
29-
30-
open fun editTitleAfterSaveTest() = EditTitleAfterSaveTestCase(composeUiTest).invoke()
31-
32-
open fun prepopulateDatabase() = PrepopulateDbTestCase(composeUiTest).invoke()
33-
34-
open fun flowAfterCryptTest() = FlowAfterCryptTestCase(
35-
composeUiTest = composeUiTest,
36-
pressBack = ::pressBack,
37-
closeSoftKeyboard = ::closeSoftKeyboard
38-
).invoke()
39-
40-
open fun settingPasswordTest() = SettingPasswordTestCase(
41-
composeUiTest = composeUiTest,
42-
closeSoftKeyboard = ::closeSoftKeyboard
43-
).invoke()
44-
45-
open fun localeTest() = LocaleTestCase(
46-
composeUiTest = composeUiTest,
47-
pressBack = ::pressBack
48-
).invoke()
49-
50-
abstract fun pressBack()
51-
abstract fun closeSoftKeyboard()
5214
}

ui/test/src/commonMain/kotlin/com/softartdev/notedelight/AbstractUITests.kt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,45 @@ package com.softartdev.notedelight
44

55
import androidx.compose.ui.test.ComposeUiTest
66
import androidx.compose.ui.test.ExperimentalTestApi
7+
import com.softartdev.notedelight.ui.cases.CrudTestCase
8+
import com.softartdev.notedelight.ui.cases.EditTitleAfterCreateTestCase
9+
import com.softartdev.notedelight.ui.cases.EditTitleAfterSaveTestCase
10+
import com.softartdev.notedelight.ui.cases.FlowAfterCryptTestCase
11+
import com.softartdev.notedelight.ui.cases.LocaleTestCase
12+
import com.softartdev.notedelight.ui.cases.PrepopulateDbTestCase
13+
import com.softartdev.notedelight.ui.cases.SettingPasswordTestCase
714

815
abstract class AbstractUITests {
916
abstract val composeUiTest: ComposeUiTest
17+
18+
open fun setUp() = Unit
19+
20+
open fun tearDown() = Unit
21+
22+
open fun crudNoteTest() = CrudTestCase(composeUiTest).invoke()
23+
24+
open fun editTitleAfterCreateTest() = EditTitleAfterCreateTestCase(composeUiTest).invoke()
25+
26+
open fun editTitleAfterSaveTest() = EditTitleAfterSaveTestCase(composeUiTest).invoke()
27+
28+
open fun prepopulateDatabase() = PrepopulateDbTestCase(composeUiTest).invoke()
29+
30+
open fun flowAfterCryptTest() = FlowAfterCryptTestCase(
31+
composeUiTest = composeUiTest,
32+
pressBack = ::pressBack,
33+
closeSoftKeyboard = ::closeSoftKeyboard
34+
).invoke()
35+
36+
open fun settingPasswordTest() = SettingPasswordTestCase(
37+
composeUiTest = composeUiTest,
38+
closeSoftKeyboard = ::closeSoftKeyboard
39+
).invoke()
40+
41+
open fun localeTest() = LocaleTestCase(
42+
composeUiTest = composeUiTest,
43+
pressBack = ::pressBack
44+
).invoke()
45+
46+
abstract fun pressBack()
47+
abstract fun closeSoftKeyboard()
1048
}

0 commit comments

Comments
 (0)