Skip to content
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

Session storage doesn't save values after navigation when a role is used #3232

Closed
AndreyBelym opened this issue Dec 17, 2018 · 5 comments
Closed
Labels
AREA: client STATE: Auto-locked An issue has been automatically locked by the Lock bot. SYSTEM: driver TYPE: bug The described behavior is considered as wrong (bug).
Milestone

Comments

@AndreyBelym
Copy link
Contributor

What is your Test Scenario?

Retrieve a value from the session storage after a page navigation when using a role.

What is the Current behavior?

The session storage is empty after a page navigation when a role is used.

What is the Expected behavior?

The session storage contains previously stored values after a page navigation when a role is used.

What is your web application and your TestCafe test code?

Your website URL (or attach your complete example):
http://devexpress.github.io/testcafe/example/

Your complete test code (or attach your test files):
import Page from './page-model';

import { Role } from 'testcafe';

// Page model
const page = new Page();

const role = new Role('http://devexpress.github.io/testcafe/example/', () => {});

fixture `A set of examples that illustrate how to use TestCafe API`
    .page `https://devexpress.github.io/testcafe/example/`
    .beforeEach(t => t.useRole(role));

// Tests
test('Handle native confirmation dialog', async t => {
    await t
        .setNativeDialogHandler(() => true)
        .click(page.populateButton);

    const dialogHistory = await t.getNativeDialogHistory();

    await t.expect(dialogHistory[0].text).eql('Reset information before proceeding?');

    await t
        .click(page.submitButton)
        .expect(page.results.innerText).contains('Peter Parker');
}); 

Steps to Reproduce:

Run the test

Your Environment details:

  • testcafe version: 0.23.3-alpha.4
  • node.js version: any
  • command-line arguments: N/A
  • browser name and version: Chrome 71
  • platform and version: Windows 10
@morganduverney
Copy link

I maintain a fairly large Testcafe suite on my current project, and we depend heavily on role-switching. I've been struggling with what appears to be this issue since 0.23.2 was released. We're going to pin 0.23.1 in our project for now. Definitely looking forward to the fix, thank you for your work on it!

@AndreyBelym
Copy link
Contributor Author

AndreyBelym commented Dec 21, 2018

Hi @morganedmonds, this issue can be reproduced in 0.23.1 as well. Could you please create a new issue and provide the information that I can use to reproduce the problem: an example project, your test files, the page URL or source code?

You could also try [email protected] we've fixed a lot of problems in this version.

@morganduverney
Copy link

Hi @AndreyBelym, yes we figured that out. I was able to work around the issue by clicking on a link to the URL rather than navigating to it directly. I'm afraid I don't have time to put together a sample project in the next couple of weeks with the holidays, and I can't share our app code. Thank you for following up!

@AndreyBelym
Copy link
Contributor Author

After examing the problem, I consider this issue as a duplicate of issue #2195. A Role should reload the test page, but it doesn't happen in some situations. The workaround is to manually reload the page after using a Role, e.g.:

const reloadPage = ClientFunction(() => location.reload());

await t.useRole(role);

await reloadPage();

@lock
Copy link

lock bot commented Mar 27, 2019

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.

@lock lock bot added the STATE: Auto-locked An issue has been automatically locked by the Lock bot. label Mar 27, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AREA: client STATE: Auto-locked An issue has been automatically locked by the Lock bot. SYSTEM: driver TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

2 participants