Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
epszaw committed Feb 21, 2024
1 parent 266e751 commit 9ed18c1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
32 changes: 27 additions & 5 deletions packages/hermione-allure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ it("my test", async ({ browser, currentTest }) => {

const screenshot = await browser.takeScreenshot();

await allure(currentTest).attach(screenshot, "image/png");
await allure(currentTest).attachment(screenshot, "image/png");
await allure(currentTest).epic("my_epic");
await allure(currentTest).parameter("parameter_name", "parameter_value", {
mode: "hidden",
Expand Down Expand Up @@ -150,13 +150,13 @@ it("my test", async ({ currentTest }) => {

### Attachments

Attach any file as string or buffer using `attach` method:
Attach any file as string or buffer using `attachment` method:

```js
import { allure } from "hermione-allure/runtime";

it("my test", async ({ currentTest }) => {
await allure(currentTest).attach(JSON.stringify({ foo: "bar" }), "application/json");
await allure(currentTest).attachment(JSON.stringify({ foo: "bar" }), "application/json", "Attachment name");
});
```

Expand All @@ -168,7 +168,7 @@ import { allure } from "hermione-allure/runtime";
it("adds screenshots", async ({ browser, currentTest }) => {
const screenshot = await browser.takeScreenshot();

await allure(currentTest).attach(screenshot, "image/png");
await allure(currentTest).attachment(screenshot, "image/png");
});
```

Expand All @@ -187,9 +187,31 @@ it("my test", async ({ browser, currentTest }) => {
await allure(currentTest).label("foo", "bar");
// attachments and parameters will be added to the step, not the test
await allure(currentTest).parameter("baz", "qux");
await allure(currentTest).attach("attachment content", "text/plain");
await allure(currentTest).attachment("attachment content", "text/plain");
});
});
});
});
```

### Custom history ID

You can reassign history ID for the test case using `historyId` method:

```js
import { allure } from "hermione-allure/runtime";

it("my test", async ({ currentTest }) => {
await allure(currentTest).historyId("my_history_id");
});
```

### Custom test case ID

```js
import { allure } from "hermione-allure/runtime";

it("my test", async ({ currentTest }) => {
await allure(currentTest).testCaseId("my_id");
});
```
1 change: 0 additions & 1 deletion packages/hermione-allure/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Stage,
Status,
StatusDetails,
StepBodyFunction,
} from "allure-js-commons";
import { ALLURE_METADATA_CONTENT_TYPE } from "allure-js-commons/internal";
import {
Expand Down

0 comments on commit 9ed18c1

Please sign in to comment.