Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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$/)
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();
*/
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);
/**
* 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();
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();
};
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);
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);
"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().
*/
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
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();