Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
};
///
// ***
///
}
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
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);
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);
}
}
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 {
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));
}
@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();
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.*$/)
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 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
const connectionView = new ConnectionViewComponent();
return connectionView.description.set(description);
}
@when(/^she fills "([^"]*)" connection details$/)
public fillConnectionDetails(connectionName: string): P {
const connectionView = new ConnectionViewComponent();
callback();
};
@given(/^'(.*)' is the provided password used in the register form$/)
private givenPassword(password: string, callback: CallbackStepDefinition) {
this.registerPageObject.setPassword(password);
callback();
};
@given(/^'(.*)' is the repeated password used in the register form/)
private givenRepeatPassword(repeatPassword: string, callback: CallbackStepDefinition) {
this.registerPageObject.setRepeatPassword(repeatPassword);
callback();
};
@when(/^submitting the register form$/)
private whenSubmitForm(callback: CallbackStepDefinition) {
this.registerPageObject.submitForm();
callback();
};
@then(/^the register form is validated '(.*)'$/)
private thenFormIsValidated(valid: string, callback: CallbackStepDefinition) {
let isValid = valid === 'true';
expect(this.registerPageObject.formIsValid()).to.become(isValid).and.notify(callback);
}
}
export = RegisterSteps;
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*$/)
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`);