New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Photographer doesn't capture screenshots if an alert dialog is open #532
Comments
Hey @mtahat - good catch, I haven't considered how the photographer would interact with JavaScript alerts yet. Based on your experience, it looks like it doesn't like them. Sorry about that. The easiest way to work around this would be to take screenshots only upon failures, so: Photographer.whoWill(TakePhotosOfFailures), Another workaround would be to, as a temporary measure until Serenity/JS provides a native way to do it, implement the So something along the lines of: import { PerformsActivities, UsesAbilities, Task } from '@serenity-js/core';
export class AcceptAlert extends Task {
performsAs(actor: PerformsActivities & UsesAbilities): Promise<void> {
return new Promise((resolve, reject) => {
protractor.browser.switchTo().alert().accept().then(resolve, reject);
});
}
toString() {
return `#actor dismisses an alert`;
}
} |
Hi @mtahat! Serenity/JS 2.13.0 introduced support for handling modal dialog windows, so you can now say: import { Accept, ModalDialog } from '@serenity-js/protractor';
actorInTheSpotlight().attemptsTo(
Accept.the(ModalDialog.window()),
) Also, changes introduced in 2.17.3 make the Hope this helps! |
Hello @jan-molak I am using Serenity-js with Cucumber, protractor & typescript ( see dependencies below) .
One of my test cases start showing Chrome Alert,

I was able to by pass the alert by this interaction ( thank's to one of your posts)

###Is there any workaround I can implement to skip taking screenshot for this Interaction?
I tried a lot of things but nothing seems to work.. I tried to remove the photographer from protractor.config and pass it as actor in the before hook Photographer.whoWill(TakePhotosOfInteractions), then in the After hook I ran it with another photographer who only takes screenshot for failures, but that didn't work as well.
@jan-molak any help will be appreciated!
Thanks
FYI: I used the template cucumber/serenity template that you have here to build my project. see dependencies below, I am also using Mac book, VS Code IDE.
Hooks.ts
Dependencies
Protractor.config
The text was updated successfully, but these errors were encountered: