@@ -4,6 +4,7 @@ import androidx.compose.ui.test.ComposeUiTest
44import androidx.compose.ui.test.ExperimentalTestApi
55import androidx.compose.ui.test.onNodeWithText
66import androidx.compose.ui.test.performClick
7+ import androidx.compose.ui.test.performTextInput
78import androidx.compose.ui.test.runComposeUiTest
89import com.pega.constellation.sdk.kmp.samples.androidcmpapp.test.ComposeTest
910import com.pega.constellation.sdk.kmp.samples.androidcmpapp.test.waitForNode
@@ -12,54 +13,96 @@ import com.pega.constellation.sdk.kmp.test.mock.PegaVersion
1213import kotlin.test.Test
1314
1415@OptIn(ExperimentalTestApi ::class )
15- class DataReferenceListOfRecordsTest : ComposeTest (PegaVersion .v25_1) {
16+ class DataReferenceListOfRecordsTest : ComposeTest (PegaVersion .v25_1) {
1617 val columns = listOf (" BRAND" , " MODEL" )
1718
1819 @Test
19- fun test_table_simple_table () = runComposeUiTest {
20- val cars = listOf (
21- listOf (" Ford" , " Focus" ),
22- listOf (" Toyota" , " Corolla" ),
23- listOf (" Fiat" , " 126p" ),
24- listOf (" Skoda" , " Octavia" ),
25- listOf (" Audi" , " A5" )
26- )
27- val cars2 = listOf (
28- listOf (" Ford" , " Focus" ),
29- listOf (" Fiat" , " 126p" ),
30- )
31-
32- setupApp(" O40M3A-MarekCo-Work-DataReferenceListOfRecordsTest" )
33-
34- // create case
35- onNodeWithText(" New Service" ).performClick()
36-
37- // Editable Table
38- waitForNode(" DataReference ListOfRecords - Table" , substring = true )
39- waitForNodes(" DataReferenceListOfRecordsCars" , count = 1 )
40- verifyTable(cars)
41- onNodeWithText(" Next" ).performClick()
42-
43- // Editable SimpleTable
44- waitForNode(" DataReference ListOfRecords - SimpleTable" , substring = true )
45- waitForNode(" DataReferenceListOfRecordsCars" )
46- verifyTable(cars)
47- onNodeWithText(" Next" ).performClick()
48-
49- // Readonly Table
50- waitForNode(" DataReference ListOfRecords - Table readonly" , substring = true )
51- waitForNode(" DataReferenceListOfRecordsCars" )
52- verifyTable(cars2)
53- onNodeWithText(" Next" ).performClick()
54-
55- // Readonly SimpleTable
56- waitForNode(" DataReference ListOfRecords - SimpleTable readonly" , substring = true )
57- waitForNode(" DataReferenceListOfRecordsCars" )
58- verifyTable(cars2)
59- }
20+ fun test_table_simple_table () =
21+ runComposeUiTest {
22+ val cars =
23+ listOf (
24+ listOf (" Ford" , " Focus" ),
25+ listOf (" Toyota" , " Corolla" ),
26+ listOf (" Fiat" , " 126p" ),
27+ listOf (" Skoda" , " Octavia" ),
28+ listOf (" Audi" , " A5" ),
29+ )
30+ val cars2 =
31+ listOf (
32+ listOf (" Ford" , " Focus" ),
33+ listOf (" Fiat" , " 126p" ),
34+ )
35+
36+ setupApp(" O40M3A-MarekCo-Work-DataReferenceListOfRecordsTest" )
37+
38+ // create case
39+ onNodeWithText(" New Service" ).performClick()
40+
41+ // Editable Table
42+ waitForNode(" DataReference ListOfRecords - Table" , substring = true )
43+ waitForNodes(" DataReferenceListOfRecordsCars" , count = 1 )
44+ verifyTable(cars)
45+ onNodeWithText(" Next" ).performClick()
46+
47+ // Editable SimpleTable
48+ waitForNode(" DataReference ListOfRecords - SimpleTable" , substring = true )
49+ waitForNode(" DataReferenceListOfRecordsCars" )
50+ verifyTable(cars)
51+ onNodeWithText(" Next" ).performClick()
52+
53+ // Readonly Table
54+ waitForNode(" DataReference ListOfRecords - Table readonly" , substring = true )
55+ waitForNode(" DataReferenceListOfRecordsCars" )
56+ verifyTable(cars2)
57+ onNodeWithText(" Next" ).performClick()
58+
59+ // Readonly SimpleTable
60+ waitForNode(" DataReference ListOfRecords - SimpleTable readonly" , substring = true )
61+ waitForNode(" DataReferenceListOfRecordsCars" )
62+ verifyTable(cars2)
63+ }
6064
6165 private fun ComposeUiTest.verifyTable (data : List <List <String >>) {
6266 columns.forEach { waitForNodes(it, 2 ) }
6367 data.flatten().forEach { waitForNodes(it, 2 ) }
6468 }
69+
70+ @Test
71+ fun test_combo_box () =
72+ runComposeUiTest {
73+ setupApp(" O40M3A-MarekCo-Work-DataReferenceMultiSelectTest" )
74+
75+ // Create case
76+ onNodeWithText(" New Service" ).performClick()
77+
78+ // Wait for multiselect to appear
79+ waitForNode(" Cars Selection" )
80+
81+ // Open dropdown by clicking on the field
82+ onNodeWithText(" Cars Selection" ).performClick()
83+
84+ // Verify options are loaded from D_carsList
85+ waitForNode(" Focus" )
86+ waitForNode(" Corolla" )
87+ waitForNode(" 126p" )
88+ waitForNode(" Octavia" )
89+
90+ // Test search functionality - type to filter, verify only matching option visible
91+ onNodeWithText(" Cars Selection" ).performTextInput(" oct" )
92+ waitForNode(" Octavia" )
93+
94+ // Close dropdown (clears search via onExpandedChange), reopen, then select multiple items
95+ onNodeWithText(" Cars Selection" ).performClick()
96+ onNodeWithText(" Cars Selection" ).performClick()
97+ waitForNode(" Focus" )
98+ onNodeWithText(" Focus" ).performClick()
99+ onNodeWithText(" Octavia" ).performClick()
100+
101+ // Close dropdown by clicking on the field again
102+ onNodeWithText(" Cars Selection" ).performClick()
103+ waitForNode(" Focus, Octavia" )
104+
105+ onNodeWithText(" Submit" ).performClick()
106+ waitForNode(" Thanks for registration" )
107+ }
65108}
0 commit comments