Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wdio/cucumber-framework

Package Overview
Dependencies
Maintainers
3
Versions
370
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wdio/cucumber-framework

A WebdriverIO plugin. Adapter for Cucumber.js testing framework.

  • 9.2.5
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is @wdio/cucumber-framework?

@wdio/cucumber-framework is a plugin for WebdriverIO that allows you to use the Cucumber testing framework to write and execute feature files written in Gherkin syntax. This integration enables Behavior Driven Development (BDD) by allowing you to define application behavior in plain text and then automate the testing of that behavior.

What are @wdio/cucumber-framework's main functionalities?

Define Feature Files

You can define feature files using Gherkin syntax to describe the behavior of your application. These feature files are written in plain text and can be understood by all stakeholders.

Feature: User login
  Scenario: Successful login with valid credentials
    Given I am on the login page
    When I enter valid credentials
    Then I should be redirected to the dashboard

Step Definitions

Step definitions are used to map the steps in your feature files to actual code that performs the actions. This allows you to automate the testing of the behavior described in your feature files.

const { Given, When, Then } = require('@cucumber/cucumber');

Given('I am on the login page', async () => {
  await browser.url('/login');
});

When('I enter valid credentials', async () => {
  await $('#username').setValue('user');
  await $('#password').setValue('password');
  await $('button[type="submit"]').click();
});

Then('I should be redirected to the dashboard', async () => {
  await expect(browser).toHaveUrl('/dashboard');
});

Hooks

Hooks allow you to run code before and after each scenario or step. This is useful for setting up preconditions or cleaning up after tests.

const { Before, After } = require('@cucumber/cucumber');

Before(async () => {
  // Code to run before each scenario
  await browser.reloadSession();
});

After(async () => {
  // Code to run after each scenario
  await browser.deleteCookies();
});

Other packages similar to @wdio/cucumber-framework

Keywords

FAQs

Package last updated on 29 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc