-
Notifications
You must be signed in to change notification settings - Fork 675
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
await ctx.eval(() => location.reload(true)); doesn't refresh the page from fixture #3502
Comments
Fixtures You can refresh the tested page in the fixture `Create Mail fixture`
.page(process.env.SERVER_HOST_URL)
....
.beforeEach(async t => {})
.afterEach(async t => {
await t.eval(() => location.reload(true));
or
await t.navigateTo(process.env.SERVER_HOST_URL)
}); |
Sorry but as mentioned in the question, i don't want to refresh the page after each tests but would like to refresh the page after fixture to save the time and free occupied resources. Please reopen the question. |
Could you please clarify what resources you are going to release and how this will help you save time? |
Our application occupies some memory which it releases on refreshing browser but we don't want to reload browser on each tests but once per fixture only. If we reload the browser on each test then it will obviously will take more time because application waits till it loads fine. |
In the following example, we have one specified Start Page and, as you can see in your browser, the page is reloaded twice after fixture `MyFixture`
.page `http://devexpress.github.io/testcafe/example`;
test('Test1', async t => {
await t.wait(2000);
});
test('Test2', async t => {
await t.wait(2000);
});
test('Test3', async t => {
await t.wait(2000);
}); |
@jiteshsojitra You can not reload the tested page in At present, I advise you to use the workaround from the #1345: function once(fn) {
var executed = false;
return function() {
if (!executed) {
executed = true;
return fn.apply(this, arguments);
}
};
}
fixture `My fixture`
.afterEach(once(async t => {
await ctx.eval(() => location.reload(true))
})); |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests. For TestCafe API, usage and configuration inquiries, we recommend asking them on StackOverflow. |
How can we refresh the page/URL from fixture? Tried await ctx.eval(() => location.reload(true)); but it doesn't work, the same code works fine from the test but not from fixture (.after).
What is your Test Scenario?
Error:
What is the Current behavior?
What is the Expected behavior?
Your Environment details:
v1.0.1
v8.12.0
The text was updated successfully, but these errors were encountered: