Skip to content

Conversation

dani-sie
Copy link

Add Advanced Custom Kraken Steps for Contextual UI Interactions and Assertions

This section documents a comprehensive set of advanced custom step definitions for Kraken end-to-end testing with Cucumber. These steps significantly enhance the flexibility, readability, and maintainability of test scenarios, especially when dealing with complex or dynamic DOM structures.

Key contributions:

  • Keyboard Interactions:
    Adds a step to simulate special key presses such as Enter, Esc, Tab, ArrowUp, and ArrowDown using Unicode mappings.

  • Screenshots:
    Implements automatic screenshot capture steps that store the image in a structured directory based on the test version and feature name.

  • URL Validation:
    Introduces a step to wait for and assert the current URL, validating navigation or redirection behavior.

  • Flexible Element Selection and Interaction:
    Adds several click, clear, and enter steps that support:
    • Direct selector targeting.
    • Contextual targeting via closest parent.
    • Targeting within parent located via a child reference.
    This allows for precise, conflict-free interactions even in nested or repeated DOM structures.

  • DOM Traversal Utilities:
    Includes helper functions closest and find:
    • closest: Recursively finds the nearest ancestor matching a given class selector.
    • find: Selects the first matching child within a given parent element.

  • Robust Field Manipulation:
    Steps to clear and enter text with context-aware scope, ensuring clean input even in nested components or similar forms.

  • Text Assertions:
    (Partially shown) Includes assertion steps to check for specific text content within elements.

These custom steps allow testers to write more expressive and modular Cucumber scenarios while minimizing selector collisions and ensuring consistent interaction with dynamic frontends.

This enhancement improves reusability across different versions or UI states of the application, laying the groundwork for scalable and maintainable E2E testing practices with Kraken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant