-
Notifications
You must be signed in to change notification settings - Fork 661
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
ERROR No tests to run. Either the test files contain no tests or the filter function is too restrictive. #2889
Comments
It works if there is atleast one test below fixture like this. import commonScripts from './commonScripts.js'; fixture('google') test('wait', async t => { |
Seems to be an issue with the static analysis testcafe does to determine testfiles. It would be nice to be able to add an annotation to allow importing tests as modules |
Helpful thanks |
@subbiah2806 @ljowen const commonScripts = {
testSet1 () {
return [{
testName: 'test',
testFn: async t => {
await t.click('a');
}
}];
}
};
export default commonScripts; import commonScripts from './test-module';
fixture `gh-1312`
.page `http://example.com`;
function startTesting(testSet) {
for (let i = 0; i < testSet.length; i++)
test(testSet[i].testName, testSet[i].testFn);
}
startTesting(commonScripts.testSet1()); It will allow structurizing your tests as you wish and avoid the code analyzer's restrictions. |
Hello, I am currently having the same issue and I don't understand how this solution works. Could you please explain. |
@Jgshirley function startTesting(testSet) {
for (let i = 0; i < testSet.length; i++)
test(testSet[i].testName, testSet[i].testFn);
} It allows me to bypass the restrictions of the static analyzer. |
The same problem occurred to me and i found out it was the .tsx extension that caused the problem. Changing back to .ts fixed it. 👍 |
I just got bit by the same issue as @dirkrooijakkers. Might be worth updating the documentation to indicate that TSX files are not supported or point to documentation that lets you point testcafe to the right |
@AndreyBelym ah, thanks for the reference. |
This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow. |
reporting a bug?
I have written the test in another file and calling it below the fixture, but now I am getting this error.
ERROR No tests to run. Either the test files contain no tests or the filter function is too restrictive.
Test code
---CommonScripts.js---
const commonScripts = {
google() {
test('google', async t => {
await t
.typeText('#tsf > div:nth-child(2) > div.A8SBwf > div.RNNXgb > div > div.a4bIc > input', 'Hello World');
});
}
};
export default commonScripts;
---google.js---
import commonScripts from './commonScripts.js';
fixture('google')
.disablePageReloads
.page('https://google.com');
commonScripts.google();
Specify your
The text was updated successfully, but these errors were encountered: