How to use the cypress-cucumber-preprocessor/steps.Then function in cypress-cucumber-preprocessor

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 LiskHQ / lisk-desktop / test / cypress / features / common / common.js View on Github external
cy.get(ss.transactionRow).eq(0).click();
});

Then(/^I click on recent bookmark$/, function () {
  cy.get(ss.bookmarkAccount).eq(0).click();
});

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

Then(/^I fill ([^s]+) in recipient$/, function (address) {
  cy.get(ss.recipientInput).type(address);
});

Then(/^I fill ([^s]+) in amount$/, function (amount) {
  cy.get(ss.amountInput).click().type(amount);
});

Then(/^I go to transfer confirmation$/, function () {
  cy.get(ss.nextTransferBtn).should('be.enabled');
  cy.get(ss.nextTransferBtn).click();
});

Then(/^I confirm transfer$/, function () {
  cy.get(ss.sendBtn).click();
  cy.get(ss.submittedTransactionMessage).should('be.visible');
});

Then(/^I go back to wallet$/, function () {
  cy.get(ss.okayBtn).click();
});
github LiskHQ / lisk-desktop / test / cypress / features / delegates / delegates.js View on Github external
cy.get(ss.goToConfirmationButton).click();
});

Then(/^I see (\d+) removed vote$/, function (number) {
  cy.get(ss.removedVotes).should('have.length', number);
});

Then(/^I see (\d+) added vote$/, function (number) {
  cy.get(ss.addedVotes).should('have.length', number);
});

Then(/^I go back to delegates$/, function () {
  cy.get(ss.backToDelegatesButton).click();
});

Then(/^I see pending votes$/, function () {
  cy.get(ss.delegateRow).eq(0).as('dg');
  cy.get('@dg').find(ss.spinner);
});

Then(/^I wait for pending vote to be approved$/, function () {
  cy.get(ss.spinner);
  cy.get(ss.spinner, { timeout: txConfirmationTimeout }).should('have.length', 0);
});

Then(/^Voted delegate become unchecked$/, function () {
  cy.get('@dg').find(ss.voteCheckbox, { timeout: txConfirmationTimeout }).should('have.class', 'unchecked');
});

Then(/^Voted delegate become checked$/, function () {
  cy.get('@dg').find(ss.voteCheckbox, { timeout: txConfirmationTimeout }).should('have.class', 'checked');
});
github LiskHQ / lisk-desktop / test / cypress / features / delegates / delegates.js View on Github external
});

Then(/^Voted delegate become checked$/, function () {
  cy.get('@dg').find(ss.voteCheckbox, { timeout: txConfirmationTimeout }).should('have.class', 'checked');
});


Then(/^Added votes counter shows (\d+)$/, function (number) {
  cy.get(ss.addedVotesCount).should('have.text', '1');
});

Then(/^I use launch protokol link to vote$/, function () {
  cy.visit(`${urls.delegatesVote}?votes=genesis_12,genesis_14,genesis_16`);
});

Then(/^I use launch protokol link to unvote$/, function () {
  cy.visit(`${urls.delegatesVote}?unvotes=genesis_12`);
});

Then(/^I use launch protokol link to vote for already voted$/, function () {
  cy.visit(`${urls.delegatesVote}?votes=genesis_14,genesis_16`);
});

Then(/^I see (\d+) already voted$/, function (number) {
  cy.get(ss.alreadyVotedPreselection).should('have.length', number);
});
github LiskHQ / lisk-desktop / test / cypress / features / delegates / delegates.js View on Github external
});


Then(/^Added votes counter shows (\d+)$/, function (number) {
  cy.get(ss.addedVotesCount).should('have.text', '1');
});

Then(/^I use launch protokol link to vote$/, function () {
  cy.visit(`${urls.delegatesVote}?votes=genesis_12,genesis_14,genesis_16`);
});

Then(/^I use launch protokol link to unvote$/, function () {
  cy.visit(`${urls.delegatesVote}?unvotes=genesis_12`);
});

Then(/^I use launch protokol link to vote for already voted$/, function () {
  cy.visit(`${urls.delegatesVote}?votes=genesis_14,genesis_16`);
});

Then(/^I see (\d+) already voted$/, function (number) {
  cy.get(ss.alreadyVotedPreselection).should('have.length', number);
});
github LiskHQ / lisk-desktop / test / cypress / features / send / send.js View on Github external
});

Then(/^I mock api \/transactions$/, function () {
  cy.server({ status: 409 });
  cy.route('POST', '/api/transactions', { message: errorMessage });
});

Then(/^I see error message$/, function () {
  cy.get(ss.submittedTransactionMessage).contains(errorMessage);
});

Given(/^I remember my balance$/, function () {
  cy.get(ss.headerBalance).invoke('text').as('balanceBefore');
});

Then(/^The balance is subtracted$/, function () {
  cy.get(ss.headerBalance).invoke('text').as('balanceAfter').then(function () {
    compareBalances(this.balanceBefore, this.balanceAfter, randomAmount + transactionFee);
  });
});
github Human-Connection / Human-Connection / cypress / integration / common / search.js View on Github external
"eq",
    "/post/p1/101-essays-that-will-change-the-way-you-think"
  );
});

Then(
  "I should see posts with the searched-for term in the select dropdown",
  () => {
    cy.get(".ds-select-dropdown").should(
      "contain",
      "101 Essays that will change the way you think"
    );
  }
);

Then(
  "I should not see posts without the searched-for term in the select dropdown",
  () => {
    cy.get(".ds-select-dropdown").should(
      "not.contain",
      "No searched for content"
    );
  }
);
github Human-Connection / Human-Connection / cypress / integration / common / steps.js View on Github external
const { email, password } = table.hashes()[0];
  cy.login({ email, password });
});

When("open the notification menu and click on the first item", () => {
  cy.get(".notifications-menu").click();
  cy.get(".notification-mention-post")
    .first()
    .click();
});

Then("see {int} unread notifications in the top menu", count => {
  cy.get(".notifications-menu").should("contain", count);
});

Then("I get to the post page of {string}", path => {
  path = path.replace("...", "");
  cy.url().should("contain", "/post/");
  cy.url().should("contain", path);
});

When(
  "I start to write a new post with the title {string} beginning with:",
  (title, intro) => {
    cy.get(".post-add-button").click();
    cy.get('input[name="title"]').type(title);
    cy.get(".ProseMirror").type(intro);
  }
);

When("mention {string} in the text", mention => {
  cy.get(".ProseMirror").type(" @");
github Human-Connection / Human-Connection / cypress / integration / common / steps.js View on Github external
cy.get(".avatar-menu").click();
  cy.get(".avatar-menu-popover").contains(narratorParams.name);
});

When("I select {string} in the language menu", name => {
  cy.switchLanguage(name, true);
});
Given("I previously switched the language to {string}", name => {
  cy.switchLanguage(name, true);
});
Then("the whole user interface appears in {string}", name => {
  const lang = getLangByName(name);
  cy.get(`html[lang=${lang.code}]`);
  cy.getCookie("locale").should("have.property", "value", lang.code);
});
Then("I see a button with the label {string}", label => {
  cy.contains("button", label);
});

When(`I click on {string}`, linkOrButton => {
  cy.contains(linkOrButton).click();
});

When(`I click on the menu item {string}`, linkOrButton => {
  cy.contains(".ds-menu-item", linkOrButton).click();
});

When("I press {string}", label => {
  cy.contains(label).click();
});

Given("we have the following posts in our database:", table => {
github Human-Connection / Human-Connection / cypress / integration / common / post.js View on Github external
Then("my comment should be successfully created", () => {
  cy.get(".iziToast-message").contains("Comment Submitted");
});

Then("I should see my comment", () => {
  cy.get("div.comment p")
    .should("contain", "Human Connection rocks")
    .get(".ds-avatar img")
    .should("have.attr", "src")
    .and("contain", narratorAvatar)
    .get("div p.ds-text span")
    .should("contain", "today at");
});

Then("I should see the entirety of my comment", () => {
  cy.get("div.comment")
  .should("not.contain", "show more")
});

Then("I should see an abreviated version of my comment", () => {
  cy.get("div.comment")
  .should("contain", "show more")
});

Then("the editor should be cleared", () => {
  cy.get(".ProseMirror p").should("have.class", "is-empty");
});
github TheBrainFamily / cypress-cucumber-preprocessor / cypress / support / step_definitions / before_and_after_steps.js View on Github external
expect(beforeCounter).to.equal(0);
});

Then("Tagged Before was called once", () => {
  expect(beforeWithTagCounter).to.equal(1);
});

Then("Tagged Before was called twice", () => {
  expect(beforeWithTagCounter).to.equal(2);
});

Then("Tagged Before was not called", () => {
  expect(beforeWithTagCounter).to.equal(0);
});

Then("Flag should be set by untagged After", () => {
  expect(flagSetByUntaggedAfter).to.equal(true);
});

Then("Flag should be set by tagged After", () => {
  expect(flagSetByTaggedAfter).to.equal(true);
});