Testcafe: Selector gets stuck.

Created on 31 Oct 2018  路  3Comments  路  Source: DevExpress/testcafe

What is your Test Scenario?

I want to test the amount of properties that get displayed in the left block of this link changing cities in the city name input. The properties all have an item with the class name .unit-address--show-name (you can do document.getElementsByClassName to make sure what items I am talking about). Good.

What is the Current behavior?

The first time the test is run, the selector.count works fine. However, when the test changes the city and waits, the selector seems to stop working, and no error message is shown for a long period of time. After a while I get a TyperError: Cannot read property '0' of null from the replicator package under node_modules. (sometimes it gets to the third, but most of the time it fails in the second one)

What is the Expected behavior?

The test goes normally, and if in case the selector does not exist, make it explicit what the problem is.

What is聽your web application and聽your TestCafe聽test code?

//myTest.ts
fixture(`Consumer Portal`)
    .page(`https://rentalbeast.com/apartments/for_rent/`)
    .beforeEach(async t => {
        await t.resizeWindow(1168, 750);
    });

test.only('Test search by city', async t => {
    const cities = ['Miami', 'Boston', 'Chicago'];
    for (let j = 0; j < cities.length; j++) {
        const city = cities[j];
        await t
            .click('.main-search-input--desktop') // selects the input
            .pressKey('ctrl+a delete') // deletes whatever was there before
            .typeText('.main-search-input--desktop', city) // types the new city
            .wait(3000) // waits for three seconds
            .click('.search-by-location--button') // clicks on the "search" button
            .wait(6000); // waits 6 secs to get the properties

        console.log('getting matches...'); //second time it gets only until here
        const selector = Selector('.unit-address--show-name'); // The properties selectors.
        const exists = await selector.exists;
        console.log('exists', exists); // First time this is true, second time it doesn't get here
        const count = await selector.count;
        console.log('count', count);// Gets  here only the first time
    }
});

Your website URL (or attach your complete example):

So if you run this test you'll see this on the console.

screenshot from 2018-10-31 15-10-06

As you can see, it never gets to the third (sometimes even to the second) cycle, and I don't understand what the error is about. I checked and the elements exist.

Steps to Reproduce:

  1. Run the attached script
  2. execute the test with testcafe in firefox or opera testcafe firefox myTest.ts
  3. See the console.

Your Environment details:

  • testcafe version: 0.23.0
  • node.js version: 8.10.0
  • command-line arguments: testcafe firefox myTest.ts
  • browser name and version: Firefox 63.0 (64-bit)
  • platform and version: Linux Ubuntu 18.04.1 LTS
  • other: using yarn.
client Auto-locked bug

Most helpful comment

Hi @madroneropaulo

Thank you for the detailed information. I've reproduced the problem.

All 3 comments

Hi @madroneropaulo

Thank you for the detailed information. I've reproduced the problem.

I cannot reproduce the issue on the latest commit (https://github.com/DevExpress/testcafe/commit/437fbb4ce4a97425b4e6d74ccf8ed51546d526ec)

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.

Was this page helpful?
0 / 5 - 0 ratings