How to use @wdio/sync - 2 common examples

To help you get started, we’ve selected a few @wdio/sync examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oxygenhq / oxygen / src / runners / cucumber / index.js View on Github external
const runtime = new Cucumber.Runtime({
                eventBroadcaster,
                options: this.cucumberOpts,
                supportCodeLibrary,
                testCases
            });
            
            const beforeHookRetval = await executeHooksWithArgs(this.config.before, [this.capabilities, this.specs]);
            // if beforeHookRetval contains some value, then this is an error thrown by 'before' method
            if (beforeHookRetval && Array.isArray(beforeHookRetval) && beforeHookRetval.length > 0 && beforeHookRetval[0]) {
                throw beforeHookRetval[0];
            }
            
            const result = await runtime.start() ? 0 : 1;

            const afterHookRetval = await executeHooksWithArgs(this.config.after, [result, this.capabilities, this.specs]);
            // if afterHookRetval contains some value, then this is an error thrown by 'after' method
            if (afterHookRetval && Array.isArray(afterHookRetval) && afterHookRetval.length > 0 && afterHookRetval[0]) {
                throw afterHookRetval[0];
            }

            await this.disposeOxygenCore();
    
            this.reporter.onRunnerEnd(this.id, null);
    
            return result;
        }
        catch (e) {
            console.log('Fatal error in Cucumber runner:', e);
            this.reporter.onRunnerEnd(this.id, e);
        }
    }
github oxygenhq / oxygen / src / runners / cucumber / index.js View on Github external
});
            const testCases = await Cucumber.getTestCasesFromFilesystem({
                cwd: this.cwd,
                eventBroadcaster,
                featurePaths: this.specs.map(spec => spec.replace(/(:\d+)*$/g, '')),
                order: this.cucumberOpts.order,
                pickleFilter
            });
            const runtime = new Cucumber.Runtime({
                eventBroadcaster,
                options: this.cucumberOpts,
                supportCodeLibrary,
                testCases
            });
            
            const beforeHookRetval = await executeHooksWithArgs(this.config.before, [this.capabilities, this.specs]);
            // if beforeHookRetval contains some value, then this is an error thrown by 'before' method
            if (beforeHookRetval && Array.isArray(beforeHookRetval) && beforeHookRetval.length > 0 && beforeHookRetval[0]) {
                throw beforeHookRetval[0];
            }
            
            const result = await runtime.start() ? 0 : 1;

            const afterHookRetval = await executeHooksWithArgs(this.config.after, [result, this.capabilities, this.specs]);
            // if afterHookRetval contains some value, then this is an error thrown by 'after' method
            if (afterHookRetval && Array.isArray(afterHookRetval) && afterHookRetval.length > 0 && afterHookRetval[0]) {
                throw afterHookRetval[0];
            }

            await this.disposeOxygenCore();
    
            this.reporter.onRunnerEnd(this.id, null);

@wdio/sync

A WebdriverIO plugin. Helper module to run WebdriverIO commands synchronously

MIT
Latest version published 2 years ago

Package Health Score

72 / 100
Full package analysis

Popular @wdio/sync functions