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

feat: no-implicit-wait #39

Open
codejedi365 opened this issue Nov 14, 2021 · 0 comments
Open

feat: no-implicit-wait #39

codejedi365 opened this issue Nov 14, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@codejedi365
Copy link
Collaborator

codejedi365 commented Nov 14, 2021

Feature Request

Add rule to error against the detection of an implicit browser side wait. This can lead to brittle tests. The smart assertion timeouts should be used instead.

Problem & Goal

Expected behavior

// page.test.js - invalid example
const detectResult = ClientFunction(() => { 
  setTimeout(() => {
     return document.querySelector(".foo")
  }, 2000) 
});

test('result', async (t) => {
    await t.click("#btnAction")
    await t.expect(detectResult).ok();
});
# Run Lint
eslint ./tests/page.test.js

Should return an error on line 2, highlighting the setTimeout(...). Recommend using TestCafe's built-in wait mechanism for selectors.

// page.test.js - desired implementation

test('result', async (t) => {
    await t.click("#btnAction")
    await t.expect(Selector(".foo").exists).eql("Hello");
});
@codejedi365 codejedi365 added the enhancement New feature or request label Nov 14, 2021
@codejedi365 codejedi365 self-assigned this Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant