How to use cypress-cucumber-preprocessor - 10 common examples

To help you get started, we’ve selected a few cypress-cucumber-preprocessor 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 dpc-sdp / ripple / test / e2e / integration / Grants / SubmitAGrant / step_definition.js View on Github external
cy.get('#website-url-for-grant-or-program-information').type(sampleFormSubmission.infoUrl)
    cy.get('#contact-person').type(sampleFormSubmission.contactName)
    cy.get('[for="department-agency-or-provider-organisation"] + div .rpl-select__trigger').click()
    cy.get('[for="department-agency-or-provider-organisation"] + div .rpl-select__listbox').type('{downarrow}')
    cy.get('[for="department-agency-or-provider-organisation"] + div .rpl-select__trigger').click()

    cy.get('#contact-email-address').type(sampleFormSubmission.contactEmail)
    cy.get('#contact-telephone-number').type(sampleFormSubmission.contactPhone)

    if (sampleFormSubmission.acknowledge === 'TRUE') {
      cy.get('[id^="agree-privacy-statement-"]').check({ force: true })
    }
  })
})

When('I submit the form', () => {
  cy.fixture('/Forms/Grant/tc9c_submission.json').as('formSubmissionResponse')
  cy.server() // enable response stubbing
  cy.route('POST', '/api/v1/webform_submission/tide_grant_submission', '@formSubmissionResponse').as('formSubmissionRequest')
  cy.get('form.rpl-form').first().submit()
  cy.get('@formSubmissionRequest').then(submissionData => {
    cy.log(submissionData)
  })
})

Then('I should see the form success message', () => {
  cy.get('.rpl-form-alert', { timeout: 10000 }).should('have.class', 'rpl-form-alert--success')
})
Then('I should see the failure message', () => {
  cy.get('.rpl-form-alert', { timeout: 10000 }).should('have.class', 'rpl-form-alert--error')
})
github LiskHQ / lisk-desktop / test / cypress / features / delegateReg / delegateReg.js View on Github external
/* eslint-disable */
import { Given } from 'cypress-cucumber-preprocessor/steps';
import urls from '../../../constants/urls';
import ss from '../../../constants/selectors';

const txConfirmationTimeout = 12000;
const txDelegateRegPrice = 25;
const getRandomDelegateName = () => Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5);

Given(/^I enter the delegate name$/, function () {
  const randomDelegateName = getRandomDelegateName();
  cy.get(ss.delegateNameInput).click().type(randomDelegateName);
  cy.wait(1200);
});

Given(/^I go to confirmation$/, function () {
  cy.get(ss.chooseDelegateName).click();
});

Given(/^I confirm transaction$/, function () {
  cy.get(ss.confirmDelegateButton).click();
});

Given(/^I see successful message$/, function () {
  cy.wait(txConfirmationTimeout);
  cy.get(ss.app).contains('Delegate registration submitted');
github LiskHQ / lisk-desktop / test / cypress / features / login / login.js View on Github external
/* eslint-disable */
import { Given } from 'cypress-cucumber-preprocessor/steps';
import urls from '../../../constants/urls';
import accounts from '../../../constants/accounts';
import networks from '../../../constants/networks';
import ss from '../../../constants/selectors';
import numeral from 'numeral';
import { fromRawLsk } from '../../../../src/utils/lsk';

Given(/^showNetwork setting is true$/, function () {
  cy.mergeObjectWithLocalStorage('settings', { showNetwork: true });
});

Given(/^I should be connected to ([^\s]+)$/, function (networkName) {
  const castNumberToBalanceString = number => (
    numeral(fromRawLsk(number)).format('0,0.[0000000000000]') + ' LSK'
  );
  switch (networkName) {
    case 'mainnet':
      cy.get(ss.headerBalance).should('have.text', castNumberToBalanceString(0));
      break;
    case 'testnet':
      cy.get(ss.headerBalance).should('have.text', castNumberToBalanceString(accounts['testnet_guy'].balance));
      break;
    case 'devnet':
      cy.get(ss.headerBalance).should('contain', castNumberToBalanceString(accounts.genesis.balance).substring(0, 3));
      break;
    default:
      throw new Error(`Network should be one of : mainnet , testnet, devnet. Was: ${networkName}`);
  }
github Human-Connection / Human-Connection / cypress / integration / common / profile.js View on Github external
import { When, Then } from "cypress-cucumber-preprocessor/steps";

/* global cy */

When("I visit my profile page", () => {
  cy.openPage("profile/peter-pan");
});

Then("I should be able to change my profile picture", () => {
  const avatarUpload = "onourjourney.png";

  cy.fixture(avatarUpload, "base64").then(fileContent => {
    cy.get("#customdropzone").upload(
      { fileContent, fileName: avatarUpload, mimeType: "image/png" },
      { subjectType: "drag-n-drop", force: true }
    );
  });
  cy.get(".profile-avatar img")
    .should("have.attr", "src")
    .and("contains", "onourjourney");
  cy.contains(".iziToast-message", "Upload successful").should(
github Human-Connection / Human-Connection / cypress / integration / common / steps.js View on Github external
/* global cy  */

let lastPost = {};

let loginCredentials = {
  email: "peterpan@example.org",
  password: "1234"
};
const narratorParams = {
  name: "Peter Pan",
  slug: "peter-pan",
  avatar: "https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg",
  ...loginCredentials
};

Given("I am logged in", () => {
  cy.login(loginCredentials);
});

Given("we have a selection of tags and categories as well as posts", () => {
  cy.factory()
    .authenticateAs(loginCredentials)
    .create("Category", {
      id: "cat1",
      name: "Just For Fun",
      slug: "justforfun",
      icon: "smile"
    })
    .create("Category", {
      id: "cat2",
      name: "Happyness & Values",
      slug: "happyness-values",
github TheBrainFamily / cypress-cucumber-preprocessor / cypress / support / step_definitions / docString.js View on Github external
const { when, then } = require("cypress-cucumber-preprocessor"); // eslint-disable-line

let code = "";
// eslint-disable-next-line prefer-const
let variableToVerify = ""; // we are assigning this through eval

when("I use DocString for code like this:", dataString => {
  code = dataString;
});

then("I ran it and verify that it executes it", () => {
  // eslint-disable-next-line no-eval
  eval(code);
  expect(variableToVerify).to.equal("hello world");
});
github TheBrainFamily / cypress-cucumber-preprocessor / cypress / support / step_definitions / basic.js View on Github external
const { given, when, then } = require("cypress-cucumber-preprocessor"); // eslint-disable-line

given("a feature and a matching step definition file", () => {
  expect(true).to.equal(true);
});

when("I run cypress tests", () => {
  expect(true).to.equal(true);
});

then("they run properly", () => {
  expect(true).to.equal(true);
});
github TheBrainFamily / cypress-cucumber-preprocessor / cypress / support / step_definitions / scenario_outline.js View on Github external
const { when, then } = require("cypress-cucumber-preprocessor"); // eslint-disable-line

// you can have external state, and also require things!
let sum = 0;

when("I add {int} and {int}", (a, b) => {
  sum = a + b;
});

then("I verify that the result is equal the {string}", result => {
  expect(sum).to.equal(result);
});
github TheBrainFamily / cypress-cucumber-preprocessor / cypress / support / step_definitions / basic.js View on Github external
const { given, when, then } = require("cypress-cucumber-preprocessor"); // eslint-disable-line

given("a feature and a matching step definition file", () => {
  expect(true).to.equal(true);
});

when("I run cypress tests", () => {
  expect(true).to.equal(true);
});

then("they run properly", () => {
  expect(true).to.equal(true);
});
github TheBrainFamily / cypress-cucumber-preprocessor / cypress / support / step_definitions / scenario_outline.js View on Github external
const { when, then } = require("cypress-cucumber-preprocessor"); // eslint-disable-line

// you can have external state, and also require things!
let sum = 0;

when("I add {int} and {int}", (a, b) => {
  sum = a + b;
});

then("I verify that the result is equal the {string}", result => {
  expect(sum).to.equal(result);
});