-
Notifications
You must be signed in to change notification settings - Fork 674
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
import { fixture, test } from 'testcafe' #1735
Comments
@AndreyBelym this issue it was don't resolved, I tested your suggestion but don't a success. |
Hello, I've prepared an example to import both export const fixture = (...args) => global.fixture(...args);
export const test = (...args) => global.test(...args); test-1.js: import { fixture, test } from './testcafe-defs';
import { Selector } from 'testcafe';
fixture `Fixture 1`
.page `https://google.com`;
test('test 1', async t => {
await t
.typeText(Selector('#tsf > div:nth-child(2) > div.A8SBwf > div.RNNXgb > div > div.a4bIc > input'), 'TestCafe')
.pressKey('enter');
}); test-2.js: import { fixture, test } from './testcafe-defs';
import { Selector } from 'testcafe';
fixture `Fixture 2`
.page `https://google.com`;
test('test 2', async t => {
await t
.typeText(Selector('#tsf > div:nth-child(2) > div.A8SBwf > div.RNNXgb > div > div.a4bIc > input'), 'TestCafe')
.pressKey('enter');
}); TestCafe command:
TestCafe runner: const createTestCafe = require('testcafe');
let testcafe = null;
createTestCafe('localhost', 1337, 1338)
.then(tc => {
testcafe = tc;
const runner = testcafe.createRunner();
return runner
.src(['tests/test-*.js'])
.browsers(['chrome'])
.run();
})
.then(failedCount => {
console.log('Tests failed: ' + failedCount);
testcafe.close();
}); |
@Farfurix thanks a lot |
You are welcome. |
To complement this information, we can take another approach: Create file below: .testcaferc.json "src": ["./clear.js","./tests/**/main.js"] |
Are you requesting a feature or reporting a bug?
I am requesting a feature
What is the current behavior?
feature
andtest
are globals and have to be configured as such in ESLintWhat is the expected behavior?
I would like to avoid globals in the same way as I do in
mocha
: by importing the necessary functions fromtestcafe
:Specify your
The text was updated successfully, but these errors were encountered: