Skip to content

Releases: DevExpress/testcafe

v0.11.0 (2016-12-8)

08 Dec 11:40
Compare
Choose a tag to compare

Enhancements

⚙️ Redesigned selector system. (#798)

New selector methods

Multiple filtering and hierarchical methods were introduced for selectors.
Now you can build flexible, lazily-evaluated functional-style selector chains.

Here are some examples:

Selector('ul').find('label').parent('div.someClass')

Finds all ul elements on page. Then, in each found ul element finds label elements.
Then, for each label element finds a parent that matches the div.someClass selector.


Like in jQuery, if you request a property of the matching set or try evaluate
a snapshot, the selector returns values for the first element in the set.

// Returns id of the first element in the set
const id = await Selector('ul').find('label').parent('div.someClass').id;

// Returns snapshot for the first element in the set
const snapshot = await Selector('ul').find('label').parent('div.someClass')();

However, you can obtain data for any element in the set by using nth filter.

// Returns id of the third element in the set
const id = await Selector('ul').find('label').parent('div.someClass').nth(2).id;

// Returns snapshot for the fourth element in the set
const snapshot = await Selector('ul').find('label').parent('div.someClass').nth(4)();

Note that you can add text and index filters in the selector chain.

Selector('.container').parent(1).nth(0).find('.content').withText('yo!').child('span');

In this example the selector:

  1. finds the second parent (parent of parent) of .container elements;
  2. peeks the first element in the matching set;
  3. in that element, finds elements that match the .content selector;
  4. filters them by text yo!;
  5. in each filtered element, searches for a child with tag name span.

Getting selector matching set length

Also, now you can get selector matching set length and check matching elements existence by using selector count and exists properties.

Unawaited parametrized selector calls now allowed outside test context

Previously selector call outside of text context thrown an error:

const selector = Selector(arg => /* selector code */);

selector('someArg'); // <-- throws

test ('Some test', async t=> {
...
});

Now it's not a case if selector is not awaited. It's useful when you need to build a page model outside the test context:

const selector = Selector(arg => /* selector code */);
const selector2 = selector('someArg').find('span'); // <-- doesn't throw anymore

test ('Some test', async t=> {
...
});

However, once you'll try to obtain element property outside of test context it will throw:

const selector = Selector(arg => /* selector code */);

async getId() {
  return await selector('someArg').id; // throws
}

getId();

test ('Some test', async t=> {
...
});
Index filter is not ignored anymore if selector returns single node

Previously if selector returned single node index was ignored:

Selector('#someId', { index: 2 } ); // index is ignored and selector returns element with id `someId`

however it's not a case now:

Selector('#someId').nth(2); // returns `null`, since there is only one element in matching set with id `someId`
Deprecated API
const id = await t.select('.someClass').id;

// can be replaced with

const id = await Selector('.someClass').id;

⚙️ Built-in assertions. (#998)

TestCafe now ships with numerous built-in BDD-style assertions.
If the TestCafe assertion receives a Selector's property as an actual value, TestCafe uses the smart assertion query mechanism:
if an assertion did not passed, the test does not fail immediately. The assertion retries to pass multiple times and each time it re-requests the actual shorthand value. The test fails if the assertion could not complete successfully within a timeout.
This approach allows you to create stable tests that lack random errors and decrease the amount of time required to run all your tests due to the lack of extra waitings.

Example page markup:

<div id="btn"></div>
<script>
var btn = document.getElementById('btn');

btn.addEventListener(function() {
    window.setTimeout(function() {
        btn.innerText = 'Loading...';
    }, 100);
});
</script>

Example test code:

test('Button click', async t => {
    const btn = Selector('#btn');

    await t
        .click(btn)
        // Regular assertion will fail immediately, but TestCafe retries to run DOM state
        // assertions many times until this assertion pass successfully within the timeout.
        // The default timeout is 3000 ms.
        .expect(btn.textContent).contains('Loading...');
});

⚙️ Added selected and selectedIndex DOM node state properties. (#951)

⚙️ It's now possible to start browser with arguments. (#905)

If you need to pass arguments for the specified browser, write them right after browser alias. Surround the browser call and its arguments with quotation marks:

testcafe "chrome --start-fullscreen",firefox tests/test.js

See Starting browser with arguments.

Bug Fixes

  • Action keyboard events now have event.key and event.keyIdentifier properties set (#993).
  • document.body.nextSibling, that was broken is some cases previously, now operates properly (#958).
  • Now it's possible to use t.setFilesToUpload and t.clearUpload methods with the hidden inputs (#963).
  • Now test not hangs if object toString method uses this.location getter (#953).
  • Touch events now correctly dispatched in latest Chrome versions with touch monitor (#944).
  • Now test compilation doesn't fail if imported helper contains module re-export (e.g. export * from './mod') (#969).
  • Actions now scroll to element to make it completely visible (there possible) (#987, #973).
  • Dispatched key events now successfully pass instanceof check (#964).
  • Ember elements doesn't throw Uncaught TypeError: e.getAttribute is not a function anymore (#966).
  • First run wizards now automatically disabled in Chrome in Firefox (testcafe-browser-tools#102).
  • <td> now correctly focused on actions (testcafe-hammerhead#901).
  • document.baseURI now returns correct value (testcafe-hammerhead#920).
  • Function.constructor now returns correct value (testcafe-hammerhead#913).
  • Setting location to the URL hash value doesn't lead to JavaScript error anymore ([testcaf...
Read more

v0.11.0-alpha2

30 Nov 12:32
Compare
Choose a tag to compare
v0.11.0-alpha2 Pre-release
Pre-release
Bump version (#1008)

v0.11.0-alpha1: Update testcafe-hammerhead. Bump version. (#1001)

29 Nov 11:40
Compare
Choose a tag to compare
* Update testcafe-hammerhead. Bump version.

* update hammerhead to 10.1.5

v0.11.0-alpha

16 Nov 16:03
Compare
Choose a tag to compare
v0.11.0-alpha Pre-release
Pre-release
Update hammerhead. Set alpha tag. Bump version. (#972)

v0.10.0 (2016-11-8)

08 Nov 13:18
Compare
Choose a tag to compare

Enhancements

  • Snapshot API shorthands. (#771)

    Previously, if you needed to use a single property from the snapshot, you had to introduce two assignments

    const snapshot = await selector();
    const nodeType = snapshot.nodeType;

    or additional parentheses.

    const nodeType = (await selector()).nodeType;

    Now snapshot methods and property getters are exposed by selectors
    (and selector promises as well) so that you can write more compact code.

    const nodeType = await selector.nodeType;
    
    // or
    
    const nodeType = await selector('someParam').nodeType;

    However, shorthand properties do not allow you to omit parentheses when working with dictionary properties
    like style, attributes or boundingClientRect.

    const width = (await selector.style)['width'];

    That is why we have also introduced shorthand methods for these dictionaries: getStyleProperty, getAttribute and getBoundingClientRectProperty.

    const width = await selector.getStyleProperty('width');
    const id    = await selector.getAttribute('id');
    const left  = await selector.getBoundingClientRectProperty('left');

    Finally, we have added the hasClass method.

    if (await selector.hasClass('foo')) {
        //...
    }

    See Snapshot API Shorthands.

  • Improved automatic wait mechanism. (#245)

    We got rid of unnecessary waiting so that tests now run almost two times faster.

    Tests running in v0.10.0 vs v0.9.0

  • Test execution speed control. (#938)

    We have introduced an option that allows you to specify how fast tests run.

    By default, tests run at the maximum speed. However, if you need to watch a test running to understand what happens in it,
    this speed may seem too fast. In this instance, use the new speed option to slow the test down.

    This option is available from the command line

    testcafe chrome my-tests --speed 0.1

    and from the API.

    await runner.run({
        speed: 0.1
    })

    You can use factor values between 1 (the fastest, used by default) and 0.01 (the slowest).

  • t.maximizeWindow test action. (#812)

    We have added a test action that maximizes the browser window.

    import { expect } from 'chai';
    import { Selector } from 'testcafe';
    
    const menu = Selector('#side-menu');
    
    fixture `My fixture`
        .page `http://www.example.com/`;
    
    test('Side menu is displayed in full screen', async t => {
        await t.maximizeWindow();
    
        expect(await menu.visible).to.be.ok;
    });

Bug Fixes

  • The t.resizeWindow and t.resizeWindowToFitDevice actions now work correctly on macOS (#816)
  • Browser aliases are now case insensitive in the command line (#890)
  • Tests no longer hang if target scrolling coordinates are fractional (#882)
  • The 'Element is not visible' error is no longer raised when scrolling a document in Quirks mode (#883)
  • <table> child elements are now focused correctly (#889)
  • The page is no longer scrolled to the parent element when focusing on a non-focusable child during click automation (#913)
  • Browser auto-detection now works with all the Linux distributions (#104,
    #915)

v0.10.0-rc1

03 Nov 13:14
Compare
Choose a tag to compare
v0.10.0-rc1 Pre-release
Pre-release
Bump version (#942)

v0.10.0-alpha1: Update hammerhead (10.0.2) and testcafe (0.10.0-alpha1) versions (#914)

26 Oct 09:04
Compare
Choose a tag to compare
* Update hammerhead (10.0.1) and testcafe (0.10.0-alpha1) versions

* Update hammerhead to 10.0.2

* Fix server tests after babel submodules update

v0.10.0-alpha

19 Oct 13:29
Compare
Choose a tag to compare
v0.10.0-alpha Pre-release
Pre-release
Update version to 0.10.0-alpha (#900)

v0.9.0 (2016-10-18)

17 Oct 12:09
Compare
Choose a tag to compare

🎉 Initial release 🎉

0.9.0-rc2

17 Oct 09:10
Compare
Choose a tag to compare
0.9.0-rc2 Pre-release
Pre-release
Bump version to RC2 (#881)