Skip to content

Support automatic loading of step definitions from External Modules#262

Draft
aldefouw wants to merge 1 commit intomasterfrom
support_em_testing
Draft

Support automatic loading of step definitions from External Modules#262
aldefouw wants to merge 1 commit intomasterfrom
support_em_testing

Conversation

@aldefouw
Copy link
Copy Markdown
Collaborator

@aldefouw aldefouw commented Mar 4, 2026

The aim of this change is to support the automatic loading of step definitions that are defined for an EM right within the package.json file by default.

We've standardized on the path for automated tests existing here:

"../redcap_source/modules/**/automated-tests/

So, I think this makes sense.

Pre-flight Checklist

  • Have all lines in this PR been reviewed & optimized by a human with appropriate coding skills?
  • Are all the features in this PR tested by a human?
  • Have other features this PR touches also been tested by a human?
  • Has the code been formatted for consistency and readability?
  • Did you also update related documentation and tooling, such as .readme or tests?

Overview

This change supports loading step definitions from the External Modules. Without it, you'd have to manually copy step definitions into the base redcap_cypress/support/step_definitions folder.

Context

This is the setup we're using at UW to make this work.

Note:

1 This is recommended approach per official documentation within cypress-cucumber-preprocessor repository as linked here:
https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/step-definitions.md

2 You'll notice that "step_definitions" (snakecase) moves to "stepDefinitions" (camelcase). This is not a mistake. It appears this is a long standing bug. It should have been camelcase since the beginning.

If we want to support EMs, we want to support loading of step definitions that are defined for an EM
@aldefouw aldefouw requested a review from mmcev106 March 4, 2026 22:22
@aldefouw aldefouw marked this pull request as draft March 10, 2026 16:29
@MintooXavier
Copy link
Copy Markdown

I tested this. The step definitions are being picked up from the EM repository, but when a step definition is shared between two EMs, I have to add it to both repositories. This then causes Cypress to report duplicate step definitions during execution.

@mmcev106
Copy link
Copy Markdown
Collaborator

Thanks for the feedback @MintooXavier! @aldefouw, to resolve this, does it make sense to only load step definitions for the module currently being tested?

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.

3 participants