function removeP2DetailsStepFromFlow( flow ) { if ( ! flow ) { return; } return assign( {}, flow, { steps: reject( flow.steps, ( stepName ) => stepName === 'p2-details' ), } ); }
it('should load step definitions', (done) => { let sum = 0; Given(/I have product with (\d+) price/, param => sum += parseInt(param, 10)); When('I go to checkout process', () => sum += 10); const suite = run(text); assert.equal('checkout process', suite.title); suite.tests[0].fn(() => { assert.ok(suite.tests[0].steps); assert.equal(1610, sum); done(); }); });
getNextStepNameInFlow( flowName, currentStepName = '' ) { const flow = Flows.getFlows()[ flowName ]; if ( ! flow ) { return false; } const flowSteps = flow.steps; const currentStepIndex = indexOf( flowSteps, currentStepName ); const nextIndex = currentStepIndex + 1; const nextStepName = get( flowSteps, nextIndex ); return nextStepName; }
const parseFile = (file) => { const ast = parser.parse(fs.readFileSync(file).toString()); for (const child of ast.feature.children) { if (child.type === 'ScenarioOutline') continue; // skip scenario outline parseSteps(child.steps).map((step) => { return Object.assign(step, { file: file.replace(global.codecept_dir, '').slice(1) }); }).map((step) => newSteps.set(`${step.type}(${step})`, step)); } }
describe( 'getSiteVerticalName', () => { test( 'should return empty string as a default state', () => { expect( getSiteVerticalName( {} ) ).toEqual( '' ); } ); test( 'should return site vertical from the state', () => { expect( getSiteVerticalName( state ) ).toEqual( state.signup.steps.siteVertical.name ); } ); } );
runner.on('fail', (test, err) => { if (test.ctx.currentTest) { this.loadedTests.push(test.ctx.currentTest.id); } if (showSteps && test.steps) { return output.scenario.failed(test); } cursor.CR(); output.test.failed(test); });
runner.on('pass', (test) => { if (showSteps && test.steps) { return output.scenario.passed(test); } cursor.CR(); output.test.passed(test); });
runner.on('test', (test) => { currentMetaStep = []; if (test.steps) { output.test.started(test); } });
describe( 'getSiteVerticalIsUserInput', () => { test( 'should return true as a default state', () => { expect( getSiteVerticalIsUserInput( {} ) ).toBe( true ); } ); test( 'should return site vertical from the state', () => { expect( getSiteVerticalIsUserInput( state ) ).toEqual( state.signup.steps.siteVertical.isUserInput ); } ); } );
filterExcludedSteps( flow ) { if ( ! flow ) { return; } return assign( {}, flow, { steps: reject( flow.steps, ( stepName ) => includes( Flows.excludedSteps, stepName ) ), } ); }
describe( 'getSiteVerticalSlug', () => { test( 'should return empty string as a default state', () => { expect( getSiteVerticalSlug( {} ) ).toEqual( '' ); } ); test( 'should return site vertical from the state', () => { expect( getSiteVerticalSlug( state ) ).toEqual( state.signup.steps.siteVertical.slug ); } ); } );
function removeUserStepFromFlow( flow ) { if ( ! flow ) { return; } return assign( {}, flow, { steps: reject( flow.steps, ( stepName ) => stepConfig[ stepName ].providesToken ), } ); }
describe( 'getSiteVerticalParentId', () => { test( 'should return empty string as a default state', () => { expect( getSiteVerticalParentId( {} ) ).toBe( '' ); } ); test( 'should return site id from the state', () => { expect( getSiteVerticalParentId( state ) ).toEqual( state.signup.steps.siteVertical.parentId ); } ); } );
describe( '', () => { test( 'should return empty string as a default state', () => { expect( getSiteVerticalId( {} ) ).toBe( '' ); } ); test( 'should return site id from the state', () => { expect( getSiteVerticalId( state ) ).toEqual( state.signup.steps.siteVertical.id ); } ); } );