How to use the cucumber-tsflow.binding function in cucumber-tsflow

To help you get started, we’ve selected a few cucumber-tsflow 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 samvloeberghs / protractor-gherkin-cucumberjs-angular / test / e2e / authentication / set-new-password / setNewPassword.steps.ts View on Github external
let chai = require('chai').use(require('chai-as-promised'));
let expect = chai.expect;

import { binding, given, when, then } from 'cucumber-tsflow';
import { CallbackStepDefinition } from 'cucumber';

import { SetNewPasswordPageObject } from './setNewPassword.page';
import { AuthenticationPageObject } from '../authentication.page';

@binding()
class SetNewPasswordSteps {

  private setNewPasswordPageObject = new SetNewPasswordPageObject();
  private authPageObject = new AuthenticationPageObject();

  // the id & nonce in the set new password link
  private currentId: string;
  private currentNonce: string;

  @given(/^'(.*)' is the provided nonce in the email link$/)
  private givenNonce(nonce: string, callback: CallbackStepDefinition) {
    this.currentNonce = nonce;
    callback();
  };

  @given(/^'(.*)' is the id representing the user in the email link$/)
github syndesisio / syndesis-ui / e2e / connections / connections.steps.ts View on Github external
import { World, expect, P } from '../common/world';
import { CallbackStepDefinition, TableDefinition } from 'cucumber';
import { ConnectionDetailPage } from './detail/detail.po';
import { ConnectionsListComponent } from './list/list.po';
import { ConnectionViewComponent } from './edit/edit.po';
import { log } from '../../src/app/logging';
import util = require('util');

// let http = require('http');

/**
 * Created by jludvice on 29.3.17.
 */


@binding([World])
class ConnectionSteps {

  constructor(private world: World) {
  }

  @given(/^details for "([^"]*)" connection:$/)
  public setConnectionDetails(connectionName: string, table: TableDefinition, callback: CallbackStepDefinition): void {
    log.info(`asdfasdf ${table.rowsHash()}`);
    const content = new Map();
    log.info(JSON.stringify(Object.keys(table.rowsHash())));
    for (const key of Object.keys(table.rowsHash())) {
      content.set(key, table.rowsHash()[key]);
    }
    this.world.connectionDetails.set(connectionName, content);
    log.debug(`connectionDetails update. Current value: ${util.inspect(this.world.connectionDetails)})`);
    callback();
github syndesisio / syndesis-ui / e2e / common / common.steps.ts View on Github external
*/
import { CallbackStepDefinition, TableDefinition } from 'cucumber';
import { browser } from 'protractor';
import { binding, given, then, when } from 'cucumber-tsflow';
import { Promise as P } from 'es6-promise';
import { expect, World } from './world';
import { User, UserDetails } from './common';
import { log } from '../../src/app/logging';
import { IntegrationsListPage, IntegrationsListComponent } from '../integrations/list/list.po';
import { DashboardPage } from '../dashboard/dashboard.po';
/**
 * Generic steps that can be used in various features
 * They may change state through world class.
 * See https://github.com/timjroberts/cucumber-js-tsflow#sharing-data-between-bindings
 */
@binding([World])
class CommonSteps {

  constructor(protected world: World) {
  }

  @given(/^credentials for "([^"]*)"$/)
  public loadCredentials(alias: string, callback: CallbackStepDefinition): void {
    this.world.user = new User(alias.toLowerCase(), 'asdfadf', null);
    log.info(`using alias ${alias} with login ${this.world.user.username}`);
    callback();
  }

  @when(/^"(\w+)" logs into the Syndesis.*$/i)
  public login(alias: string): P {
    this.world.user = new User(alias.toLowerCase(), 'asdfadf', null);
    // return this.app.login(this.world.user);
github syndesisio / syndesis-ui / e2e / integrations / integration.steps.ts View on Github external
/**
 * Created by jludvice on 8.3.17.
 */
import { binding, then, when } from 'cucumber-tsflow';
import { CallbackStepDefinition } from 'cucumber';
import { expect, P, World } from '../common/world';
import { IntegrationEditPage, ListActionsComponent } from '../integrations/edit/edit.po';
import { log } from '../../src/app/logging';
import { IntegrationsListPage } from '../integrations/list/list.po';

/**
 * Created by jludvice on 1.3.17.
 */
@binding([World])
class IntegrationSteps {

  constructor(protected world: World) {
  }

  @when(/defines integration name "([^"]*)"$/)
  public defineIntegrationName(integrationName: string): P {
    const page = new IntegrationEditPage();
    return page.basicsComponent().setName(integrationName);
  }


  @then(/^she is presented with a visual integration editor$/)
  public editorOpened(): P {
    // Write code here that turns the phrase above into concrete actions
    const page = new IntegrationEditPage();
github samvloeberghs / protractor-gherkin-cucumberjs-angular / test / e2e / authentication / login / login.steps.ts View on Github external
let chai = require('chai').use(require('chai-as-promised'));
let expect = chai.expect;

import { binding, given, when, then } from 'cucumber-tsflow';
import { CallbackStepDefinition } from 'cucumber';

import { LoginPageObject } from './login.page';
import { AuthenticationPageObject } from '../authentication.page';

@binding()
class LoginSteps {

  private authenticationModule = new AuthenticationPageObject();
  private loginPageObject = new LoginPageObject();

  @given(/^user clicks the login link$/)
  private givenUserClicksTheLoginLink(callback: CallbackStepDefinition) {
    this.authenticationModule.goToLoginPage();
    callback();
  };

  @given(/^'(.*)' is the user email in the login form$/)
  private givenUserEmail(email: string, callback: CallbackStepDefinition) {
    this.loginPageObject.setEmail(email);
    callback();
  };
github samvloeberghs / protractor-gherkin-cucumberjs-angular / test / e2e / authentication / forgot-password / forgotPassword.steps.ts View on Github external
let chai = require('chai').use(require('chai-as-promised'));
let expect = chai.expect;

import { binding, given, when, then } from "cucumber-tsflow";
import { CallbackStepDefinition } from 'cucumber';

import { ForgotPasswordPageObject } from './forgotPassword.page';
import { LoginPageObject } from '../login';
import { AuthenticationPageObject } from '../authentication.page';

@binding()
class ForgotPasswordSteps {

  private authenticationModule = new AuthenticationPageObject();
  private loginPageObject = new LoginPageObject();
  private forgotPasswordPageObject = new ForgotPasswordPageObject();

  @given(/^user clicks the forgot password link$/)
  private givenUserClicksTheForgotPasswordLink(callback: CallbackStepDefinition) {
    this.authenticationModule.goToLoginPage();
    this.loginPageObject.navigateToForgotPasswordPage();
    callback();
  };

  @given(/^'(.*)' is the user email used in the forgot password form$/)
  private givenUserEmail(email: string, callback: CallbackStepDefinition) {
    this.forgotPasswordPageObject.setEmail(email);
github samvloeberghs / protractor-gherkin-cucumberjs-angular / test / e2e / authentication / register / register.steps.ts View on Github external
let chai = require('chai').use(require('chai-as-promised'));
let expect = chai.expect;

import { binding, given, when, then } from 'cucumber-tsflow';
import { CallbackStepDefinition } from 'cucumber';

import { RegisterPageObject } from './register.page';
import { LoginPageObject } from '../login';
import { AuthenticationPageObject } from '../authentication.page';

@binding()
class RegisterSteps {

  private authenticationModule = new AuthenticationPageObject();
  private loginPageObject = new LoginPageObject();
  private registerPageObject = new RegisterPageObject();

  @given(/^user clicks the register link$/)
  private givenUserClicksTheLoginLink(callback: CallbackStepDefinition) {
    this.authenticationModule.goToLoginPage();
    this.loginPageObject.navigateToRegisterPage();
    callback();
  };

  @given(/^'(.*)' is the user name used in the register form$/)
  private givenUsername(name: string, callback: CallbackStepDefinition) {
    this.registerPageObject.setName(name);
github timjroberts / cucumber-js-tsflow / cucumber-tsflow-specs / src / support / Hooks.ts View on Github external
"use strict";

import * as tmp from "tmp";
import { binding, before } from "cucumber-tsflow";

import { TypeScriptWorkspace, WorkspaceInfo } from "./TypeScriptWorkspace";

@binding([TypeScriptWorkspace])
class Hooks {
    constructor(protected workspace: TypeScriptWorkspace) {
    }
    
    @before()
    public async beforeScenario(): Promise {
        let tempDirInfo = await this.createTemporaryDirectoryAsync();
        
        console.log(`Created temporary workspace '${tempDirInfo.path}'`);
        
        this.workspace.setWorkspace(tempDirInfo);
    }
    
    /**
     * An asynchronous wrapper around tmp.dir().
     */
github jan-molak / serenity-js / examples / todomvc-protractor-cucumber-ts-flow / features / todo_user.steps.ts View on Github external
import { binding, given, then, when } from 'cucumber-tsflow';
import { Serenity } from 'serenity-bdd';
import { Actors, AddATodoItem, Start, TodoListItems } from 'todomvc-screenplay';

import { expect } from '../src/expect';
import { listOf } from '../src/text';

/**
 * The cucumber steps are defined using the cucumber-ts-flow library:
 *  https://github.com/timjroberts/cucumber-js-tsflow
 */
@binding()
class TodoUserSteps {

    /**
     * Initializes Serenity with a Cast of Actors, specific to the domain
     *
     * @type {Stage}
     */
    private stage = Serenity.callToStageFor(new Actors());

    /**
     *
     * @param name
     *
     * @return {Promise}
     *  Every step returns a promise. This way Serenity JS can synchronise
     *  asynchronous tasks without requiring you to explicitly invoke callbacks
github 99xt / CodeSpecJS / lib / base.steps.ts View on Github external
element,
  by,
  ElementFinder,
  ExpectedConditions
} from 'protractor';
import { ElementService } from './services/element.service';
import { VariableService } from './services/variable.service';
import { VariableType } from './domain/variableType';
import { ICommonVariable } from './domain/ICommonVariable';
import { IHooks } from './domain/Ihooks';
import { Hooks } from '../hooks';
let chai = require('chai').use(require('chai-as-promised'));
let expect = chai.expect;
let assert = chai.assert;

@binding()
class BaseSteps {
  elementService: ElementService;
  variableService: VariableService;
  lifeCycleHooks: IHooks;
  defaultElementTimeout: number;
  constructor() {
    this.elementService = ElementService.GetInstance();
    this.variableService = VariableService.GetInstance();
    this.lifeCycleHooks = new Hooks();
    this.defaultElementTimeout = 10000;
  }


  @before()
  public beforeEveryScenarios(): void {
    this.lifeCycleHooks.beforeScenario();

cucumber-tsflow

Provides 'specflow' like bindings for CucumberJS 7.0.0+ in TypeScript 1.7+.

MIT
Latest version published 8 months ago

Package Health Score

73 / 100
Full package analysis