At first, let’s implement a new method of the OrderPage class (we use a very simple page-object model here). This class also includes another method to open the page and element locators as getters. browser is a global WebdriverIO object that allows you to interact with the pre-initialized web browser of your choice. I used “wdio-chromedriver-service” to start Google Chrome, but you can use a different service.
waitForMarketValuesToLoad method is waiting for the required fields to load the real values which are not the dashes (-). As you could probably guess, the dashes are loaded immediately upon opening the page and then the real values slowly start to appear, it can take several seconds to load values in those 4 fields. You can also add regular expressions to check the contents of the fields additionally or do it later at your verification point with assertions.
Now it’s time to add our new method to the actual test. Note that waitForMarketValuesToLoad method is using named parameters which allow us to use default values and skip certain explicit waits. In this particular case we don’t wait for the value to load in dayBeforeValue field on the page.