Solution: Order Workflow

Review the solution to writing a test to complete the entire work order flow.

Challenge solution

Let's review the code for the challenge exercise.

Order details page object

The solution for the ​​orderDetails.page.js is provided below

Press + to interact
import Page from './page'
class OrderDetailsPage extends Page {
async deleteOrder() {
await $('button=Delete').click()
}
async navigateToEditOrder() {
await $('button=Edit').click()
}
/**
* Selects a specific order detail
* @param {*} field ex. Name, Email, Phone, Category, Description
* @param {*} content the visible text in the field
*/
orderDetail(field, content) {
return $(`h5=${field}: ${content}`)
}
}
export default new OrderDetailsPage()

Let's explain the code above:

  • In line 5, we select a button element with the text “Delete” and ...