Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Test Appium session interacting with the Barista API
public void testCustomerDeviceWithBaristaApi()
// Create a session for the customer app
phone = new AppiumDriver(sauceURL, deviceCapabilities);
// Create an API service that interacts with the mobile app
baristaAPI = new BaristaAPI(barristUsername, baristaPassword);
// Customer logs into mobile app on mobile device
// Customer selects a coffee -- after login succeeded
coffeeButton = phoneWait.until(ExpectedConditions.elementToBeClickable(mobileApp.menuScreen.coffeeButton));;
// API finds the customer order and sets it to out of stock
order = baristaApi.findOrdersForCustomer(customer.username).get(0);
// Customer is prompted to cancel or place new order
orderConfirmationDialog = phoneWait.until(ExpectedConditions.visibilityOfElementLocated(mobileApp.orderConfirmationDialog));
// User receives out of stock notification and can cancel or place new order
assertThat(orderConfirmationDialog.getText()).contains("Out of Stock");
assertThat(orderConfirmationDialog.findElement(By.accessibilityId("Cancel Order"))).exists();
assertThat(orderConfirmationDialog.findElement(By.accessibilityId("Place New Order"))).exists();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.