How to use cucumber-tsflow - 10 common examples

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
callback();
  };

  @given(/^'(.*)' is the id representing the user in the email link$/)
  private givenId(id: string, callback: CallbackStepDefinition) {
    this.currentId = id;
    callback();
  };

  @when(/^using the link to the set new password page$/)
  private whenGetPage(callback: CallbackStepDefinition) {
    this.authPageObject.goToSetNewPasswordPage(this.currentId, this.currentNonce);
    callback();
  };

  @then(/^the set new password request is validated '(.*)'$/)
  private thenRequestIsValidated(valid: string, callback: CallbackStepDefinition) {
    let isValid = valid === 'true';
    this.currentId = undefined;
    this.currentNonce = undefined;
    expect(this.setNewPasswordPageObject.hasAlertMessages()).to.become(!isValid).and.notify(callback);
  };

  ///
  // ***
  ///

  @given(/^user clicks the valid set new password link$/)
  private givenUserClicksTheSetNewPasswordLink(callback: CallbackStepDefinition) {
    this.authPageObject.goToSetNewPasswordPage(this.currentId, this.currentNonce);
    expect(this.setNewPasswordPageObject.hasFormElements()).to.become(true).and.notify(callback);
    //callback();
github samvloeberghs / protractor-gherkin-cucumberjs-angular / test / e2e / authentication / set-new-password / setNewPassword.steps.ts View on Github external
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$/)
  private givenId(id: string, callback: CallbackStepDefinition) {
    this.currentId = id;
    callback();
  };

  @when(/^using the link to the set new password page$/)
  private whenGetPage(callback: CallbackStepDefinition) {
    this.authPageObject.goToSetNewPasswordPage(this.currentId, this.currentNonce);
    callback();
  };

  @then(/^the set new password request is validated '(.*)'$/)
  private thenRequestIsValidated(valid: string, callback: CallbackStepDefinition) {
    let isValid = valid === 'true';
    this.currentId = undefined;
    this.currentNonce = undefined;
    expect(this.setNewPasswordPageObject.hasAlertMessages()).to.become(!isValid).and.notify(callback);
  };

  ///
  // ***
  ///
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 / common / common.steps.ts View on Github external
return this.world.app.goHome();
    }
    const link = await this.world.app.link(linkTitle);
    expect(link, `Navigation link ${linkTitle} should exist`).to.exist;
    return link.element.click();
  }

  @then(/^(\w+)? ?is presented with the Syndesis page "([^"]*)"$/)
  public async verifyHomepage(alias: string, pageTitle: string): P {
    // Write code here that turns the phrase above into concrete actions
    const currentLink = await this.world.app.link(pageTitle);
    log.info(`${alias} is on current navlink: ${currentLink}`);
    expect(currentLink.active, `${pageTitle} link must be active`).to.be.true;
  }

  @then(/^(\w+)? ?is presented with the "([^"]*)" link*$/)
  public async verifyLink(alias: string, linkTitle: string): P {
    const currentLink = await this.world.app.getLink(linkTitle);

    expect(currentLink.isPresent(), `There must be present a link ${linkTitle}`)
      .to.eventually.be.true;
  }

  @when(/clicks? on the "([^"]*)" button.*$/)
  public clickOnButton(buttonTitle: string, callback: CallbackStepDefinition): void {
    this.world.app.clickButton(buttonTitle)
      .then(() => callback())
      // it may fail but we still want to let tests continue
      .catch((e) => callback(e));
  }

  @when(/clicks? on the "([^"]*)" link.*$/)
github syndesisio / syndesis-ui / e2e / connections / connections.steps.ts View on Github external
}

  @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();
  }

  @then(/^Camilla is presented with "([^"]*)" connection details$/)
  public verifyConnectionDetails(connectionName: string, callback: CallbackStepDefinition): void {
    // Write code here that turns the phrase above into concrete actions
    const page = new ConnectionDetailPage();
    expect(page.connectionName(), `Connection detail page must show connection name`)
      .to.eventually.be.equal(connectionName).notify(callback);
    // todo add more assertion on connection details page
  }

  @when(/^Camilla selects the "([^"]*)" connection.*$/)
  public selectConnection(connectionName: string): P {
    // Write code here that turns the phrase above into concrete actions
    const listComponent = new ConnectionsListComponent();
    return listComponent.goToConnection(connectionName);
  }

  @when(/^type "([^"]*)" into connection name$/)
github syndesisio / syndesis-ui / e2e / integrations / integration.steps.ts View on Github external
* 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();
    return expect(page.rootElement().isPresent(), 'there must be edit page root element')
      .to.eventually.be.true;
  }

  @then(/^she is presented with a visual integration editor for "([^"]*)"$/)
  public editorOpenedFor(integrationName: string): P {
    return this.editorOpened().then(() => {
      // ensure we're on editor page and then check integration name
      const page = new IntegrationEditPage();
      return expect(page.flowViewComponent().getIntegrationName(), `editor must display integration name ${integrationName}`)
        .to.eventually.be.equal(integrationName);
    }).catch(e => P.reject(e));
  }
github syndesisio / syndesis-ui / e2e / connections / connections.steps.ts View on Github external
}
    this.world.connectionDetails.set(connectionName, content);
    log.debug(`connectionDetails update. Current value: ${util.inspect(this.world.connectionDetails)})`);
    callback();
  }

  @then(/^Camilla is presented with "([^"]*)" connection details$/)
  public verifyConnectionDetails(connectionName: string, callback: CallbackStepDefinition): void {
    // Write code here that turns the phrase above into concrete actions
    const page = new ConnectionDetailPage();
    expect(page.connectionName(), `Connection detail page must show connection name`)
      .to.eventually.be.equal(connectionName).notify(callback);
    // todo add more assertion on connection details page
  }

  @when(/^Camilla selects the "([^"]*)" connection.*$/)
  public selectConnection(connectionName: string): P {
    // Write code here that turns the phrase above into concrete actions
    const listComponent = new ConnectionsListComponent();
    return listComponent.goToConnection(connectionName);
  }

  @when(/^type "([^"]*)" into connection name$/)
  public typeConnectionName(name: string): P {
    // Write code here that turns the phrase above into concrete actions
    const connectionView = new ConnectionViewComponent();
    return connectionView.name.set(name);
  }

  @when(/^type "([^"]*)" into connection description/)
  public typeConnectionDescription(description: string): P {
    // Write code here that turns the phrase above into concrete actions
github syndesisio / syndesis-ui / e2e / common / common.steps.ts View on Github external
public async verifyLink(alias: string, linkTitle: string): P {
    const currentLink = await this.world.app.getLink(linkTitle);

    expect(currentLink.isPresent(), `There must be present a link ${linkTitle}`)
      .to.eventually.be.true;
  }

  @when(/clicks? on the "([^"]*)" button.*$/)
  public clickOnButton(buttonTitle: string, callback: CallbackStepDefinition): void {
    this.world.app.clickButton(buttonTitle)
      .then(() => callback())
      // it may fail but we still want to let tests continue
      .catch((e) => callback(e));
  }

  @when(/clicks? on the "([^"]*)" link.*$/)
  public clickOnLink(linkTitle: string, callback: CallbackStepDefinition): void {
    this.world.app.clickLink(linkTitle)
      .then(() => callback())
      // it may fail but we still want to let tests continue
      .catch((e) => callback(e));
  }

  @then(/^she is presented with the "([^"]*)" button.*$/)
  public expectButtonPresent(buttonTitle: string, callback: CallbackStepDefinition): void {

    const button = this.world.app.getButton(buttonTitle);
    expect(button.isPresent(), `There must be present a button ${buttonTitle}`)
      .to.eventually.be.true;

    expect(button.isPresent(), `There must be enabled button ${buttonTitle}`)
      .to.eventually.be.true.notify(callback);
github syndesisio / syndesis-ui / e2e / integrations / integration.steps.ts View on Github external
public editorOpenedFor(integrationName: string): P {
    return this.editorOpened().then(() => {
      // ensure we're on editor page and then check integration name
      const page = new IntegrationEditPage();
      return expect(page.flowViewComponent().getIntegrationName(), `editor must display integration name ${integrationName}`)
        .to.eventually.be.equal(integrationName);
    }).catch(e => P.reject(e));
  }

  @when(/^Camilla selects the "([^"]*)" integration.*$/)
  public selectConnection(itegrationName: string): P {
    const page = new IntegrationsListPage();
    return page.listComponent().goToIntegration(itegrationName);
  }

  @when(/^she selects "([^"]*)" integration action$/)
  public selectIntegrationAction(action: string): P {
    const page = new ListActionsComponent();
    return page.selectAction(action);
  }


  @then(/^Integration "([^"]*)" is present in integrations list$/)
  public expectIntegrationPresent(name: string, callback: CallbackStepDefinition): void {
    log.info(`Verifying integration ${name} is present`);
    const page = new IntegrationsListPage();
    expect(page.listComponent().isIntegrationPresent(name), `Integration ${name} must be present`)
      .to.eventually.be.true.notify(callback);
  }

}
github syndesisio / syndesis-ui / e2e / integrations / integration.steps.ts View on Github external
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();
    return expect(page.rootElement().isPresent(), 'there must be edit page root element')
      .to.eventually.be.true;
  }

  @then(/^she is presented with a visual integration editor for "([^"]*)"$/)
  public editorOpenedFor(integrationName: string): P {

cucumber-tsflow

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

MIT
Latest version published 9 months ago

Package Health Score

70 / 100
Full package analysis