serenity-js / serenity-js Public
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
can i get an equivalant to browser.refresh(); #236
Comments
Hey @kdp88! Serenity/JS doesn't support that out of the box yet, but it definitely should :-) In the meantime, you could use something along those lines: import { protractor } from 'protractor';
import { Interaction } from '@serenity-js/core/lib/screenplay';
const Refresh = () => Interaction.where(`#actor reloads the website`, actor => {
return protractor.browser.refresh();
}); Does that help? |
@jan-molak can you give me your brain Edit @jan-molak would you create a directory that houses interactions For example interactions/refresh.ts or another ts file that houses all costs that could be interactions |
My brain is for hire, so you can most certainly have it! To answer your question - sure, |
@jan-molak any idea why protractor.browser.refresh(); does not work inside --headless mode (protractor.conf.js) but works flawlessly when --headless is commented out? |
@jan-molak also when i attempt to utilize the import statement |
Can you try with
Excellent question, I'm not sure. There's a number of quirks with the |
Yes sir that worked like a charm also had to put export const, but for some reason it will not do the refresh in headless mode works perfectly without headless |
Try to include the |
@marktigno thanks for the suggestion I got that one in my conf.js as well still no dice |
another method would be opening again the same page and it will act as a refresh on the browser:
|
@marktigno is there a way to store the url to use it as a variable, basically browser.getCurrentUrl(). Because I wont know the url to navigate to as it changes I guess that would be another interaction? I cant recall if serenity has a native getCurrentUrl |
There's a question that retrieves the value of the current URL so that you can assert on it. You could use the exact same mechanism in the interaction. Does that help? |
I didn't know about this until I found that now. Thank's @jan-molak! I need to do code change on my other tests here. |
Just another question, do you know any implementations to execute back navigation on the browser? |
I'll make a mental note to add those interactions when I extract the In the meantime: import { protractor } from 'protractor';
import { Interaction } from '@serenity-js/core/lib/screenplay';
const Navigate = ({
back: () => Interaction.where(`#actor navigates back`, actor => {
return protractor.browser.navigate().back();
}),
}); |
Nice! Thanks for that @jan-molak, I'm doing the same thing here on our end by adding those helper codes on our tests. In the future I'll send PR to have them included on the |
as the title states is there a way to get browser.refresh(); to work or is there a serenity framework way to do it
The text was updated successfully, but these errors were encountered: