Repository navigation
Closed
Labels
TYPE: bugThe described behavior is considered as wrong (bug).The described behavior is considered as wrong (bug).
Description
What is your Scenario?
A regression was introduced in testcafe 2.3.0 which causes the following code to throw an error.
It used to run in older versions of testcafe and does not look faulty.
What is the Current behavior?
Running the test fails with this message:
~/tmp/testcafe-bug » npx testcafe chrome:headless
ERROR Cannot prepare tests due to the following error:
TypeError: _index.test.meta is not a function
at Object.<anonymous> (/Users/user/tmp/testcafe-bug/tests/test.js:14:6)
Type "testcafe -h" for help.
What is the Expected behavior?
the test runs without issues
What is your public website URL? (or attach your complete example)
What is your TestCafe test code?
// this is working:
//import { Selector } from 'testcafe';
// this works also:
//import { Selector, fixture } from 'testcafe';
// this causes the described error message:
import { Selector, fixture, test } from 'testcafe';
const nameInput = Selector('#developer-name');
fixture `A set of examples that illustrate how to use TestCafe API`
.page `https://devexpress.github.io/testcafe/example/`;
// Tests
test.meta('dev', 'true')('Text typing basics', async t => {
await t
.typeText(nameInput, 'Peter') // Type name
.typeText(nameInput, 'Paker', { replace: true }) // Replace with last name
.typeText(nameInput, 'r', { caretPos: 2 }) // Correct last name
.expect(nameInput.value).eql('Parker'); // Check result
});Your complete configuration file
No response
Your complete test report
No response
Screenshots
No response
Steps to Reproduce
- create the testfile with the code above
- run it either with
npx testcafe chromeor whatever - see it fail
if you change to another kind of import in the first few lines it is working. It stops working as soon as test is imported from testcafe package (which makes typehints in your editor possible, that's why we have this somewhat redundant import)
TestCafe version
2.3.0
Node.js version
No response
Command-line arguments
irrelevant
Browser name(s) and version(s)
No response
Platform(s) and version(s)
No response
Other
No response
Metadata
Metadata
Assignees
Labels
TYPE: bugThe described behavior is considered as wrong (bug).The described behavior is considered as wrong (bug).
Activity
Aleksey28 commentedon Feb 2, 2023
Hi @michael-mader,
I reproduced the issue. As a workaround, you can put
metaafter the test function:We will update this thread once we have news.
michael-mader commentedon Feb 2, 2023
yes that works. I've tested it before but it is really tedious to change this for 200+ tests 😞
For now I stick with the old version of testcafe until this is fixed
fix: fixed regression with using tests and fixture methods (#7491)
github-actions commentedon Feb 6, 2023
Release v2.3.1-rc.1 addresses this.