How to use aCustomDriverModule method in root

Best JavaScript code snippet using root

test.test.js

Source:test.test.js Github

copy

Full Screen

...190 await run(`${__device_name} TheDevice`);191 expect(cliCall().command).toContain('--device-name TheDevice');192 });193 test('should omit --grep --invert for custom platforms', async () => {194 singleConfig().type = tempfile('.js', aCustomDriverModule());195 await run();196 expect(cliCall().command).not.toContain(' --invert ');197 expect(cliCall().command).not.toContain(' --grep ');198 });199 test('specifying direct test paths', async () => {200 await run(`e2e/01.sanity.test.js e2e/02.sanity.test.js`);201 expect(cliCall().command).not.toMatch(/ e2e /);202 expect(cliCall().command).not.toMatch(/ e2e$/);203 expect(cliCall().command).toMatch(/ e2e\/01.sanity.test.js e2e\/02.sanity.test.js$/);204 });205 test('e.g., --bail should be passed through', async () => {206 await run(`--bail`);207 expect(cliCall().command).toContain('--bail');208 });209 test('e.g., --reporter spec should be passed through', async () => {210 await run(`--reporter spec`);211 expect(cliCall().command).toContain('--reporter spec');212 });213 test('e.g., --bail e2e/Login.test.js should be split to --bail and e2e/Login.test.js', async () => {214 await run(`--bail e2e/Login.test.js --reporter spec`);215 expect(cliCall().command).toContain('--bail --reporter spec e2e/Login.test.js');216 });217 test.each([218 [`--runner-config "mocha configs/.mocharc"`, `--config ${quote('mocha configs/.mocharc')}`],219 [`--artifacts-location "artifacts dir/"`, `--artifacts-location ${quote('artifacts dir/')}`],220 [`--device-name "iPhone X"`, `--device-name ${quote('iPhone X')}`],221 [`"e2e tests/first test.spec.js"`, `"e2e tests/first test.spec.js"`],222 ])('should escape %s when forwarding it as a CLI argument', async (cmd, expected) => {223 await run(cmd);224 expect(cliCall().command).toContain(` ${expected}`);225 });226 });227 describe('(jest)', () => {228 beforeEach(() => {229 detoxConfig.testRunner = 'jest';230 });231 describe('given no extra args (iOS)', () => {232 beforeEach(async () => {233 singleConfig().type = 'ios.simulator';234 await run();235 });236 test('should produce a default command (integration test, ios)', () => {237 const args = `--config e2e/config.json --testNamePattern ${quote('^((?!:android:).)*$')} --maxWorkers 1`;238 expect(cliCall().command).toBe(`jest ${args} e2e`);239 });240 test('should put default environment variables (integration test, ios)', () => {241 expect(cliCall().env).toEqual({242 DETOX_START_TIMESTAMP: expect.any(Number),243 DETOX_CONFIG_PATH: expect.any(String),244 DETOX_REPORT_SPECS: true,245 DETOX_USE_CUSTOM_LOGGER: true,246 });247 });248 });249 describe('given no extra args (Android)', () => {250 beforeEach(async () => {251 singleConfig().type = 'android.emulator';252 await run();253 });254 test('should produce a default command (integration test)', () => {255 const args = `--config e2e/config.json --testNamePattern ${quote('^((?!:ios:).)*$')} --maxWorkers 1`;256 expect(cliCall().command).toBe(`jest ${args} e2e`);257 });258 test('should put default environment variables (integration test)', () => {259 expect(cliCall().env).toEqual({260 DETOX_START_TIMESTAMP: expect.any(Number),261 DETOX_CONFIG_PATH: expect.any(String),262 DETOX_REPORT_SPECS: true,263 DETOX_USE_CUSTOM_LOGGER: true,264 });265 });266 });267 describe('given skipLegacyWorkersInjection: true', () => {268 describe.each([269 ['ios.simulator'],270 ['android.emulator'],271 ])('for %s', (configurationType) => {272 it('should omit --maxWorkers CLI arg', async () => {273 singleConfig().type = configurationType;274 detoxConfig.skipLegacyWorkersInjection = true;275 detoxConfig.runnerConfig = 'package.json';276 await run();277 expect(cliCall().command).not.toMatch(/--maxWorkers/);278 });279 });280 });281 test.each([['-c'], ['--configuration']])(282 '%s <configuration> should provide inverted --testNamePattern that configuration (jest)',283 async (__configuration) => {284 detoxConfig.configurations.iosTest = { ...detoxConfig.configurations.single };285 detoxConfig.configurations.iosTest.type = 'ios.simulator';286 detoxConfig.configurations.androidTest = { ...detoxConfig.configurations.single };287 detoxConfig.configurations.androidTest.type = 'android.emulator';288 await run(`${__configuration} androidTest`);289 expect(cliCall(0).command).toContain(`--testNamePattern ${quote('^((?!:ios:).)*$')}`);290 expect(cliCall(0).env.DETOX_CONFIGURATION).toBe('androidTest');291 await run(`${__configuration} iosTest`);292 expect(cliCall(1).command).toContain(`--testNamePattern ${quote('^((?!:android:).)*$')}`);293 expect(cliCall(1).env.DETOX_CONFIGURATION).toBe('iosTest');294 }295 );296 test.each([['-o'], ['--runner-config']])('%s <path> should point to the specified Jest config', async (__runnerConfig) => {297 await run(`${__runnerConfig} e2e/custom.config.js`);298 expect(cliCall().command).toContain(`--config e2e/custom.config.js`);299 });300 test.each([['-l'], ['--loglevel']])('%s <value> should be passed as environment variable', async (__loglevel) => {301 await run(`${__loglevel} trace`);302 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_LOGLEVEL: 'trace' }));303 });304 test('--no-color should be passed as CLI argument', async () => {305 await run(`--no-color`);306 expect(cliCall().command).toContain(' --no-color ');307 });308 test.each([['-R'], ['--retries']])('%s <value> should execute successful run once', async (__retries) => {309 await run(`-R 1`);310 expect(cliCall(1)).toBe(null);311 });312 test.each([['-R'], ['--retries']])('%s <value> should clear failed tests file', async (__retries) => {313 await run(`-R 1`);314 const { resetLastFailedTests } = require('../src/utils/lastFailedTests');315 expect(resetLastFailedTests).toHaveBeenCalled();316 });317 test.each([['-R'], ['--retries']])('%s <value> should execute unsuccessful run N extra times', async (__retries) => {318 const { loadLastFailedTests } = require('../src/utils/lastFailedTests');319 loadLastFailedTests.mockReturnValueOnce(['e2e/failing1.test.js', 'e2e/failing2.test.js']);320 loadLastFailedTests.mockReturnValueOnce(['e2e/failing2.test.js']);321 cp.execSync.mockImplementation(() => { throw new Error; });322 await run(`-R 2`).catch(_.noop);323 expect(cliCall(0).command).toMatch(/ e2e$/);324 expect(cliCall(0).env).not.toHaveProperty('DETOX_RERUN_INDEX');325 expect(cliCall(1).command).toMatch(/ e2e\/failing1.test.js e2e\/failing2.test.js$/);326 expect(cliCall(1).env.DETOX_RERUN_INDEX).toBe(1);327 expect(cliCall(2).command).toMatch(/ e2e\/failing2.test.js$/);328 expect(cliCall(2).env.DETOX_RERUN_INDEX).toBe(2);329 });330 test.each([['-R'], ['--retries']])('%s <value> should not restart test runner if there are no failing tests paths', async (__retries) => {331 const { loadLastFailedTests } = require('../src/utils/lastFailedTests');332 loadLastFailedTests.mockReturnValueOnce([]);333 cp.execSync.mockImplementation(() => { throw new Error; });334 await run(`-R 1`).catch(_.noop);335 expect(cliCall(0)).not.toBe(null);336 expect(cliCall(1)).toBe(null);337 });338 test.each([['-R'], ['--retries']])('%s <value> should retain -- <...explicitPassthroughArgs>', async (__retries) => {339 const { loadLastFailedTests } = require('../src/utils/lastFailedTests');340 loadLastFailedTests.mockReturnValue(['tests/failing.test.js']);341 cp.execSync.mockImplementation(() => { throw new Error; });342 await run(`-R 1 tests -- --debug`).catch(_.noop);343 expect(cliCall(0).command).toMatch(/ --debug .* tests$/);344 expect(cliCall(1).command).toMatch(/ --debug .* tests\/failing.test.js$/);345 });346 test.each([['-r'], ['--reuse']])('%s <value> should be passed as environment variable', async (__reuse) => {347 await run(`${__reuse}`);348 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_REUSE: true }));349 });350 test.each([['-u'], ['--cleanup']])('%s <value> should be passed as environment variable', async (__cleanup) => {351 await run(`${__cleanup}`);352 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_CLEANUP: true }));353 });354 test.each([['-d'], ['--debug-synchronization']])('%s <value> should be passed as environment variable', async (__debug_synchronization) => {355 await run(`${__debug_synchronization} 5000`);356 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_DEBUG_SYNCHRONIZATION: 5000 }));357 });358 test.each([['-d'], ['--debug-synchronization']])('%s <value> should be passed as 0 when given false', async (__debug_synchronization) => {359 await run(`${__debug_synchronization} false`);360 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_DEBUG_SYNCHRONIZATION: 0 }));361 });362 test.each([['-d'], ['--debug-synchronization']])('%s <value> should have default value = 3000', async (__debug_synchronization) => {363 await run(`${__debug_synchronization}`);364 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_DEBUG_SYNCHRONIZATION: 3000 }));365 });366 test.each([['-a'], ['--artifacts-location']])('%s <value> should be passed as environment variable', async (__artifacts_location) => {367 await run(`${__artifacts_location} /tmp`);368 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_ARTIFACTS_LOCATION: '/tmp' }));369 });370 test('--record-logs <value> should be passed as environment variable', async () => {371 await run(`--record-logs all`);372 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_RECORD_LOGS: 'all' }));373 });374 test('--take-screenshots <value> should be passed as environment variable', async () => {375 await run(`--take-screenshots failing`);376 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_TAKE_SCREENSHOTS: 'failing' }));377 });378 test('--record-videos <value> should be passed as environment variable', async () => {379 await run(`--record-videos failing`);380 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_RECORD_VIDEOS: 'failing' }));381 });382 test('--record-performance <value> should be passed as environment variable', async () => {383 await run(`--record-performance all`);384 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_RECORD_PERFORMANCE: 'all' }));385 });386 test('--record-timeline <value> should be passed as environment variable', async () => {387 await run(`--record-timeline all`);388 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_RECORD_TIMELINE: 'all' }));389 });390 test('--capture-view-hierarchy <value> should be passed as environment variable', async () => {391 await run(`--capture-view-hierarchy enabled`);392 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_CAPTURE_VIEW_HIERARCHY: 'enabled' }));393 });394 describe.each([395 [false],396 [true],397 ])('when skipLegacyWorkersInjection is %j', (skipLegacyWorkersInjection) => {398 beforeEach(() => {399 Object.assign(detoxConfig, {400 skipLegacyWorkersInjection,401 runnerConfig: tempfile('.json', JSON.stringify({402 maxWorkers: 1,403 })),404 });405 });406 test.each([['-w'], ['--workers']])('%s <value> should be passed as CLI argument', async (__workers) => {407 await run(`${__workers} 2`);408 expect(cliCall().command).toContain('--maxWorkers 2');409 });410 test.each([['-w'], ['--workers']])('%s <value> should be replaced with --maxWorkers <value>', async (__workers) => {411 await run(`${__workers} 2 --maxWorkers 3`);412 const { command } = cliCall();413 expect(command).toContain('--maxWorkers 3');414 expect(command).not.toContain('--maxWorkers 2');415 });416 test.each([['-w'], ['--workers']])('%s <value> can be overriden by a later value', async (__workers) => {417 await run(`${__workers} 2 ${__workers} 3`);418 const { command } = cliCall();419 expect(command).toContain('--maxWorkers 3');420 expect(command).not.toContain('--maxWorkers 2');421 });422 test.each([['-w'], ['--workers']])('%s <value> should not warn anything for iOS', async (__workers) => {423 singleConfig().type = 'ios.simulator';424 await run(`${__workers} 2`);425 expect(logger.warn).not.toHaveBeenCalled();426 });427 test.each([['-w'], ['--workers']])('%s <value> should not put readOnlyEmu environment variable for iOS', async (__workers) => {428 singleConfig().type = 'ios.simulator';429 await run(`${__workers} 2`);430 expect(cliCall().env).not.toHaveProperty('DETOX_READ_ONLY_EMU');431 });432 test.each([['-w'], ['--workers']])('%s <value> should not put readOnlyEmu environment variable for android.attached', async (__workers) => {433 singleConfig().type = 'android.attached';434 await run(`${__workers} 2`);435 expect(cliCall().env).not.toHaveProperty('DETOX_READ_ONLY_EMU');436 });437 test.each([['-w'], ['--workers']])('%s <value> should not put readOnlyEmu environment variable for android.emulator if there is a single worker', async (__workers) => {438 singleConfig().type = 'android.emulator';439 await run(`${__workers} 1`);440 expect(cliCall().env).not.toHaveProperty('DETOX_READ_ONLY_EMU');441 });442 test.each([['-w'], ['--workers']])('%s <value> should put readOnlyEmu environment variable for Android if there are multiple workers', async (__workers) => {443 singleConfig().type = 'android.emulator';444 await run(`${__workers} 2`);445 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_READ_ONLY_EMU: true }));446 });447 });448 test('should omit --testNamePattern for custom platforms', async () => {449 singleConfig().type = tempfile('.js', aCustomDriverModule());450 await run();451 expect(cliCall().command).not.toContain('--testNamePattern');452 });453 test.each([['-t'], ['--testNamePattern']])('should override --testNamePattern if a custom %s value is passed', async (__testNamePattern) => {454 await run(`${__testNamePattern} customPattern`);455 const { command } = cliCall();456 expect(command).not.toMatch(/--testNamePattern .*(ios|android)/);457 expect(command).toMatch(/--testNamePattern customPattern($| )/);458 });459 test('--jest-report-specs, by default, should be true, as environment variable', async () => {460 await run();461 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_REPORT_SPECS: true }));462 });463 test('--jest-report-specs, by default, should be false, if multiple workers are enabled', async () => {464 await run('--workers 2');465 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_REPORT_SPECS: false }));466 });467 test('--jest-report-specs, set explicitly, should override single worker defaults', async () => {468 await run('--jest-report-specs false');469 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_REPORT_SPECS: false }));470 });471 test('--jest-report-specs, set explicitly, should override multiple workers defaults', async () => {472 await run('--workers 2 --jest-report-specs');473 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_REPORT_SPECS: true }));474 });475 test.each([['-H'], ['--headless']])('%s <value> should be passed as environment variable', async (__headless) => {476 await run(`${__headless}`);477 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_HEADLESS: true }));478 });479 test('--gpu <value> should be passed as environment variable', async () => {480 await run(`--gpu angle_indirect`);481 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_GPU: 'angle_indirect' }));482 });483 test('--device-boot-args should be passed as an environment variable (without deprecation warnings)', async () => {484 await run(`--device-boot-args "--verbose"`);485 expect(cliCall().env).toEqual(expect.objectContaining({486 DETOX_DEVICE_BOOT_ARGS: '--verbose'487 }));488 expect(logger.warn).not.toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);489 });490 test('--device-launch-args should serve as a deprecated alias to --device-boot-args', async () => {491 await run(`--device-launch-args "--verbose"`);492 expect(cliCall().env.DETOX_DEVICE_BOOT_ARGS).toBe('--verbose');493 expect(logger.warn).toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);494 });495 test('--app-launch-args should be passed as an environment variable', async () => {496 await run(`--app-launch-args "--debug yes"`);497 expect(cliCall().env).toEqual(expect.objectContaining({498 DETOX_APP_LAUNCH_ARGS: '--debug yes',499 }));500 });501 test('--use-custom-logger false should be prevent passing environment variable', async () => {502 await run(`--use-custom-logger false`);503 expect(cliCall().env).toEqual(expect.objectContaining({504 DETOX_USE_CUSTOM_LOGGER: false505 }));506 });507 test('--force-adb-install should be ignored for iOS', async () => {508 singleConfig().type = 'ios.simulator';509 await run(`--force-adb-install`);510 expect(cliCall().env).not.toHaveProperty('DETOX_FORCE_ADB_INSTALL');511 });512 test('--force-adb-install should be passed as environment variable', async () => {513 singleConfig().type = 'android.emulator';514 await run(`--force-adb-install`);515 expect(cliCall().env).toEqual(expect.objectContaining({516 DETOX_FORCE_ADB_INSTALL: true,517 }));518 });519 test.each([['-n'], ['--device-name']])('%s <value> should be passed as environment variable', async (__device_name) => {520 await run(`${__device_name} TheDevice`);521 expect(cliCall().env).toEqual(expect.objectContaining({522 DETOX_DEVICE_NAME: 'TheDevice',523 }));524 });525 test('specifying direct test paths', async () => {526 await run(`e2e/01.sanity.test.js e2e/02.sanity.test.js`);527 expect(cliCall().command).not.toMatch(/ e2e /);528 expect(cliCall().command).not.toMatch(/ e2e$/);529 expect(cliCall().command).toMatch(/ e2e\/01.sanity.test.js e2e\/02.sanity.test.js$/);530 });531 // TODO: fix --inspect-brk behavior on Windows, and replace (cmd|js) with js here532 test.each([533 ['--inspect-brk e2eFolder', /^node --inspect-brk .*jest\.(?:cmd|js) .* e2eFolder$/, {}],534 ['-d e2eFolder', / e2eFolder$/, { DETOX_DEBUG_SYNCHRONIZATION: 3000 }],535 ['--debug-synchronization e2eFolder', / e2eFolder$/, { DETOX_DEBUG_SYNCHRONIZATION: 3000 }],536 ['-r e2eFolder', / e2eFolder$/, { DETOX_REUSE: true }],537 ['--reuse e2eFolder', / e2eFolder$/, { DETOX_REUSE: true }],538 ['-u e2eFolder', / e2eFolder$/, { DETOX_CLEANUP: true }],539 ['--cleanup e2eFolder', / e2eFolder$/, { DETOX_CLEANUP: true }],540 ['--jest-report-specs e2eFolder', / e2eFolder$/, { DETOX_REPORT_SPECS: true }],541 ['-H e2eFolder', / e2eFolder$/, { DETOX_HEADLESS: true }],542 ['--headless e2eFolder', / e2eFolder$/, { DETOX_HEADLESS: true }],543 ['--keepLockFile e2eFolder', / e2eFolder$/, {}],544 ['--use-custom-logger e2eFolder', / e2eFolder$/, { DETOX_USE_CUSTOM_LOGGER: true }],545 ['--force-adb-install e2eFolder', / e2eFolder$/, { DETOX_FORCE_ADB_INSTALL: true }],546 ])('"%s" should be disambigued correctly', async (command, commandMatcher, envMatcher) => {547 singleConfig().type = 'android.emulator';548 await run(command);549 expect(cliCall().command).toMatch(commandMatcher);550 expect(cliCall().env).toEqual(expect.objectContaining(envMatcher));551 });552 test('e.g., --debug should be passed through', async () => {553 await run(`--debug`);554 expect(cliCall().command).toContain('--debug');555 });556 test('e.g., --coverageProvider v8 should be passed through', async () => {557 await run(`--coverageProvider v8`);558 expect(cliCall().command).toContain('--coverageProvider v8');559 });560 test('e.g., --debug e2e/Login.test.js should be split to --debug and e2e/Login.test.js', async () => {561 await run(`--debug e2e/Login.test.js --coverageProvider v8`);562 expect(cliCall().command).toMatch(/--debug --coverageProvider v8 e2e\/Login.test.js$/);563 });564 test.each([565 [`--testNamePattern "should tap"`, `--testNamePattern ${quote('should tap')}`],566 [`"e2e tests/first test.spec.js"`, `"e2e tests/first test.spec.js"`],567 ])('should escape %s when forwarding it as a CLI argument', async (cmd, expected) => {568 await run(cmd);569 expect(cliCall().command).toContain(` ${expected}`);570 });571 });572 describe.each([['mocha'], ['jest']])('(%s)', (testRunner) => {573 beforeEach(() => {574 detoxConfig.testRunner = testRunner;575 });576 test(`should deduce wrapped ${testRunner} CLI`, async () => {577 detoxConfig.testRunner = `nyc ${testRunner}`;578 await run();579 expect(cliCall().command).toMatch(RegExp(`nyc ${testRunner} .* e2e$`));580 });581 describe.each([['ios.simulator'], ['android.emulator']])('for %s', (deviceType) => {582 beforeEach(() => {583 Object.values(detoxConfig.configurations)[0].type = deviceType;584 });585 test('--keepLockFile should be suppress clearing the device lock file', async () => {586 await run('--keepLockFile');587 expect(DeviceRegistry).not.toHaveBeenCalled();588 });589 test('--keepLockFile omission means clearing the device lock file', async () => {590 await run();591 expect(DeviceRegistry.mock.instances[0].reset).toHaveBeenCalled();592 });593 });594 test('-- <...explicitPassthroughArgs> should be forwarded to the test runner CLI as-is', async () => {595 await run('--device-boot-args detoxArgs e2eFolder -- a -a --a --device-boot-args runnerArgs');596 expect(cliCall().command).toMatch(/a -a --a --device-boot-args runnerArgs .* e2eFolder$/);597 expect(cliCall().env).toEqual(expect.objectContaining({ DETOX_DEVICE_BOOT_ARGS: 'detoxArgs' }));598 });599 test('-- <...explicitPassthroughArgs> should omit double-dash "--" itself, when forwarding args', async () => {600 await run('./detox -- --forceExit');601 expect(cliCall().command).toMatch(/ --forceExit .* \.\/detox$/);602 expect(cliCall().command).not.toMatch(/ -- --forceExit .* \.\/detox$/);603 });604 test('--inspect-brk should prepend "node --inspect-brk" to the command', async () => {605 // TODO: fix --inspect-brk behavior on Windows606 if (process.platform === 'win32') return;607 await run('--inspect-brk');608 const absolutePathToTestRunnerJs = require.resolve(`.bin/${testRunner}`);609 expect(cliCall().command).toMatch(RegExp(`^node --inspect-brk ${absolutePathToTestRunnerJs}`));610 });611 test('should append $DETOX_ARGV_OVERRIDE to detox test ... command and print a warning', async () => {612 process.env.PLATFORM = 'ios';613 process.env.DETOX_ARGV_OVERRIDE = '--inspect-brk --testNamePattern "[$PLATFORM] tap" e2e/sanity/*.test.js';614 await run();615 const pattern = new RegExp(`^node --inspect-brk.* --testNamePattern ${quote('\\[ios\\] tap')}.* e2e/sanity/\\*\\.test.js$`);616 expect(cliCall().command).toMatch(pattern);617 expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining('$DETOX_ARGV_OVERRIDE is detected'));618 });619 });620 test('should fail for unrecognized test runner', async () => {621 detoxConfig.testRunner = 'ava';622 await expect(run('--inspect-brk')).rejects.toThrowError(/ava.*is not supported/);623 });624 // Helpers625 function tempfile(extension, content) {626 const tempFilePath = require('tempfile')(extension);627 fs.ensureFileSync(tempFilePath);628 if (content) {629 fs.writeFileSync(tempFilePath, content);630 }631 temporaryFiles.push(tempFilePath);632 return tempFilePath;633 }634 async function runRaw(command = '') {635 let argv;636 try {637 argv = process.argv.splice(2, Infinity, ...command.trim().split(' '));638 return await new Promise((resolve, reject) => {639 const testCommand = require('./test');640 const originalHandler = testCommand.handler;641 const parser = yargs()642 .scriptName('detox')643 .parserConfiguration({644 'boolean-negation': false,645 'camel-case-expansion': false,646 'dot-notation': false,647 'duplicate-arguments-array': false,648 'populate--': true,649 })650 .command({651 ...testCommand,652 async handler(argv) {653 try {654 await originalHandler(argv);655 resolve();656 } catch (e) {657 reject(e);658 }659 },660 })661 .wrap(null);662 parser.parse(command, err => err && reject(err));663 });664 } finally {665 argv && process.argv.splice(2, Infinity, ...argv);666 }667 }668 async function run(command = '') {669 detoxConfigPath = tempfile('.json', JSON.stringify(detoxConfig));670 const __configPath = Math.random() > 0.5 ? '-C' : '--config-path';671 return runRaw(`test ${__configPath} ${detoxConfigPath} ${command}`);672 }673 function cliCall(index = 0) {674 const mockCall = cp.execSync.mock.calls[index];675 if (!mockCall) {676 return null;677 }678 const [command, opts] = mockCall;679 return {680 command,681 env: _.omitBy(opts.env, (_value, key) => key in process.env),682 };683 }684 function singleConfig() {685 return Object.values(detoxConfig.configurations)[0];686 }687 function isInCMD() {688 return process.platform === 'win32' && !process.env.SHELL;689 }690 function quote(s, q = isInCMD() ? `"` : `'`) {691 return q + s + q;692 }693 function aCustomDriverModule() {694 return `695 class RuntimeDriverClass {};696 class DeviceAllocationDriverClass {};697 class DeviceDeallocationDriverClass {};698 class ExpectClass {};699 module.exports = { RuntimeDriverClass, DeviceAllocationDriverClass, DeviceDeallocationDriverClass, ExpectClass }700 `;701 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var aCustomDriverModule = require('aCustomDriverModule');2aCustomDriverModule.aCustomDriverMethod();3var aCustomDriverModule = require('aCustomDriverModule');4aCustomDriverModule.aCustomDriverMethod();5var aCustomDriverModule = require('aCustomDriverModule');6aCustomDriverModule.aCustomDriverMethod();7var aCustomDriverModule = require('aCustomDriverModule');8aCustomDriverModule.aCustomDriverMethod();9var aCustomDriverModule = require('aCustomDriverModule');10aCustomDriverModule.aCustomDriverMethod();11var aCustomDriverModule = require('aCustomDriverModule');12aCustomDriverModule.aCustomDriverMethod();13var aCustomDriverModule = require('aCustomDriverModule');14aCustomDriverModule.aCustomDriverMethod();15var aCustomDriverModule = require('aCustomDriverModule');16aCustomDriverModule.aCustomDriverMethod();17var aCustomDriverModule = require('aCustomDriverModule');18aCustomDriverModule.aCustomDriverMethod();19var aCustomDriverModule = require('aCustomDriverModule');20aCustomDriverModule.aCustomDriverMethod();

Full Screen

Using AI Code Generation

copy

Full Screen

1var aCustomDriverModule = require('aCustomDriverModule');2aCustomDriverModule.method1();3aCustomDriverModule.method2();4aCustomDriverModule.method3();5var aCustomDriverModule = require('aCustomDriverModule');6aCustomDriverModule.method1();7aCustomDriverModule.method2();8aCustomDriverModule.method3();9var aCustomDriverModule = require('aCustomDriverModule');10aCustomDriverModule.method1();11aCustomDriverModule.method2();12aCustomDriverModule.method3();13var aCustomDriverModule = require('aCustomDriverModule');14aCustomDriverModule.method1();15aCustomDriverModule.method2();16aCustomDriverModule.method3();17var aCustomDriverModule = require('aCustomDriverModule');18aCustomDriverModule.method1();19aCustomDriverModule.method2();20aCustomDriverModule.method3();21var aCustomDriverModule = require('aCustomDriverModule');22aCustomDriverModule.method1();23aCustomDriverModule.method2();24aCustomDriverModule.method3();25var aCustomDriverModule = require('aCustomDriverModule');26aCustomDriverModule.method1();27aCustomDriverModule.method2();28aCustomDriverModule.method3();29var aCustomDriverModule = require('aCustomDriverModule');30aCustomDriverModule.method1();31aCustomDriverModule.method2();

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = require('root');2var aCustomDriverModule = root.require('aCustomDriverModule');3aCustomDriverModule.methodOfaCustomDriverModule();4var root = require('root');5var aCustomDriverModule = root.require('aCustomDriverModule');6aCustomDriverModule.methodOfaCustomDriverModule();7var root = require('root');8var aCustomDriverModule = root.require('aCustomDriverModule');9aCustomDriverModule.methodOfaCustomDriverModule();10var root = require('root');11var aCustomDriverModule = root.require('aCustomDriverModule');12aCustomDriverModule.methodOfaCustomDriverModule();13var root = require('root');14var aCustomDriverModule = root.require('aCustomDriverModule');15aCustomDriverModule.methodOfaCustomDriverModule();16var root = require('root');17var aCustomDriverModule = root.require('aCustomDriverModule');18aCustomDriverModule.methodOfaCustomDriverModule();19var root = require('root');20var aCustomDriverModule = root.require('aCustomDriverModule');21aCustomDriverModule.methodOfaCustomDriverModule();22var root = require('root');

Full Screen

Using AI Code Generation

copy

Full Screen

1var rootModule = require('./rootModule');2rootModule.aCustomDriverModule();3exports.aCustomDriverModule = function () {4 console.log('aCustomDriverModule called');5}6var rootModule = require('./rootModule');7rootModule.aCustomDriverModule();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful