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

description method doesn't work for codeceptjs before hook, and event.started #691

Open
hatufacci opened this issue May 29, 2023 · 1 comment · May be fixed by #692
Open

description method doesn't work for codeceptjs before hook, and event.started #691

hatufacci opened this issue May 29, 2023 · 1 comment · May be fixed by #692

Comments

@hatufacci
Copy link
Contributor

hatufacci commented May 29, 2023

i found that on my point of view we create current.test too late . right now it’s inside this method

testStarted(test) {
    this.currentTest = test;
    const allureTest = this.allureTestByCodeceptTest(test);
    const { labels } = (0, helpers_1.extractMeta)(test);
    if (allureTest) {
        labels.forEach((label) => {
            allureTest.addLabel(label.name, label.value);
        });
    }
}

and if i try add description in before hook or in
event.dispatcher.on(event.test.started, async (test) => {
in my repo - it will doesn’t add description because testStarted method works after my before.hook and event.test.started
that's why

this.description = (description) => {
    if (this.currentAllureTest) {
        this.currentAllureTest.description = description;
    }
};

doesn’t add description - we have no this.currentTest in the moment
but!! when we start suite we exactly know test!! by suite.ctx.currentTest
and if we init currentTest in

suiteStarted(suite) {
        suite.tests.forEach((test) => {
            this.createTest(test);
        });
        this.currentTest = suite.ctx.currentTest
    }

description method will work in before hook and in event.test.started

@hatufacci
Copy link
Contributor Author

I've add MR #692

@baev baev linked a pull request May 29, 2023 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants