WebdriverIO Appium Automation Test Status Marking Issue

I am using webdriverIO to run Appium app automation test and using below hooks to mark the status. But not sure why they are not marking correctly. Could you please help?

afterScenario: function (result) { if (result.passed === true) { driver.executeScript(‘lambda-status=passed’); } else { driver.executeScript(‘lambda-status=failed’); }

1 Like

Hey Yanisleidi,

We understand the concern you’re facing. To address this issue, consider updating your hooks as shown below. This modification ensures that the correct status is set based on the test result:

afterScenario: function (result) {
  if (result.passed) {
    browser.executeScript('lambda-status=passed', []);
  } else {
    browser.executeScript('lambda-status=failed', []);

Here are the enhancements made to the code:

  1. Use browser Instead of driver: Ensure consistency in the variable naming. In the original code, driver was used, but it seems like you are working with browser based on the provided example.

  2. Pass an Empty Array to executeScript: The executeScript method may take an array of arguments, even if it’s empty. Providing an empty array can help prevent potential issues.

By incorporating these adjustments, the hook should correctly mark the test status based on whether it passed or failed. If the issue persists, consider checking the Appium and WebdriverIO documentation for any specific considerations or updates related to the version you are using.

Feel free to reach out if you have any further questions or if additional assistance is needed!

Thank you so much and Happy Testing!!! :blush::heart: