How to use the cucumber-tsflow.then 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
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 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 samvloeberghs / protractor-gherkin-cucumberjs-angular / test / e2e / authentication / login / login.steps.ts View on Github external
callback();
  };

  @given(/^'(.*)' is the user password in the login form$/)
  private givenPassword(password: string, callback: CallbackStepDefinition) {
    this.loginPageObject.setPassword(password);
    callback();
  };

  @when(/^submitting the login form$/)
  private whenSubmitForm(callback: CallbackStepDefinition) {
    this.loginPageObject.submitForm();
    callback();
  };

  @then(/^the login form is validated '(.*)'$/)
  private thenFormIsValidated(valid: string, callback: CallbackStepDefinition) {
    let isValid = valid === 'true';
    expect(this.loginPageObject.formIsValid()).to.become(isValid).and.notify(callback);
  };
}

export = LoginSteps;
github syndesisio / syndesis-ui / e2e / common / common.steps.ts View on Github external
expect(table.isPresent(), `There must be enabled table ${tableTitle}`)
      .to.eventually.be.true.notify(callback);
  }

  @then(/^she is presented with the "([^"]*)" elements*$/)
  public expectElementsPresent(elementClassNames: string, callback: CallbackStepDefinition): void {

    const elementClassNamesArray = elementClassNames.split(',');

    for (const elementClassName of elementClassNamesArray) {
      this.expectElementPresent(elementClassName, callback);
    }
  }

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

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

    expect(element.isPresent(), `There must be enabled element ${elementClassName}`)
      .to.eventually.be.true.notify(callback);
  }

  @then(/^Integration "([^"]*)" is present in top 5 integrations$/)
  public expectIntegrationPresentinTopFive(name: string, callback: CallbackStepDefinition): void {
    log.info(`Verifying integration ${name} is present in top 5 integrations`);
    const page = new DashboardPage();
    expect(page.isIntegrationPresent(name), `Integration ${name} must be present`)
      .to.eventually.be.true.notify(callback);
github syndesisio / syndesis-ui / e2e / common / common.steps.ts View on Github external
expect(element.isPresent(), `There must be present a element ${elementClassName}`)
      .to.eventually.be.true;

    expect(element.isPresent(), `There must be enabled element ${elementClassName}`)
      .to.eventually.be.true.notify(callback);
  }

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

  @then(/^Camilla can see "([^"]*)" connection on dashboard page$/)
  public expectConnectionTitlePresent (connectionName: string, callback: CallbackStepDefinition): void {
    const dashboard = new DashboardPage();
    const connection = dashboard.getConnection(connectionName);
    expect(connection.isPresent(), `There should be present connection ${connectionName}`)
      .to.eventually.be.true.notify(callback);
  }

  @then(/^Camilla can not see "([^"]*)" connection on dashboard page anymore$/)
  public expectConnectionTitleNonPresent (connectionName: string, callback: CallbackStepDefinition): void {
    const dashboard = new DashboardPage();
    const connection = dashboard.getConnection(connectionName);
    expect(connection.isPresent(), `There shouldnt be a present connection ${connectionName}`)
      .to.eventually.be.false.notify(callback);
  }

  @when(/^Camilla deletes the "([^"]*)" integration*$/)
github syndesisio / syndesis-ui / e2e / integrations / integration.steps.ts View on Github external
}

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

}


export = IntegrationSteps;
github jan-molak / serenity-js / examples / todomvc-protractor-cucumber-ts-flow / features / todo_user.steps.ts View on Github external
return this.stage.theActorInTheSpotlight().attemptsTo(
            AddATodoItem.called(itemName)
        );
    }

    @then(/^'(.*?)' should be recorded in his list$/)
    should_see_todo_list_with_just_one (item: string): PromiseLike {

        /**
         * Steps can be aliased and reused to improve the readability
         * of the scenarios
         */
        return this.should_see_todo_list_with_following(item);
    }

    @then(/^.* todo list should contain (.*?)$/)
    should_see_todo_list_with_following (items: string): PromiseLike {

        return expect(this.stage.theActorInTheSpotlight().toSee(TodoListItems.displayed()))
            .eventually.eql(listOf(items));
    }
}

export = TodoUserSteps;
github syndesisio / syndesis-ui / e2e / common / common.steps.ts View on Github external
@then(/^Camilla can not see "([^"]*)" connection on dashboard page anymore$/)
  public expectConnectionTitleNonPresent (connectionName: string, callback: CallbackStepDefinition): void {
    const dashboard = new DashboardPage();
    const connection = dashboard.getConnection(connectionName);
    expect(connection.isPresent(), `There shouldnt be a present connection ${connectionName}`)
      .to.eventually.be.false.notify(callback);
  }

  @when(/^Camilla deletes the "([^"]*)" integration*$/)
  public deleteIntegration(integrationName: string): P {
    const listComponent = new IntegrationsListComponent();
    return this.world.app.clickDeleteIntegration(integrationName, listComponent.rootElement());
  }

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

  @when(/^Camilla deletes the "([^"]*)" integration in top 5 integrations$/)
  public deleteIntegrationOnDashboard(integrationName: string): P {
    log.info(`Trying to delete ${integrationName} on top 5 integrations table`);
    const dashboard = new DashboardPage();
    return this.world.app.clickDeleteIntegration(integrationName, dashboard.rootElement());
  }

  @then(/^Camilla can not see "([^"]*)" integration in top 5 integrations anymore$/)
  public expectIntegrationPresentOnDashboard(name: string, callback: CallbackStepDefinition): void {

cucumber-tsflow

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

MIT
Latest version published 7 months ago

Package Health Score

70 / 100
Full package analysis