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

TestCafe should wait until the role initializer is completely finished before saving storages #4978

Closed
AlexKamaev opened this issue Apr 13, 2020 · 1 comment
Assignees
Labels
SYSTEM: roles An issue related to the User Roles functionality. TYPE: bug The described behavior is considered as wrong (bug).
Milestone

Comments

@AlexKamaev
Copy link
Contributor

You can reproduce the issue with the following code:

import { Role, Selector } from 'testcafe';

const testUser = Role('https://www.instagram.com/accounts/login/', async t => {
    const login = Selector('#react-root > section > main > div > article > div > div:nth-child(1) > div > form > div:nth-child(2) > div > label > input');
    const password = Selector('#react-root > section > main > div > article > div > div:nth-child(1) > div > form > div:nth-child(3) > div > label > input');
    const submit = Selector('#react-root > section > main > div > article > div > div:nth-child(1) > div > form > div:nth-child(4) > button');

    await t.typeText(login, '******');
    await t.typeText(password, '*****');
    await t.click(submit);

    // NOTE: here is a workaround
    // await t.wait(10000);

}, { preserveUrl: true });

fixture `Instagram`
    .page`https://www.instagram.com/`
    .beforeEach(async t => {
        await t.setTestSpeed(0.3);
        await t.useRole(testUser);
    });

test(`test1`, async t => {
    await t.navigateTo('https://www.instagram.com/cristiano/');
    await t.wait(5000);
});

test(`test2`, async t => {
    await t.navigateTo('https://www.instagram.com/leomessi/');
    await t.wait(5000);
});

test(`test3`, async t => {
    await t.navigateTo('https://www.instagram.com/neymarjr/');
    await t.wait(5000);
});

You can uncomment:

    // NOTE: here is a workaround
    // await t.wait(10000);

to make the test work

@AlexKamaev AlexKamaev added STATE: Need research TYPE: bug The described behavior is considered as wrong (bug). SYSTEM: roles An issue related to the User Roles functionality. labels Apr 13, 2020
@AlexKamaev AlexKamaev added this to the Planned milestone Apr 13, 2020
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label May 29, 2020
@AlexKamaev AlexKamaev removed the STATE: Need response An issue that requires a response or attention from the team. label Jun 1, 2020
@Aleksey28 Aleksey28 self-assigned this Dec 14, 2021
@Aleksey28
Copy link
Collaborator

This example works with the latest version of the testcafe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SYSTEM: roles An issue related to the User Roles functionality. TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

3 participants