Tyler-Keith-Thompson / CucumberSwift

A lightweight swift Cucumber implementation
https://tyler-keith-thompson.github.io/CucumberSwift/documentation/cucumberswift/
MIT License
74 stars 19 forks source link

Add a screenshot to scenario in AfterScenario #63

Open badrinrs opened 1 year ago

badrinrs commented 1 year ago

Is your feature request related to a problem? Please describe. Since Cucumber does not extend XCTestCase, I am unable to add a screenshot at the end of scenario

Describe the solution you'd like In AfterScenario Hook, an additional parameter is provided to take screenshot at the start of afterScenario and save. That would be great.

Describe alternatives you've considered

AfterScenario { scenario in let fullScreenshot = XCUIScreen.main.screenshot() let screenshot = XCTAttachment(screenshot: fullScreenshot) screenshot.lifetime = .keepAlways // if we don't set lifetime to .keepAlways, Xcode will delete the image if the test passes.

           add(screenshot)

In the above code, add method is not accepted as it is used in extension of XCTestCase.

Additional context This would greatly help in debugging apps when running scenarios on an end to end basis.

Tyler-Keith-Thompson commented 1 year ago

This seems like a totally fair ask...I'm slammed with work at the moment so I won't be able to turn this around super quickly. It certainly seems possible, cause test cases are generated.

PRs are welcome, when my schedule eases up I'll put this on the Kanban board so that it's obvious it's being addressed.