How do you use the Custom Parameter Types #921
Unanswered
Scaramanga77
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In the previous version of the cypress cucumber preprocessor I was able to use a custom type similar to the following:
userCredentials.ts
import { Transform } from "cypress-cucumber-preprocessor/steps";
export const catalogUserName: Transform =
{
regexp: new RegExp(availableUserTypes.join("|")),
transformer(userType: string): Cypress.Chainable
{
return cy.integrationConfigurationFixture().then((configuration: IntegrationConfiguration) =>
{
assert.isNotNull(configuration, "Unexpected null Configuration");
},
name: "userName"
};
authentication.ts
import { userName } from "../transforms/userCredentials";
import { Given, And, When, Then, defineParameterType } from "cypress-cucumber-preprocessor/steps";
defineParameterType(userName);
Given("I enter the user name of the {userName} user", (userName: Cypress.Chainable) => {
});
The Transform interface does not exist in the BadeBall implementation but does have defineParameterType available. Does anyone have an example of how to use this with the interface:
export interface IParameterTypeDefinition<T, C extends Mocha.Context> {
name: string;
regexp: RegExp;
transformer: (this: C, ...match: string[]) => T;
}
Beta Was this translation helpful? Give feedback.
All reactions