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

should have texts fails with unclear message in case of "empty list" found by browser.all #98

Open
yashaka opened this issue May 22, 2019 · 1 comment

Comments

@yashaka
Copy link
Collaborator

yashaka commented May 22, 2019

import { Browser, have, perform } from 'selenidejs';

let browser: Browser;

describe('TodoMVC', () => {

    beforeAll(async () => {
        browser = Browser.chrome();
        jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;
    });

    afterAll(async () => {
        await browser.quit();
    });

    it('completes task', async () => {

        await browser.open("http://todomvc.com/examples/emberjs/");

        await browser.element('//*[@id="new-todo"]').type('a').then(perform.pressEnter);
        await browser.element('//*[@id="new-todo"]').type('b').then(perform.pressEnter);
        await browser.element('//*[@id="new-todo"]').type('c').then(perform.pressEnter);
        await browser.all('//*[@id="new-todo"]//li').should(have.exactTexts('a', 'b', 'c'));
    });
});

fails with:

1) TodoMVC completes task
  Message:
    Error: 
    	Timed out after 4000ms, while waiting for:
    	browser.all(By(xpath, //*[@id="new-todo"]//li)).has exact texts a,b,c
    Reason:
    	Cannot read property 'includes' of undefined
  Stack:
    Error: 
    	Timed out after 4000ms, while waiting for:
    	browser.all(By(xpath, //*[@id="new-todo"]//li)).has exact texts a,b,c
    Reason:
    	Cannot read property 'includes' of undefined
        at <Jasmine>
        at processTicksAndRejections (internal/process/next_tick.js:81:5)

1 spec, 1 failure
Finished in 8.89 seconds

It should fail actually, because the //*[@id="new-todo"]//li selector is wrong (should be todo-list instead of new-todo), but the error is unclear...

maybe the reason is somewhere here: https://github.com/KnowledgeExpert/selenidejs/blob/master/lib/utils/predicates.ts#L25

the fix is needed:)

reproduced in branch: https://github.com/KnowledgeExpert/selenidejs/tree/new-not-syntax-for-conditions

@alex-popov-tech
Copy link
Collaborator

as far as I see, query.text returns empty array, which is fine, and I wasn't able to figure out how compare actually works, so please take this one @yashaka

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants