Perfecto predefined steps

Tal Abraham edited this page Nov 14, 2016 · 1 revision

Perfecto created two sets of predefined steps:

Device predefined steps

BDD step Java step Step operation
@Then("^I rotate the device to landscape$") rotateToLandscape() Rotates device to landscape
@Then("^I rotate the device to portrait$") rotateToPortrait() Rotates device to portrait
@Then("^I rotate the device$") rotateDevice() Rotates device
@Then("^I set the device location to the coordinates "(.*?)"$") setLocationByCoordinates(String coordinates) Sets device location to latitude-longitude coordinates string (decimal degrees)
@Then("^I set the device location to the address "(.*?)"$") setLocationByAddress(String address) Sets device location to address (Google Geocoding)
@Then("^the device coordinates must be "(.*?)"$") assertLocationCoordinates(String coordinates) Asserts device location is the latitude-longitude coordinates string (decimal degrees); aborts if not
@Then("^the device coordinates should be "(.*?)"$") boolean verifyLocationCoordinates(String coordinates) Verifies device location is the latitude-longitude coordinates string (decimal degrees); returns true if it is, false otherwise
@Then("^I reset the device location$") resetLocation() Resets device location
@Then("^I go to the device home screen$") goToHomeScreen() Brings device to home screen
@Then("^I swipe left$") swipeLeft() Swipes left
@Then("^I swipe right") swipeRight() Swipes right
@Then("^I scroll up$") scrollUp() Scrolls up
@Then("^I scroll down$") scrollDown() Scrolls down
@Then("^I lock the device for "(\d*\.?\d*)" seconds$") lockDevice(int seconds) Locks device screen for the duration (seconds), and unlocks the device
@Then("^I set timezone to "(.*?)"") setTimezone(String timezone) Sets device timezone Id
@Then("^the device timezone must be "(.*?)"") assertTimezone(String timezone) Asserts device timezone is timezone; aborts if not
@Then("^the device timezone should be "(.*?)"") boolean verifyTimezone(String timezone) Verifies device timezone is timezone; returns true if it is, false otherwise
@Then("^I reset the device timezone$") resetTimezone() Resets device timezone Id
@Then("^I take a screenshot$") takeScreenshot() Gets device digital screenshot, and inserts it into execution report
@Then("^I take a screenshot and save to "(.*?)"$") takeScreenshot(String repositoryPath) Gets device digital screenshot, and saves it in the repository
@Then("^I hide keyboard$") hideKeyboard() Hides device keyboard

Application predefined steps

BDD step Java step Step operation
@Then("^I start application by name "(.*?)"$") startAppByName(String name) Opens native app by its name
@Then("^I start application by id "(.*?)"$") startAppById(String id) Opens native app by its [[app Id
@Then("^I close application by name "(.*?)"$") closeAppByName(String name) Closes native app by its name
@Then("^I close application by id "(.*?)"$") closeAppById(String id) Closes native app by its app Id
@Then("^I clean application by name "(.*?)"$") cleanAppByName(String name) Cleans app data (including cache) by its name, and return app to its initial state
@Then("^I clean application by id "(.*?)"$") cleanAppById(String id) Cleans app data (including cache) by its [[app Id
@Then("^I uninstall application by name "(.*?)"$") uninstallAppByName(String name) Uninstalls app by name from device
@Then("^I uninstall application by id "(.*?)"$") uninstallAppById(String id) Uninstalls app by [[app Id
@Then("^I install application "(.*?)"$") installApp(String application) Installs app (Android apk, iOS ipa, BlackBerry cod) from a path or Perfecto Lab repository on device
@Then("^I install instrumented application "(.*?)"$") installInstrumentApp(String application) Installs instrumented app (Android apk, iOS ipa, BlackBerry cod) from a path or Perfecto Lab repository on the device
@Then("^I uninstall all applications$") resetApplications() Uninstalls all non-preinstalled apps from device
@Then("^application version should be "(.*?)"$") boolean verifyAppVersion(String version) Verifies app version is version; returns true if it is, false otherwise
@Then("^application version must be "(.*?)"$") assertAppVersion(String version) Asserts app version is version; aborts if not
@Then("^application orientation should be "(.*?)"$") boolean verifyAppOrientation(String orientation) Verifies app orientation is orientation; returns true if it is, false otherwise
@Then("^application orientation must be "(.*?)"$") assertAppOrientation(String orientation) Asserts app orientation is orientation; aborts if not
@Then("^I click on "(.*?)"$") iClick(String locator) Clicks on element by [[Object Repository
@Then("^I enter "(.?)" to "(.?)"$") iSet(String text, String locator) Sets the text of the app element by [[Object Repository
@Then("^"(.*?)" should exist$") boolean verifyLocator(String locator) Verifies app element exists; returns true if the element exists, false otherwise
@Then("^"(.*?)" must exist$") assertLocator(String locator) Asserts app element exists; aborts if not
@Then("^I should see text "(.*?)"$") boolean verifyVisualText(String text) Verifies text is visible on device, using Visual Analysis; returns true if it is, false otherwise
@Then("^I must see text "(.*?)"$") asserVisualText(String text) Asserts text is visible on device, using Visual Analysis; aborts if not
@Then("^I must see image "(.*?)"$") assertVisualImg(String img) Asserts image in [[Lab Repository
@Then("^I should see image "(.*?)"$") verifyVisualImg(String img) Verifies image in [[Lab Repository
@Then("^I switch to native context$") switchNativeContext() Switches to native [[context
@Then("^I switch to webview context$") switchWebviewContext() Switches to web [[context
@Then("^I switch to visual context$") switchVisualContext() Switches to visual [[context
@Then("^I wait for "(\d*\.?\d*)" seconds$") waitFor(long seconds) Sleeps specified duration (seconds) before continuing execution
@Then("^I wait "(\d*\.?\d*)" seconds for "(.*?)" to appear$") waitToAppear(long seconds, String locator) Fluently waits specified duration (seconds) for app element (by [[Object Repository
@Then("^I wait "(\d*)" seconds to see the text "(.*?)"$") waitForText(int seconds, String text) Fluently waits specified duration (seconds) for text to be visible on device, using Visual Analysis
@Then("^I wait "(\d*)" seconds to see the image "(.*?)"$") waitForImg(int seconds, String image) Fluently waits specified duration (seconds) for image in [[Lab Repository
@Then("^I wait "(\d*\.?\d*)" seconds for elements to appear$") waitToAppear(long seconds) Sets implicit wait duration (seconds)
@Then("^I open browser to webpage "(.*?)"$") navigateToURL(String url) Opens browser at specified URL
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.