Skip to content

Commit

Permalink
If scenario pass or fail in SauceLabs Dashboard (#145)
Browse files Browse the repository at this point in the history
This commit fix how it shows in SauceLabs dashboard when scenario fail or pass, actually always shows status "Complete"

Co-authored-by: Diego Molina <[email protected]>
  • Loading branch information
cport93 and diemol authored Jul 15, 2024
1 parent 33b0da7 commit bc8016a
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,27 @@ public void setUp(Scenario scenario) throws MalformedURLException {

@io.cucumber.java.After
public void tearDown(Scenario scenario){
driver.quit();
try {
if (scenario.isFailed()) {
if (driver != null) {
System.out.println("Test Failed!");
driver.executeScript("sauce:job-result=failed");
driver.quit();
}

} else {
if (driver != null) {
System.out.println("Test Passed!");
driver.executeScript("sauce:job-result=passed");
driver.quit();
}
}
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
System.out.println("Release driver");
driver.quit();
}
}

@Given("I open the iOS application")
Expand Down

0 comments on commit bc8016a

Please sign in to comment.