I have below code and it will dynamically inject optionName
to a xpath.
And try to click on it.
getSortOptionByName(optionName: string) {
return $(`//android.widget.Button[@content-desc="${optionName}"]`);
}
Below is the full code.
public async selectingEachSortOption(): Promise<void>
{
const sortOptions = await this.getAllTheAvailableSortOptions();
for(const sortItem of sortOptions){
await (await this.getSortOptionByName(sortItem)).waitForDisplayed({ timeout: 5000 });
await (await this.getSortOptionByName(sortItem)).waitForEnabled({ timeout: 5000 });
await (await this.getSortOptionByName(sortItem)).click();
this.clickOnSortByDropDown();
}
}
When I use this code in my test, It will iterate through the 1st loop.(I have 4 loops)
But at the 2nd loop, it will end with no errors and the test will mark as pass.
What are the possible mistakes I’m doing here?
Source: Read More