Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Healer priorities and steps are not respected #4347

Open
lewimuchiri opened this issue May 13, 2024 · 0 comments
Open

Healer priorities and steps are not respected #4347

lewimuchiri opened this issue May 13, 2024 · 0 comments

Comments

@lewimuchiri
Copy link

lewimuchiri commented May 13, 2024

I have two healers defined as follows:

heal.addRecipe('clickAndType', {
  priority: 1,
  steps: [
    'fillField',
    'appendField',
  ],
  fn: async ({ step }) => {
    const locator = step.args[0];
    const text = step.args[1];

    return ({ I }) => {
      console.log("HEALING THE FILL_FIELD FUNCTION " + locator);

      I.click(locator);
      I.wait(1); // to open modal or something
      I.type(text);
    };
  },
});

heal.addRecipe("waitForVisibleThenClick", {
  priority: 1,
  steps: [
    "click"
  ],
  fn: async ({ step }) => {
    const locator = step.args[0];

    return ({ I }) => {
      console.log("HEALING THE CLICK FUNCTION " + locator);

      I.waitForVisible(locator, 8);
      I.click(locator);
    };
  },
});

And then I have a failing step I.click('#mat-mdc-checkbox-1-input');
When I run my tests, I've noticed that the clickAndType recipe is being called instead of the waitForVisibleThenClick recipe yet clickAndType recipe has not been defined for the click step. Same thing happens even when I change the priorities such that waitForVisibleThenClick has a higher priority. Also, when I comment-out the clickAndType recipe, now the waitForVisibleThenClick is called, which indicates that it was formerly not being called because clickAndType was being called.
Any hints?

Details

  • CodeceptJS version: 3.6.2
  • NodeJS Version: 20.12.2
  • Operating System: Windows 11
  • Playwright Helper
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

No branches or pull requests

1 participant