korobochka / jasmine-allure2-reporter

Jasmine reporter for Allure 2
MIT License
6 stars 1 forks source link

Documentation #1

Open jithinkmatthew opened 5 years ago

jithinkmatthew commented 5 years ago

@korobochka , Could you please provide instructions to configure this? or Is it same like allure-jasmine

korobochka commented 5 years ago

I don't have any real documentation, but there is an example in https://github.com/korobochka/jasmine-allure2-reporter/blob/master/test/Setup.ts

Basic setup boils down to:

const reporter = new JasmineAllureReporter(new AllureRuntime({
    resultsDir: "./allure-results"
}));
jasmine.getEnv().addReporter(reporter);
export const allure: AllureInterface = reporter.getInterface();

Do you have any specific questions?

jithinkmatthew commented 5 years ago

@korobochka , Thanks for the reply. I will try to configure it based on your suggestion and let you know.

ValeriiBorovyk commented 4 years ago

Hi @korobochka Can you please clarify how to attach screenshots to the report? For example, on tests failed.

I try to use jasmine-allure2-reporter with Protractor and Jasmine2 And I added next code into my setup.ts, based on the original jasmine-allure documentation :

jasmine.getEnv().afterEach(function () {
    browser.takeScreenshot().then(png => allure.attachment('Screenshot', Buffer.from(png, 'base64'), ContentType.PNG));
    });

It captures a screenshot, but the screenshot is not present in the generated report.

korobochka commented 4 years ago

@ValeriiBorovyk the code you provided is missing a return to make sure async screenshot operation is correctly awaited. Should be something like:

jasmine.getEnv().afterEach(function () {
    return browser.takeScreenshot().then(png => allure.attachment('Screenshot', Buffer.from(png, 'base64'), ContentType.PNG));
});

For Protractor it needs to be placed into onPrepare in the Protractors Config, not sure what do you mean by setup.ts.

ValeriiBorovyk commented 4 years ago

@korobochka setup.ts - means https://github.com/korobochka/jasmine-allure2-reporter/blob/master/test/Setup.ts

Can you please share an example of protractor.conf.js with configured this version of allure?