CucumberSwift
CucumberSwift copied to clipboard
Add a screenshot to scenario in AfterScenario
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.
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.