Best Appium-espresso-driver code snippet using android.support.test.espresso.contrib.PickerActions.setTime
SettingsActivityTest.kt
Source:SettingsActivityTest.kt
...165 assertFalse(prefs.isNormalize)166 // Choose start at 11:12167 preferenceStart.perform(ViewActions.scrollTo(), click())168 onView(allOf(isDialogTitle(), withText(prefsStart))).check(matches(isDisplayed()))169 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(11, 12))170 onView(allOf(withId(R.id.button1), withText(R.string.ok))).perform(click())171 preferenceStart.onChildView(withId(summary)).check(matches(withText(TimeOfDay(11, 12).getDisplayString(context))))172 assertEquals(TimeOfDay(11, 12), prefs.daytimeStart)173 // Choose end at 23:24174 preferenceEnd.perform(ViewActions.scrollTo(), click())175 onView(allOf(isDialogTitle(), withText(prefsEnd))).check(matches(isDisplayed()))176 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(23, 24))177 onView(allOf(withId(R.id.button1), withText(R.string.ok))).perform(click())178 preferenceEnd.onChildView(withId(summary)).check(matches(withText(TimeOfDay(23, 24).getDisplayString(context))))179 assertEquals(TimeOfDay(23, 24), prefs.daytimeEnd)180 // Choose only Monday181 preferenceActiveOnDaysOfWeek.perform(ViewActions.scrollTo(), click()) // open selection182 onView(allOf(isDialogTitle(), withText(prefsActiveOnDaysOfWeek))).check(matches(isDisplayed()))183 for (i in 0..6) {184 onView(withText(resources.getStringArray(weekdayEntries)[i])).perform(ViewActions.scrollTo(), click()) // un-choose all days185 }186 val mondaySet = HashSet(Arrays.asList("2"))187 val mondayWeekSummary = Utils.deriveOrderedEntrySummary(mondaySet, resources.getStringArray(weekdayEntries), resources.getStringArray(weekdayEntryValues))188 onView(withText(mondayWeekSummary)).perform(click()) // choose only Monday189 onView(allOf(withId(R.id.button1), withText(R.string.ok))).perform(click())190 preferenceActiveOnDaysOfWeek.onChildView(withId(summary)).check(matches(withText(mondayWeekSummary)))191 assertEquals(mondaySet.toString(), prefs.activeOnDaysOfWeek.toString())192 onToast(atLeastOneActiveDayNeeded).check(doesNotExist())193 // Try to choose no day at all194 preferenceActiveOnDaysOfWeek.perform(click()) // open selection195 onView(allOf(isDialogTitle(), withText(prefsActiveOnDaysOfWeek))).check(matches(isDisplayed()))196 onView(withText(mondayWeekSummary)).perform(click()) // de-choose also Monday197 onView(allOf(withId(R.id.button1), withText(R.string.ok))).perform(click())198 checkDisplayedAndDisappearedOnToast(atLeastOneActiveDayNeeded)199 preferenceActiveOnDaysOfWeek.onChildView(withId(summary)).check(matches(withText(mondayWeekSummary)))200 assertEquals(mondaySet.toString(), prefs.activeOnDaysOfWeek.toString())201 // Choose frequency 20 minutes202 preferenceFrequency.perform(ViewActions.scrollTo(), click())203 onView(allOf(isDialogTitle(), withText(prefsFrequency))).check(matches(isDisplayed()))204 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(0, 20))205 onView(allOf(withId(R.id.button1), withText(R.string.ok))).perform(click())206 preferenceFrequency.onChildView(withId(summary)).check(matches(withText("00:20 (20 min)")))207 assertEquals(20 * ONE_MINUTE_MILLIS, prefs.interval)208 // Try to choose normalize209 preferenceNormalize.perform(ViewActions.scrollTo(), click())210 onView(allOf(isDialogTitle(), withText(prefsNormalize))).check(doesNotExist())211 // Disable randomize212 preferenceRandomize.perform(ViewActions.scrollTo(), click()).check(matches(withText(summaryDontRandomize)))213 assertFalse(prefs.isRandomize)214 // Choose normalize hh:05215 preferenceNormalize.perform(ViewActions.scrollTo(), click())216 onView(allOf(isDialogTitle(), withText(prefsNormalize))).check(matches(isDisplayed()))217 onView(withText(resources.getStringArray(normalizeEntries)[2])).perform(click())218 preferenceNormalize.onChildView(withId(summary)).check(matches(withText(resources.getStringArray(normalizeEntries)[2])))219 assertTrue(prefs.isNormalize)220 assertEquals(5, prefs.normalize)221 // Try to choose frequency 67 minutes222 preferenceFrequency.perform(ViewActions.scrollTo(), click())223 onView(allOf(isDialogTitle(), withText(prefsFrequency))).check(matches(isDisplayed()))224 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(1, 7))225 onView(allOf(withId(R.id.button1), withText(R.string.ok))).perform(click())226 checkDisplayedAndDisappearedOnToast(frequencyDoesNotFitIntoAnHour)227 preferenceFrequency.onChildView(withId(summary)).check(matches(withText("00:20 (20 min)")))228 assertEquals(20 * ONE_MINUTE_MILLIS, prefs.interval)229 // Choose normalize no230 preferenceNormalize.perform(ViewActions.scrollTo(), click())231 onView(allOf(isDialogTitle(), withText(prefsNormalize))).check(matches(isDisplayed()))232 onData(Matchers.`is`(resources.getStringArray(normalizeEntries)[0])).perform(ViewActions.scrollTo(), click())233 preferenceNormalize.onChildView(withId(summary)).check(matches(withText(resources.getStringArray(normalizeEntries)[0])))234 assertFalse(prefs.isNormalize)235 // Choose frequency 67 minutes236 preferenceFrequency.perform(ViewActions.scrollTo(), click())237 onView(allOf(isDialogTitle(), withText(prefsFrequency))).check(matches(isDisplayed()))238 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(1, 7))239 onView(allOf(withId(R.id.button1), withText(R.string.ok))).perform(click())240 preferenceFrequency.onChildView(withId(summary)).check(matches(withText("01:07 (67 min)")))241 assertEquals(67 * ONE_MINUTE_MILLIS, prefs.interval)242 // Try to choose normalize243 preferenceNormalize.perform(ViewActions.scrollTo(), click())244 onView(allOf(isDialogTitle(), withText(prefsNormalize))).check(doesNotExist())245 // Choose frequency 20 minutes ... to check later whether de-randomize does de-normalize246 preferenceFrequency.perform(ViewActions.scrollTo(), click())247 onView(allOf(isDialogTitle(), withText(prefsFrequency))).check(matches(isDisplayed()))248 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(0, 20))249 onView(allOf(withId(R.id.button1), withText(R.string.ok))).perform(click())250 preferenceFrequency.onChildView(withId(summary)).check(matches(withText("00:20 (20 min)")))251 assertEquals(20 * ONE_MINUTE_MILLIS, prefs.interval)252 // Choose normalize hh:05 ... to check later whether de-randomize does de-normalize253 preferenceNormalize.perform(ViewActions.scrollTo(), click())254 onView(allOf(isDialogTitle(), withText(prefsNormalize))).check(matches(isDisplayed()))255 onView(withText(resources.getStringArray(normalizeEntries)[2])).perform(ViewActions.scrollTo(), click())256 preferenceNormalize.onChildView(withId(summary)).check(matches(withText(resources.getStringArray(normalizeEntries)[2])))257 assertTrue(prefs.isNormalize)258 assertEquals(5, prefs.normalize)259 // Enable randomize ... to check later whether de-randomize does de-normalize260 preferenceRandomize.perform(ViewActions.scrollTo(), click()).check(matches(withText(summaryRandomize)))261 assertTrue(prefs.isRandomize)262 assertFalse(prefs.isNormalize) // here we check whether de-randomize does de-normalize...
Comprobacion2.kt
Source:Comprobacion2.kt
...72 textInputEditText.perform(click())73 Thread.sleep(600)74 // Establecer hora de la comprobación75 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name)))76 .perform(PickerActions.setTime(10, 30))77 78 val materialButton = onView(79allOf(withId(android.R.id.button1), withText("Aceptar"),80childAtPosition(81childAtPosition(82withClassName(`is`("android.widget.ScrollView")),830),843)))85 materialButton.perform(scrollTo(), click())86 87 val appCompatImageButton = onView(88allOf(withId(R.id.btnApplyCheckHour), withContentDescription("Añadir alarma de comprobación."),89childAtPosition(90childAtPosition(91withClassName(`is`("android.widget.LinearLayout")),922),931),94isDisplayed()))95 appCompatImageButton.perform(click())96 // Comprobar que se ha insertado correctamente.97 val compoundButton = onView(98allOf(withText("10:30"),99withParent(allOf(withId(R.id.alarmChipGroup),100withParent(IsInstanceOf.instanceOf(android.widget.LinearLayout::class.java)))),101isDisplayed()))102 compoundButton.check(matches(isDisplayed()))103 104 val textView = onView(105allOf(withId(R.id.snackbar_text), withText("Alarma de comprobación programada correctamente."),106withParent(withParent(IsInstanceOf.instanceOf(android.widget.FrameLayout::class.java))),107isDisplayed()))108 textView.check(matches(withText("Alarma de comprobación programada correctamente.")))109 // Intentar añadir alarma con la misma hora.110 val appCompatImageButton2 = onView(111allOf(withId(R.id.btnApplyCheckHour), withContentDescription("Añadir alarma de comprobación."),112childAtPosition(113childAtPosition(114withClassName(`is`("android.widget.LinearLayout")),1152),1161),117isDisplayed()))118 appCompatImageButton2.perform(click())119 120 val textView2 = onView(121allOf(withId(R.id.snackbar_text), withText("Ya existen alarmas de comprobación programadas para esa hora."),122withParent(withParent(IsInstanceOf.instanceOf(android.widget.FrameLayout::class.java))),123isDisplayed()))124 textView2.check(matches(withText("Ya existen alarmas de comprobación programadas para esa hora.")))125 val textInputEditText2 = onView(126allOf(withId(R.id.txtCheckHour),127childAtPosition(128childAtPosition(129withId(R.id.txtInputLayoutCheckHour),1300),1311),132isDisplayed()))133 textInputEditText2.perform(click())134 Thread.sleep(600)135 // Insertar la segunda alarma de comprobación136 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name)))137 .perform(PickerActions.setTime(11, 0))138 val materialButton2 = onView(139allOf(withId(android.R.id.button1), withText("Aceptar"),140childAtPosition(141childAtPosition(142withClassName(`is`("android.widget.ScrollView")),1430),1443)))145 materialButton2.perform(scrollTo(), click())146 147 val appCompatImageButton3 = onView(148allOf(withId(R.id.btnApplyCheckHour), withContentDescription("Añadir alarma de comprobación."),149childAtPosition(150childAtPosition(151withClassName(`is`("android.widget.LinearLayout")),1522),1531),154isDisplayed()))155 appCompatImageButton3.perform(click())156 // Comprobar que se inserta correctamente.157 val compoundButton2 = onView(158allOf(withText("11:00"),159withParent(allOf(withId(R.id.alarmChipGroup),160withParent(IsInstanceOf.instanceOf(android.widget.LinearLayout::class.java)))),161isDisplayed()))162 compoundButton2.check(matches(isDisplayed()))163 164 val textView3 = onView(165allOf(withId(R.id.snackbar_text), withText("Alarma de comprobación programada correctamente."),166withParent(withParent(IsInstanceOf.instanceOf(android.widget.FrameLayout::class.java))),167isDisplayed()))168 textView3.check(matches(withText("Alarma de comprobación programada correctamente.")))169 // Insertar una tercera alarma170 val textInputEditText3 = onView(171allOf(withId(R.id.txtCheckHour),172childAtPosition(173childAtPosition(174withId(R.id.txtInputLayoutCheckHour),1750),1761),177isDisplayed()))178 textInputEditText3.perform(click())179 Thread.sleep(600)180 // Establecer hora181 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name)))182 .perform(PickerActions.setTime(16, 0))183 val materialButton3 = onView(184allOf(withId(android.R.id.button1), withText("Aceptar"),185childAtPosition(186childAtPosition(187withClassName(`is`("android.widget.ScrollView")),1880),1893)))190 materialButton3.perform(scrollTo(), click())191 192 val appCompatImageButton4 = onView(193allOf(withId(R.id.btnApplyCheckHour), withContentDescription("Añadir alarma de comprobación."),194childAtPosition(195childAtPosition(196withClassName(`is`("android.widget.LinearLayout")),1972),1981),199isDisplayed()))200 appCompatImageButton4.perform(click())201 // Comprobar que se inserta correctamente.202 val compoundButton5 = onView(203 allOf(withText("16:00"),204 withParent(allOf(withId(R.id.alarmChipGroup),205 withParent(IsInstanceOf.instanceOf(android.widget.LinearLayout::class.java)))),206 isDisplayed()))207 compoundButton5.check(matches(isDisplayed()))208 val textView7 = onView(209 allOf(withId(R.id.snackbar_text), withText("Alarma de comprobación programada correctamente."),210 withParent(withParent(IsInstanceOf.instanceOf(android.widget.FrameLayout::class.java))),211 isDisplayed()))212 textView7.check(matches(withText("Alarma de comprobación programada correctamente.")))213 // Insertar una tercera alarma de comprobación214 val textInputEditText4 = onView(215allOf(withId(R.id.txtCheckHour),216childAtPosition(217childAtPosition(218withId(R.id.txtInputLayoutCheckHour),2190),2201),221isDisplayed()))222 textInputEditText4.perform(click())223 Thread.sleep(600)224 // Establecer hora225 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name)))226 .perform(PickerActions.setTime(18, 0))227 val materialButton4 = onView(228allOf(withId(android.R.id.button1), withText("Aceptar"),229childAtPosition(230childAtPosition(231withClassName(`is`("android.widget.ScrollView")),2320),2333)))234 materialButton4.perform(scrollTo(), click())235 236 val appCompatImageButton5 = onView(237allOf(withId(R.id.btnApplyCheckHour), withContentDescription("Añadir alarma de comprobación."),238childAtPosition(239childAtPosition(240withClassName(`is`("android.widget.LinearLayout")),...
MainActivityTest.kt
Source:MainActivityTest.kt
...88 onView(withId(checkBoxStopMeditationAutomatically)).check(matches(isNotChecked()))89 // Change ramp up time90 onView(withId(textViewRampUpTimeLabel)).perform(scrollTo(), click())91 onView(allOf(isDialogTitle(), withText(prefsRampUpTime))).check(matches(isDisplayed()))92 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(0, 10))93 onView(allOf(withId(android.R.id.button1), withText(android.R.string.ok))).perform(click())94 onView(withId(textViewRampUpTime)).check(matches(withText("00:10 (10 s)")))95 // Change meditation duration96 onView(withId(textViewMeditationDurationLabel)).perform(scrollTo(), click())97 onView(allOf(isDialogTitle(), withText(prefsMeditationDuration))).check(matches(isDisplayed()))98 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(0, 4))99 onView(allOf(withId(android.R.id.button1), withText(android.R.string.ok))).perform(click())100 onView(withId(textViewMeditationDuration)).check(matches(withText("00:04 (4 min)")))101 // Change number of periods102 onView(withId(textViewNumberOfPeriodsLabel)).perform(scrollTo(), click())103 onView(allOf(isDialogTitle(), withText(prefsNumberOfPeriods))).check(matches(isDisplayed()))104 onView(withClassName(Matchers.equalTo(NumberPicker::class.java.name))).perform(MorePickerActions.setNumber(2))105 onView(allOf(withId(android.R.id.button1), withText(android.R.string.ok))).perform(click())106 onView(withId(textViewNumberOfPeriods)).check(matches(withText("2")))107 onView(withId(textViewPatternOfPeriods)).check(matches(withText("x, x")))108 // Try to change pattern of periods to one fixed period only109 onView(withId(textViewPatternOfPeriodsLabel)).perform(scrollTo(), click())110 onView(allOf(isDialogTitle(), withText(prefsPatternOfPeriods))).check(matches(isDisplayed()))111 onView(withClassName(Matchers.equalTo(EditText::class.java.name))).perform(replaceText("1"), closeSoftKeyboard())112 onView(allOf(withId(android.R.id.button1), withText(android.R.string.ok))).perform(click())...
Rastreo4.kt
Source:Rastreo4.kt
...79isDisplayed()))80 textInputEditText.perform(click())81 Thread.sleep(1000)82 // Establecer hora de INICIO83 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(12, 15))84 val materialButton2 = onView(85allOf(withId(android.R.id.button1), withText("Aceptar"),86childAtPosition(87childAtPosition(88withClassName(`is`("android.widget.ScrollView")),890),903)))91 materialButton2.perform(scrollTo(), click())92 93 val textInputEditText2 = onView(94allOf(withId(R.id.txtEndAutoTracking),95childAtPosition(96childAtPosition(97withId(R.id.txtInputLayoutEndAutoTracking),980),991),100isDisplayed()))101 textInputEditText2.perform(click())102 textInputEditText2.perform(click())103 Thread.sleep(1000)104 // Establecer hora de FIN105 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(12, 45))106 val materialButton3 = onView(107allOf(withId(android.R.id.button1), withText("Aceptar"),108childAtPosition(109childAtPosition(110withClassName(`is`("android.widget.ScrollView")),1110),1123)))113 materialButton3.perform(scrollTo(), click())114 115 val editText = onView(116allOf(withId(R.id.txtStartAutoTracking), withText("12:15"),117withParent(withParent(withId(R.id.txtInputLayoutStartAutoTracking))),118isDisplayed()))119 editText.check(matches(withText("12:15")))120 121 val editText2 = onView(122allOf(withId(R.id.txtEndAutoTracking), withText("12:45"),123withParent(withParent(withId(R.id.txtInputLayoutEndAutoTracking))),124isDisplayed()))125 editText2.check(matches(withText("12:45")))126 127 val appCompatImageButton = onView(128allOf(withId(R.id.btnAddLocationAlarm), withContentDescription("Añadir alarma de localización"),129childAtPosition(130childAtPosition(131withClassName(`is`("android.widget.LinearLayout")),1320),1332),134isDisplayed()))135 appCompatImageButton.perform(click())136 Thread.sleep(800)137 val textView4 = onView(138allOf(withId(R.id.startHour), withText("12:15"),139withParent(withParent(IsInstanceOf.instanceOf(android.widget.LinearLayout::class.java))),140isDisplayed()))141 textView4.check(matches(withText("12:15")))142 143 val textView5 = onView(144allOf(withId(R.id.endHour), withText("12:45"),145withParent(withParent(IsInstanceOf.instanceOf(android.widget.LinearLayout::class.java))),146isDisplayed()))147 textView5.check(matches(withText("12:45")))148 149 val textInputEditText3 = onView(150allOf(withId(R.id.txtStartAutoTracking), withText("12:15"),151childAtPosition(152childAtPosition(153withId(R.id.txtInputLayoutStartAutoTracking),1540),1551),156isDisplayed()))157 textInputEditText3.perform(click())158 textInputEditText3.perform(click())159 Thread.sleep(800)160 // Establecer hora de INICIO161 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(12, 20))162 163 val materialButton4 = onView(164allOf(withId(android.R.id.button1), withText("Aceptar"),165childAtPosition(166childAtPosition(167withClassName(`is`("android.widget.ScrollView")),1680),1693)))170 materialButton4.perform(scrollTo(), click())171 172 val textInputEditText4 = onView(173allOf(withId(R.id.txtEndAutoTracking), withText("12:45"),174childAtPosition(175childAtPosition(176withId(R.id.txtInputLayoutEndAutoTracking),1770),1781),179isDisplayed()))180 textInputEditText4.perform(click())181 textInputEditText4.perform(click())182 Thread.sleep(800)183 // Establecer hora de FIN184 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(12, 35))185 val materialButton5 = onView(186allOf(withId(android.R.id.button1), withText("Aceptar"),187childAtPosition(188childAtPosition(189withClassName(`is`("android.widget.ScrollView")),1900),1913)))192 materialButton5.perform(scrollTo(), click())193 194 val appCompatImageButton2 = onView(195allOf(withId(R.id.btnAddLocationAlarm), withContentDescription("Añadir alarma de localización"),196childAtPosition(197childAtPosition(198withClassName(`is`("android.widget.LinearLayout")),...
EditQuizDetailsPage.kt
Source:EditQuizDetailsPage.kt
...72 onViewWithId(android.R.id.button1).click()73 }74 fun editTime(hour: Int, min: Int) {75 waitForViewWithClassName(Matchers.equalTo<String>(TimePicker::class.java.name))76 .perform(PickerActions.setTime(hour, min))77 onViewWithId(android.R.id.button1).click()78 }79 fun removeSecondOverride() {80 // scroll to bottom to make the 2nd override button visible81 addOverrideButton().scrollTo()82 ClickUntilMethod.run(83 onView(withContentDescription("remove_override_button_1")),84 onView(withText("Remove Due Date"))85 )86 // Wait for alert dialog to display before clicking "Remove"87 waitForViewWithText(R.string.removeDueDate).assertVisible()88 waitForViewWithText(R.string.remove).click()89 }90 fun assertDateChanged(year: Int, month: Int, dayOfMonth: Int, id: Int) {...
Rastreo5.kt
Source:Rastreo5.kt
...71isDisplayed()))72 textInputEditText.perform(click())73 Thread.sleep(800)74 // Establecer hora de INICIO75 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(12, 15))76 77 val materialButton2 = onView(78allOf(withId(android.R.id.button1), withText("Aceptar"),79childAtPosition(80childAtPosition(81withClassName(`is`("android.widget.ScrollView")),820),833)))84 materialButton2.perform(scrollTo(), click())85 86 val textInputEditText2 = onView(87allOf(withId(R.id.txtEndAutoTracking),88childAtPosition(89childAtPosition(90withId(R.id.txtInputLayoutEndAutoTracking),910),921),93isDisplayed()))94 textInputEditText2.perform(click())95 textInputEditText2.perform(click())96 Thread.sleep(800)97 // Establecer hora de FIN98 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(12, 45))99 100 val materialButton3 = onView(101allOf(withId(android.R.id.button1), withText("Aceptar"),102childAtPosition(103childAtPosition(104withClassName(`is`("android.widget.ScrollView")),1050),1063)))107 materialButton3.perform(scrollTo(), click())108 109 val editText = onView(110allOf(withId(R.id.txtStartAutoTracking), withText("12:15"),111withParent(withParent(withId(R.id.txtInputLayoutStartAutoTracking))),112isDisplayed()))...
Rastreo3.kt
Source:Rastreo3.kt
...551),56isDisplayed()))57 textInputEditText.perform(click())58 // Establecer hora de INICIO59 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(12, 15))60 61 val materialButton2 = onView(62allOf(withId(android.R.id.button1), withText("Aceptar"),63childAtPosition(64childAtPosition(65withClassName(`is`("android.widget.ScrollView")),660),673)))68 materialButton2.perform(scrollTo(), click())69 70 val textInputEditText2 = onView(71allOf(withId(R.id.txtEndAutoTracking),72childAtPosition(73childAtPosition(74withId(R.id.txtInputLayoutEndAutoTracking),750),761),77isDisplayed()))78 textInputEditText2.perform(click())79 textInputEditText2.perform(click())80 // Establecer hora de FIN81 onView(withClassName(Matchers.equalTo(TimePicker::class.java.name))).perform(PickerActions.setTime(11, 10))82 83 val materialButton3 = onView(84allOf(withId(android.R.id.button1), withText("Aceptar"),85childAtPosition(86childAtPosition(87withClassName(`is`("android.widget.ScrollView")),880),893)))90 materialButton3.perform(scrollTo(), click())91 92 val textView = onView(93allOf(withText("Alarmas de localización"),94withParent(withParent(withId(R.id.layoutCardLocationAlarm))),95isDisplayed()))...
EditAssignmentDetailsPage.kt
Source:EditAssignmentDetailsPage.kt
...78 onViewWithId(android.R.id.button1).click()79 }80 fun editTime(hour: Int, min: Int) {81 waitForViewWithClassName(Matchers.equalTo<String>(TimePicker::class.java.name))82 .perform(PickerActions.setTime(hour, min))83 onViewWithId(android.R.id.button1).click()84 }85 fun assertDateChanged(year: Int, month: Int, dayOfMonth: Int, id: Int) {86 val cal = Calendar.getInstance().apply {set(year, month, dayOfMonth)}87 waitForViewWithId(id).assertHasText(DateHelper.getFullMonthNoLeadingZeroDateFormat().format(cal.time))88 }89 fun assertTimeChanged(hour: Int, min: Int, id: Int) {90 val cal = Calendar.getInstance().apply {set(0, 0, 0, hour, min)}91 val sdh = SimpleDateFormat("H:mm a", Locale.US)92 waitForViewWithId(id).assertHasText(sdh.format(cal.time))93 }94 fun assertNewOverrideCreated() {95 waitForViewWithId(R.id.overrideContainer).check(has(2, Matchers.instanceOf(AssignmentOverrideView::class.java)))96 }...
setTime
Using AI Code Generation
1onView(withClassName(Matchers.equalTo(TimePicker.class.getName()))).perform(PickerActions.setTime(10, 00));2onView(withClassName(Matchers.equalTo(NumberPicker.class.getName()))).perform(PickerActions.setNumberPickerValue(10));3onView(withClassName(Matchers.equalTo(DatePicker.class.getName()))).perform(PickerActions.setDate(2015, 12, 25));4onView(withClassName(Matchers.equalTo(TimePicker.class.getName()))).perform(PickerActions.setTime(10, 00));5onView(withClassName(Matchers.equalTo(NumberPicker.class.getName()))).perform(PickerActions.setNumberPickerValue(10));6onView(withClassName(Matchers.equalTo(DatePicker.class.getName()))).perform(PickerActions.setDate(2015, 12, 25));7onView(withClassName(Matchers.equalTo(TimePicker.class.getName()))).perform(PickerActions.setTime(10, 00));8onView(withClassName(Matchers.equalTo(NumberPicker.class.getName()))).perform(PickerActions.setNumberPickerValue(10));9onView(withClassName(Matchers.equalTo(DatePicker.class.getName()))).perform(PickerActions.setDate(2015, 12, 25));
setTime
Using AI Code Generation
1public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class);2public void testTimePicker() {3 onView(withId(R.id.timePicker)).perform(setTime(18, 30));4}5public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class);6public void testTimePicker() {7 onView(withId(R.id.timePicker)).perform(setTime(18, 30));8}9public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class);10public void testTimePicker() {11 onView(withId(R.id.timePicker)).perform(setTime(18, 30));12}13public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class);14public void testTimePicker() {15 onView(withId(R.id.timePicker)).perform(setTime(18, 30));16}
setTime
Using AI Code Generation
1onView(withId(R.id.timePicker1))2.perform(setTime(12, 30));3public static ViewAction setTime(int hours, int minutes) {4return new TimePickerAction(hours, minutes, TimePickerAction.TIME_SET);5}6public static ViewAction setTime(int hours, int minutes) {7return new TimePickerAction(hours, minutes, TimePickerAction.TIME_SET);8}9Error:(85, 42) error: cannot find symbol class TimePickerAction10public static ViewAction setTime(int hours, int minutes) {11return new TimePickerAction(hours, minutes, TimePickerAction.TIME_SET);12}13onView(withId(R.id.timePicker1))14.perform(setTime(12, 30));15onView(withId(R.id.timePicker1))16.perform(setTime(12, 30));17Error:(85, 42) error: cannot find symbol class TimePickerAction18onView(withId(R.id.timePicker1))19.perform(setTime(12, 30));20Error:(85, 42) error: cannot find symbol class TimePickerAction21onView(withId(R.id.timePicker1))22.perform(setTime(12, 30));23Error:(85, 42) error: cannot find symbol class TimePickerAction24onView(withId(R.id.timePicker1))25.perform(set
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!