allure-js
allure-js copied to clipboard
[allure-js] Is it possible to add actual request and response in the steps?
Is it possible to attach actual request and response in the test steps?
`e.g in Python
allure.attach() ?`
I want to add in the report that each time I send request from a test endpoint I can add it in the report both request and response.
you can use playwright attachments and is will aper in you allure report
import { test } from "@playwright/test";
import { allure } from "allure-playwright";
test("simpleTest", async ({ page }, testInfo) => {
allure.epic("this test is epic");
testInfo.attach("filename.txt"); // attach any files like this
await page.goto("https://web.telegram.org/k/");
test.expect(true).toBe(false);
});
@vovsemenv thank you, I am able to attach the payload request and response of the API. However it should be inside the Given, When and Then test steps only. The 'this.attach()' is available only inside the Given..
And also the attachments are added after the last step of the feature.

For now you can't see step attachments due to https://github.com/microsoft/playwright/issues/14364 . also added more detailed info of steps and attachments usage in README
@gg-jaycee-suarez with the new version on cucumber-integration this.attach
will be available inside Given, When and Then
Now you can use this.atach()
in cucumber integration.
update and read more https://github.com/allure-framework/allure-js/tree/master/packages/allure-cucumberjs#using-allure-api