Clickable Actions
To test the counter app, we need to click the buttons and assert that the value increases and decreases.
Elements with "type": "clickable"
also have access to click()
.
The page object declares a clickable
element called buttons
, which returns all the buttons in the component.
The page object also declares a count
element, which selects the span
element that holds the count.
The default value of the counter is 0. Because the buttons
element is clickable
, it has access to click()
in test code.
The test code clicks the plus (+) button 3 times and the minus (-) button one time. It then calls the getText()
basic action API to assert the value, which should be 2.
Click Run Test.