For #26286 new web control UI tests
parent
ce3d6b84ca
commit
6998809039
@ -0,0 +1,150 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.ui
|
||||
|
||||
import okhttp3.mockwebserver.MockWebServer
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
|
||||
import org.mozilla.fenix.helpers.HomeActivityTestRule
|
||||
import org.mozilla.fenix.helpers.TestAssetHelper
|
||||
import org.mozilla.fenix.ui.robots.navigationToolbar
|
||||
|
||||
/**
|
||||
* Tests for verifying basic interactions with web control elements
|
||||
*
|
||||
*/
|
||||
|
||||
class WebControlsTest {
|
||||
private lateinit var mockWebServer: MockWebServer
|
||||
|
||||
private val hour = 10
|
||||
private val minute = 10
|
||||
private val colorHexValue = "#5b2067"
|
||||
|
||||
@get:Rule
|
||||
val activityTestRule = HomeActivityTestRule(
|
||||
isJumpBackInCFREnabled = false,
|
||||
isTCPCFREnabled = false,
|
||||
)
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
mockWebServer = MockWebServer().apply {
|
||||
dispatcher = AndroidAssetDispatcher()
|
||||
start()
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
mockWebServer.shutdown()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cancelCalendarFormTest() {
|
||||
val htmlControlsPage = TestAssetHelper.getHTMLControlsFormAsset(mockWebServer)
|
||||
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(htmlControlsPage.url) {
|
||||
clickForm("Calendar Form")
|
||||
clickFormViewButton("CANCEL")
|
||||
clickSubmitDateButton()
|
||||
verifyNoDateIsSelected()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setAndClearCalendarFormTest() {
|
||||
val htmlControlsPage = TestAssetHelper.getHTMLControlsFormAsset(mockWebServer)
|
||||
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(htmlControlsPage.url) {
|
||||
clickForm("Calendar Form")
|
||||
selectDate()
|
||||
clickFormViewButton("OK")
|
||||
clickSubmitDateButton()
|
||||
verifySelectedDate()
|
||||
clickForm("Calendar Form")
|
||||
clickFormViewButton("CLEAR")
|
||||
clickSubmitDateButton()
|
||||
verifyNoDateIsSelected()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cancelClockFormTest() {
|
||||
val htmlControlsPage = TestAssetHelper.getHTMLControlsFormAsset(mockWebServer)
|
||||
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(htmlControlsPage.url) {
|
||||
clickForm("Clock Form")
|
||||
clickFormViewButton("CANCEL")
|
||||
clickSubmitTimeButton()
|
||||
verifyNoTimeIsSelected(hour, minute)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setAndClearClockFormTest() {
|
||||
val htmlControlsPage = TestAssetHelper.getHTMLControlsFormAsset(mockWebServer)
|
||||
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(htmlControlsPage.url) {
|
||||
clickForm("Clock Form")
|
||||
selectTime(hour, minute)
|
||||
clickFormViewButton("OK")
|
||||
clickSubmitTimeButton()
|
||||
verifySelectedTime(hour, minute)
|
||||
clickForm("Clock Form")
|
||||
clickFormViewButton("CLEAR")
|
||||
clickSubmitTimeButton()
|
||||
verifyNoTimeIsSelected(hour, minute)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cancelColorFormTest() {
|
||||
val htmlControlsPage = TestAssetHelper.getHTMLControlsFormAsset(mockWebServer)
|
||||
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(htmlControlsPage.url) {
|
||||
clickForm("Color Form")
|
||||
selectColor(colorHexValue)
|
||||
clickFormViewButton("CANCEL")
|
||||
clickSubmitColorButton()
|
||||
verifyColorIsNotSelected(colorHexValue)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setColorFormTest() {
|
||||
val htmlControlsPage = TestAssetHelper.getHTMLControlsFormAsset(mockWebServer)
|
||||
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(htmlControlsPage.url) {
|
||||
clickForm("Color Form")
|
||||
selectColor(colorHexValue)
|
||||
clickFormViewButton("SET")
|
||||
clickSubmitColorButton()
|
||||
verifySelectedColor(colorHexValue)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun verifyDropdownMenuTest() {
|
||||
val htmlControlsPage = TestAssetHelper.getHTMLControlsFormAsset(mockWebServer)
|
||||
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(htmlControlsPage.url) {
|
||||
clickForm("Drop-down Form")
|
||||
selectDropDownOption("The National")
|
||||
clickSubmitDropDownButton()
|
||||
verifySelectedDropDownOption("The National")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue