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

Sub-steps when using CodeceptJS page objects #1242

Closed
nikzupancic opened this issue Feb 4, 2025 · 0 comments · Fixed by #1243
Closed

Sub-steps when using CodeceptJS page objects #1242

nikzupancic opened this issue Feb 4, 2025 · 0 comments · Fixed by #1243

Comments

@nikzupancic
Copy link

nikzupancic commented Feb 4, 2025

Is your feature request related to a problem? Please describe.
CodeceptJS contains a feature called page object which allows you to group steps into methods instead of just writing a long test line-by-line, potentially making it difficult to read through. Until now I've been using allure-legacy plugin. Because it is not maintained any longer I'm looking to switch to new allure-codeceptjs instead.

One of the main differences I've noticed between the 2 is how steps within page objects are presented in the report. For additional context here is the small sample test I'm using. Scenario:

Scenario('login test',  ({ I, login }) => {
    I.amOnPage('https://github.com')
    I.waitForVisible('.lp-IntroHero')
    login.openLoginPage()
})

Login page object:

const { I } = inject()

module.exports = {
    openLoginPage() {
        I.waitForVisible('.HeaderMenu-link--sign-in')
        I.click('.HeaderMenu-link--sign-in')
        I.waitForVisible('.auth-form-body')
    }
}

The legacy plugin reports these as sub-steps within the page object method which IMO makes it much easier to read:
Image

Newer plugin instead just reports everything as a top-level step so there's no indication which steps come from a page object and which are defined inside scenario itself:
Image

Describe the solution you'd like
I think it would be nice to have the same nested sub-steps in the new plugin as well. Are there any plans to support this? Maybe at least have an option that can be enabled if such nesting is needed?

Describe alternatives you've considered
I've thought about somehow modifying this using a custom plugin on top of allure-codeceptjs plugin but since all of the logic for defining steps is contained within that plugin I don't think I can do this (other than re-writing the whole plugin myself).

Additional context
As far as I understand the code the legacy plugin achieved this using something called metasteps. I've noticed there is a reference to metastep in this repository within Typescript definitions but it doesn't seem to be used anywhere?

For reference these are dependencies from package.json used in the above example. I'm using Playwright but it should be the same with other drivers.

"dependencies": {
    "@codeceptjs/allure-legacy": "1.0.2",
    "allure-codeceptjs": "3.1.0",
    "codeceptjs": "3.6.10",
    "playwright": "1.50.1"
}

Node version: v20.10.0

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 a pull request may close this issue.

1 participant