### Example Configuration with Categories Source: https://github.com/allure-framework/allure3/blob/main/README.md An example `allurerc.mjs` configuration file showcasing the setup of categories for grouping test results based on statuses, severity, owner, and environment, including flaky test identification. ```javascript import { defineConfig } from "allure"; export default defineConfig({ name: "Allure Report Example", output: "./out/allure-report", categories: [ { name: "Product errors", matchers: { statuses: ["failed"] }, groupBy: ["severity", "owner", "environment"], groupByMessage: true, groupEnvironments: true, expand: true, }, { name: "Flaky tests", matchers: { flaky: true }, groupBy: ["flaky"], groupByMessage: false, hide: false, }, ], plugins: { awesome: { options: { reportLanguage: "en", }, }, }, }); ``` -------------------------------- ### Install @allurereport/web-dashboard with yarn Source: https://github.com/allure-framework/allure3/blob/main/packages/web-dashboard/README.md Install the package using yarn. ```shell yarn add @allurereport/web-dashboard ``` -------------------------------- ### Install @allurereport/web-awesome Source: https://github.com/allure-framework/allure3/blob/main/packages/web-awesome/README.md Install the package using npm, yarn, or pnpm. ```shell npm add @allurereport/web-awesome yarn add @allurereport/web-awesome pnpm add @allurereport/web-awesome ``` -------------------------------- ### Install @allurereport/web-dashboard with pnpm Source: https://github.com/allure-framework/allure3/blob/main/packages/web-dashboard/README.md Install the package using pnpm. ```shell pnpm add @allurereport/web-dashboard ``` -------------------------------- ### Install Testplan Plugin Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-testplan/README.md Install the @allurereport/plugin-testplan package using npm, yarn, or pnpm. ```shell npm add @allurereport/plugin-testplan yarn add @allurereport/plugin-testplan pnpm add @allurereport/plugin-testplan ``` -------------------------------- ### Install Static Server Source: https://github.com/allure-framework/allure3/blob/main/packages/static-server/README.md Install the static server package using npm, yarn, or pnpm. ```shell npm add @allurereport/static-server yarn add @allurereport/static-server pnpm add @allurereport/static-server ``` -------------------------------- ### Install @allurereport/web-dashboard with npm Source: https://github.com/allure-framework/allure3/blob/main/packages/web-dashboard/README.md Install the package using npm. ```shell npm add @allurereport/web-dashboard ``` -------------------------------- ### Install AQL Package Source: https://github.com/allure-framework/allure3/blob/main/packages/aql/README.md Install the Allure Query Language package using npm, yarn, or pnpm. ```shell npm add @allurereport/aql yarn add @allurereport/aql pnpm add @allurereport/aql ``` -------------------------------- ### Install Dependencies Source: https://github.com/allure-framework/allure3/blob/main/packages/e2e/README.md Installs the necessary dependencies for the Allure packages. ```shell yarn install ``` -------------------------------- ### Install Server Reload Plugin Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-server-reload/README.md Install the plugin using your preferred package manager. ```shell npm add @allurereport/plugin-server-reload yarn add @allurereport/plugin-server-reload pnpm add @allurereport/plugin-server-reload ``` -------------------------------- ### Install Web Allure Classic Source: https://github.com/allure-framework/allure3/blob/main/packages/web-classic/README.md Install the @allurereport/web-classic package using npm, yarn, or pnpm. ```shell npm add @allurereport/web-classic yarn add @allurereport/web-classic pnpm add @allurereport/web-classic ``` -------------------------------- ### Install Dashboard Plugin Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-dashboard/README.md Install the plugin using your preferred package manager. ```shell npm add @allurereport/plugin-dashboard yarn add @allurereport/plugin-dashboard pnpm add @allurereport/plugin-dashboard ``` -------------------------------- ### Install Allure Classic Plugin Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-allure2/README.md Install the plugin using npm, yarn, or pnpm. ```shell npm add @allurereport/plugin-classic yarn add @allurereport/plugin-classic pnpm add @allurereport/plugin-classic ``` -------------------------------- ### Allure Configuration File Example Source: https://github.com/allure-framework/allure3/blob/main/packages/cli/README.md An example of an 'allurerc.mjs' configuration file demonstrating how to set the report name, output directory, and configure the Awesome plugin with specific options. ```javascript import { defineConfig } from "allure"; export default defineConfig({ name: "Allure Report Example", output: "./out/allure-report", hideLabels: ["owner", /^_/], plugins: { awesome: { options: { singleFile: true, reportLanguage: "en", }, }, }, }); ``` -------------------------------- ### Install Allure Log Plugin Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-log/README.md Install the plugin using npm, yarn, or pnpm. ```shell npm add @allurereport/plugin-log yarn add @allurereport/plugin-log pnpm add @allurereport/plugin-log ``` -------------------------------- ### Install Allure Web Components Source: https://github.com/allure-framework/allure3/blob/main/packages/web-components/README.md Install the @allurereport/web-components package using your preferred package manager. ```shell npm add @allurereport/web-components ``` ```shell yarn add @allurereport/web-components ``` ```shell pnpm add @allurereport/web-components ``` -------------------------------- ### Install Allure Jira Plugin Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-jira/README.md Install the plugin using npm, yarn, or pnpm. ```shell npm add @allurereport/plugin-jira yarn add @allurereport/plugin-jira pnpm add @allurereport/plugin-jira ``` -------------------------------- ### Compact Coverage-Review Pattern with Allure Agent Source: https://github.com/allure-framework/allure3/blob/main/docs/allure-agent-mode.md A concise pattern for configuring the Allure Agent to review test coverage within a specific workspace and scope. This example demonstrates a streamlined setup for agent-based test reviews. ```bash TMP_DIR="$(mktemp -d)" EXPECTATIONS="$TMP_DIR/expectations.yaml" yarn allure agent \ --output "$TMP_DIR/agent-output" \ --expectations "$EXPECTATIONS" \ -- yarn workspace test ``` -------------------------------- ### Install Directory Watcher Source: https://github.com/allure-framework/allure3/blob/main/packages/directory-watcher/README.md Install the Directory Watcher package using npm, yarn, or pnpm. ```shell npm add @allurereport/directory-watcher ``` ```shell yarn add @allurereport/directory-watcher ``` ```shell pnpm add @allurereport/directory-watcher ``` -------------------------------- ### Install Allure Web Commons Source: https://github.com/allure-framework/allure3/blob/main/packages/web-commons/README.md Install the @allurereport/web-commons package using npm, yarn, or pnpm. ```shell npm add @allurereport/web-commons ``` ```shell yarn add @allurereport/web-commons ``` ```shell pnpm add @allurereport/web-commons ``` -------------------------------- ### Install Slack Plugin with npm, yarn, or pnpm Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-slack/README.md Install the Slack plugin using your preferred package manager. ```shell npm add @allurereport/plugin-slack yarn add @allurereport/plugin-slack pnpm add @allurereport/plugin-slack ``` -------------------------------- ### Install Allure TestOps Plugin Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-testops/README.md Install the plugin using npm, yarn, or pnpm. ```shell npm add @allurereport/plugin-testops ``` ```shell yarn add @allurereport/plugin-testops ``` ```shell pnpm add @allurereport/plugin-testops ``` -------------------------------- ### AQL Parser Configuration Example Source: https://github.com/allure-framework/allure3/blob/main/packages/aql/README.md Demonstrates how to configure the AQL parser to restrict available operations, logical operators, identifiers, and value types for security or specific use cases. ```typescript import { parseAql } from "@allurereport/aql"; const config = { // Allow only specific operations operations: ["EQ", "NEQ"], // Allow only specific logical operators logicalOperators: ["AND", "OR"], // Allow only specific identifiers identifiers: ["status", "name", "age"], // Or use a validation function identifiers: (id: string) => id.startsWith("custom_"), // Allow only specific value types valueTypes: ["STRING", "NUMBER"], // Disable parentheses parentheses: false, // Disable bracket access (identifier[key]) indexAccess: false, }; const result = parseAql('status = "passed"', undefined, config); ``` -------------------------------- ### Install Allure Plugin Awesome Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-awesome/README.md Install the plugin using npm, yarn, or pnpm. This command adds the necessary package to your project dependencies. ```shell npm add @allurereport/plugin-awesome yarn add @allurereport/plugin-awesome pnpm add @allurereport/plugin-awesome ``` -------------------------------- ### Programmatic Usage of Static Server Source: https://github.com/allure-framework/allure3/blob/main/packages/static-server/README.md Programmatically start the static server, configure port, serve path, and live reload. Includes methods to reload and stop the server. ```javascript import { serve } from "@allurereport/static-server"; const server = await serve({ // by default uses a random available port port: 8080, // path to the directory with files should be served servePath: "/path/to/your/static/files", // enable live reload live: true, }); // reloads the served pages manually, even if live reload isn't enabled await server.reload(); // stops the server await server.stop(); ``` -------------------------------- ### Install Allure Reader API Source: https://github.com/allure-framework/allure3/blob/main/packages/reader-api/README.md Install the Allure Reader API package using npm, yarn, or pnpm. ```shell npm add @allurereport/reader-api yarn add @allurereport/reader-api pnpm add @allurereport/reader-api ``` -------------------------------- ### Install Allure Reader Package Source: https://github.com/allure-framework/allure3/blob/main/packages/reader/README.md Install the @allurereport/reader package using npm, yarn, or pnpm. ```shell npm add @allurereport/reader ``` ```shell yarn add @allurereport/reader ``` ```shell pnpm add @allurereport/reader ``` -------------------------------- ### Install Allure Progress Plugin Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-progress/README.md Install the plugin using npm, yarn, or pnpm. This command adds the necessary package to your project dependencies. ```shell npm add @allurereport/plugin-progress yarn add @allurereport/plugin-progress pnpm add @allurereport/plugin-progress ``` -------------------------------- ### Coverage-Review Expectations Example Source: https://github.com/allure-framework/allure3/blob/main/skills/allure-agent-mode-feature-delivery/SKILL.md An example of an expectations file for a coverage review, specifying the goal, task ID, and expected labels for a module. ```yaml goal: Review package tests task_id: package-review expected: label_values: module: my-module notes: - Review runtime evidence before source inspection. ``` -------------------------------- ### Install Allure Core API Source: https://github.com/allure-framework/allure3/blob/main/packages/core-api/README.md Install the Allure Core API package using npm, yarn, or pnpm. ```shell npm add @allurereport/core-api yarn add @allurereport/core-api pnpm add @allurereport/core-api ``` -------------------------------- ### Install Allure Plugin API Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-api/README.md Install the Allure Plugin API package using npm, yarn, or pnpm. ```shell npm add @allurereport/plugin-api yarn add @allurereport/plugin-api pnpm add @allurereport/plugin-api ``` -------------------------------- ### Minimal Harness Example for Agent Review Source: https://github.com/allure-framework/allure3/blob/main/docs/agent_enrichment_loop.md This snippet demonstrates setting up agent expectations for validating feature A and reviewing the agent's output. It uses `buildAgentExpectations` to define targets and forbidden patterns, and `reviewAgentOutput` to assess the report. ```typescript import { buildAgentExpectations, reviewAgentOutput } from "@allurereport/plugin-agent"; import { writeFile } from "node:fs/promises"; const expectations = buildAgentExpectations({ goal: "Validate feature A", taskId: "feature-a", target: { environments: ["default"], fullNamePrefixes: ["feature A"], labelValues: { feature: "feature-a" }, }, forbidden: { fullNamePrefixes: ["feature B"], labelValues: { feature: ["feature-b", "legacy-feature"] }, }, notes: ["Only feature A tests should run."], }); await writeFile("./out/agent-expected.json", JSON.stringify(expectations, null, 2)); const review = await reviewAgentOutput("./out/agent-report"); if (review.status !== "accept") { for (const item of review.plan) { console.log(item.checkName, item.category, item.remediationHint); } } ``` -------------------------------- ### Install Allure Charts API Source: https://github.com/allure-framework/allure3/blob/main/packages/charts-api/README.md Install the Allure Charts API package using npm, yarn, or pnpm. ```shell npm add @allurereport/charts-api yarn add @allurereport/charts-api pnpm add @allurereport/charts-api ``` -------------------------------- ### Check Allure Version Source: https://github.com/allure-framework/allure3/blob/main/packages/cli/README.md Verify the installed version of Allure 3 by running the '--version' command. ```bash npx allure --version ``` -------------------------------- ### Install Allure 3 Globally Source: https://github.com/allure-framework/allure3/blob/main/packages/cli/README.md Installs the Allure 3 CLI globally using npm. This allows direct execution of 'allure' commands. ```bash npm install -g allure ``` -------------------------------- ### Install Allure CSV Plugin Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-csv/README.md Install the plugin using npm, yarn, or pnpm. This command adds the necessary package to your project dependencies. ```shell npm add @allurereport/plugin-csv yarn add @allurereport/plugin-csv pnpm add @allurereport/plugin-csv ``` -------------------------------- ### Get Help for Allure Commands Source: https://github.com/allure-framework/allure3/blob/main/packages/cli/README.md Use the '--help' option with specific Allure commands to view detailed usage information and available subcommands. ```bash npx allure run --help ``` ```bash npx allure agent --help ``` ```bash npx allure watch --help ``` -------------------------------- ### AQL Parser Return Value Example Source: https://github.com/allure-framework/allure3/blob/main/packages/aql/README.md Provides an example of the `AqlParseResult` structure returned by the `parseAql` function, illustrating the AST for a combined condition. ```typescript const result = parseAql('status = "passed" AND age > 25'); // result.expression = { // type: "binary", // operator: "AND", // left: { // type: "condition", // left: { identifier: "status" }, // operator: "EQ", // right: { value: "passed", type: "STRING" } // }, // right: { // type: "condition", // left: { identifier: "age" }, // operator: "GT", // right: { value: "25", type: "NUMBER" } // } // } ``` -------------------------------- ### Common AQL Syntax Error Examples Source: https://github.com/allure-framework/allure3/blob/main/packages/aql/README.md Illustrates common AQL syntax errors such as unexpected characters, unterminated strings, and missing tokens, along with how to catch them. ```typescript // Syntax error - unexpected character try { parseAql('status @ "passed"'); } catch (error) { // error.code = "UNEXPECTED_CHARACTER" // error.message = "Unexpected character '@' at position 7" } // Unterminated string try { parseAql('status = "passed'); } catch (error) { // error.code = "UNTERMINATED_STRING" // error.message = "Unterminated string at position 7" } // Expected token try { parseAql("status ="); } catch (error) { // error.code = "EXPECTED_TOKEN" // error.message = "Expected value at position 9" } // Forbidden operation (with config) try { const config = { operations: ["EQ"] }; parseAql('status > "passed"', undefined, config); } catch (error) { // error.code = "FORBIDDEN_OPERATION" // error.message = "Operation 'GT' is not allowed at position 7" } ``` -------------------------------- ### Install Allure Agent Plugin with yarn Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-agent/README.md Install the Allure Agent plugin using yarn. This command adds the necessary package to your project dependencies. ```shell yarn add @allurereport/plugin-agent ``` -------------------------------- ### Install Allure Agent Plugin with pnpm Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-agent/README.md Install the Allure Agent plugin using pnpm. This command adds the necessary package to your project dependencies. ```shell pnpm add @allurereport/plugin-agent ``` -------------------------------- ### Install Allure Agent Plugin with npm Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-agent/README.md Install the Allure Agent plugin using npm. This command adds the necessary package to your project dependencies. ```shell npm add @allurereport/plugin-agent ``` -------------------------------- ### Run Tests with npm and Generate Report Source: https://github.com/allure-framework/allure3/blob/main/packages/cli/README.md A specific example of using the 'npx allure run' command to execute npm tests and generate an Allure report. ```bash npx allure run -- npm test ``` -------------------------------- ### Install Allure Core with yarn Source: https://github.com/allure-framework/allure3/blob/main/packages/core/README.md Use yarn to add the @allurereport/core package to your project dependencies. ```shell yarn add @allurereport/core ``` -------------------------------- ### Install Allure Core with pnpm Source: https://github.com/allure-framework/allure3/blob/main/packages/core/README.md Use pnpm to add the @allurereport/core package to your project dependencies. ```shell pnpm add @allurereport/core ``` -------------------------------- ### Run Tests with Allure 3 CLI (Recommended) Source: https://github.com/allure-framework/allure3/blob/main/packages/cli/README.md Executes a test command and generates an Allure report without global installation. Ensures the latest version is used. ```bash npx allure run -- ``` -------------------------------- ### Install Allure Core with npm Source: https://github.com/allure-framework/allure3/blob/main/packages/core/README.md Use npm to add the @allurereport/core package to your project dependencies. ```shell npm add @allurereport/core ``` -------------------------------- ### Rejected Enrichment Examples Source: https://github.com/allure-framework/allure3/blob/main/docs/agent_enrichment_loop.md Illustrates common patterns of rejected enrichment, such as generic steps, placeholder attachments, and meaningless labels. These examples highlight what not to include in runtime enrichment. ```typescript await step("success", () => {}); await attachment("result.txt", "test passed", "text/plain"); await label("feature", "placeholder"); ``` -------------------------------- ### Run npm Tests in Agent Mode Source: https://github.com/allure-framework/allure3/blob/main/packages/cli/README.md A specific example of using the 'npx allure agent' command to execute npm tests and generate markdown output. ```bash npx allure agent -- npm test ``` -------------------------------- ### Parse AQL with Configuration Source: https://github.com/allure-framework/allure3/blob/main/packages/aql/README.md Use a configuration object with `parseAql` to restrict available AQL features for security or validation. This example shows limiting operations, identifiers, and logical operators. ```typescript import { parseAql } from "@allurereport/aql"; // Restrict available features for security or validation const config = { operations: ["EQ", "NEQ"], // Only allow equality checks identifiers: ["status", "name"], // Only allow specific fields logicalOperators: ["AND"], // Only allow AND operator }; // This will succeed const result = parseAql('status = "passed" AND name = "test"', undefined, config); // This will throw an error (OR is not allowed) // parseAql('status = "passed" OR name = "test"', undefined, config); ``` -------------------------------- ### Review-Oriented Expectations Example Source: https://github.com/allure-framework/allure3/blob/main/skills/allure-agent-mode-setup/references/project-guide-template.md Use this YAML structure to define expectations for reviewing module tests. It specifies the goal, a task ID, and expected labels. ```yaml goal: Review module tests task_id: module-review expected: label_values: module: my-module notes: - Review runtime evidence before source inspection. ``` -------------------------------- ### Example Expectations File Format Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-agent/README.md Defines the structure for an expectations file used to specify expected and forbidden test scopes. Supports YAML or JSON format. ```yaml goal: Validate feature A task_id: feature-a expected: environments: - default full_names: - suite feature A should work full_name_prefixes: - suite feature A label_values: feature: feature-a forbidden: full_names: - suite feature B should not run full_name_prefixes: - suite feature B label_values: feature: - feature-b - legacy-feature notes: - Only feature A tests should run. ``` -------------------------------- ### Get Agent State Directory Source: https://github.com/allure-framework/allure3/blob/main/docs/allure-agent-mode.md Prints the state directory for the current project. Use this when you need to inspect where `latest` pointers are stored or debug sandbox behavior. ```bash allure agent state-dir ``` -------------------------------- ### Single-Spec Expectations Example Source: https://github.com/allure-framework/allure3/blob/main/skills/allure-agent-mode-setup/references/project-guide-template.md Define expectations for reviewing a single spec file using this YAML format. It includes the goal, task ID, and expected label for the specific package. ```yaml goal: Review one spec task_id: single-spec-review expected: label_values: package: path/to/spec.test.ts notes: - Review runtime evidence before source inspection. ``` -------------------------------- ### Build Allure Packages Source: https://github.com/allure-framework/allure3/blob/main/packages/e2e/README.md Builds all the Allure packages. This command should be run from the root directory. ```shell yarn build ``` -------------------------------- ### Compact Coverage-Review Pattern Source: https://github.com/allure-framework/allure3/blob/main/skills/allure-agent-mode-feature-delivery/SKILL.md This pattern demonstrates how to set up temporary directories for agent output and expectations, then run tests with a specified scope using `npx allure agent`. ```bash TMP_DIR="$(mktemp -d)" EXPECTATIONS="$TMP_DIR/expectations.yaml" npx allure agent \ --output "$TMP_DIR/agent-output" \ --expectations "$EXPECTATIONS" \ -- npm test -- ``` -------------------------------- ### Allure Awesome Initialization Script Source: https://github.com/allure-framework/allure3/blob/main/packages/web-awesome/src/index.html This script sets up the base URL for the Allure report and configures global report options. It should be included in your HTML file. ```javascript (function () { const base = document.createElement("base"); base.href = new URL(".", window.location.href).href; document.head.prepend(base); })(); window.allureReportOptions = { reportName: "Allure Report", logo: "", theme: "auto", reportLanguage: "en", createdAt: 1739819870336, reportUuid: "51b36daf-614b-409c-b6a1-e8e401b2c144", groupBy: ["parentSuite", "suite", "subSuite"], layout: "split", allureVersion: "3.0.1-develop", sections: ["charts", "timeline"], ci: { type: "github", detected: true, jobUid: "1234567890", jobUrl: "#", jobName: "Sample job name", jobRunUid: "0987654321", jobRunUrl: "#", jobRunName: "Sample job run name", jobRunBranch: "master", pullRequestName: "Pull request #123", pullRequestUrl: "#", }, }; window.allure = window.allure || {}; window.allureReportDataReady = true; ``` -------------------------------- ### Allure Agent Mode Instructions Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-agent/README.md Provides a comprehensive set of instructions for using the `allure agent` command for test execution, reruns, and state management. Use this for smoke checks and when preserving console logs is important. ```markdown ## Allure Agent Mode Instructions - If a command executes tests and its result will be used for smoke checking, reasoning, review, coverage analysis, debugging, or any user-facing conclusion, run it through `allure agent`. It preserves the original console logs and adds agent-mode artifacts without inheriting the normal report or export plugins from the project config. - Use `allure agent` for smoke checks too, even when the change is small or mechanical. - Only skip agent mode when it is impossible or when you are debugging agent mode itself. - After each agent-mode test run, print the `index.md` path from that run's output directory so users can open the run overview quickly. - Use `allure agent latest` to reopen the newest run when `--output` was omitted. - Use `allure agent state-dir` to inspect where the current project stores its latest-agent state. - Use `allure agent select --latest` or `allure agent select --from ` to inspect the review-targeted test plan before rerunning. - Use `allure agent --rerun-latest -- ` or `allure agent --rerun-from -- ` to rerun only the selected tests. - Use `--rerun-preset review|failed|unsuccessful|all`, repeated `--rerun-environment `, and repeated `--rerun-label name=value` when you need a narrower rerun selection from the previous output. - Use `ALLURE_AGENT_STATE_DIR` when you need to override where the current project stores latest-agent state for `latest`, `state-dir`, or `--rerun-latest`. - Use `ALLURE_AGENT_*` with `allure run` only as the lower-level fallback when you need direct environment control. - Generate or refresh `ALLURE_AGENT_EXPECTATIONS` before each targeted rerun. - Run tests with `ALLURE_AGENT_OUTPUT` and review `manifest/run.json`, `manifest/test-events.jsonl`, `index.md`, `manifest/tests.jsonl`, and `manifest/findings.jsonl`. - Enrich only the intended tests. Add real steps for real setup, actions, and assertions. - Attach only real runtime evidence such as payloads, responses, screenshots, DOM snapshots, diffs, logs, or traces. - Keep metadata minimal. Add labels or severity only when scope review, debugging, or quality policy uses them. - Instrument stable helpers when several call sites need the same evidence. For example, teach `runCommand` to emit a step instead of wrapping every caller. - Reject the rerun if scope drifts, evidence stays weak, or high-confidence noop-style findings remain. ``` -------------------------------- ### Open Generated Report Source: https://github.com/allure-framework/allure3/blob/main/packages/cli/README.md Use the 'open' command to serve a previously generated report locally. If the report directory is omitted, it defaults to the configured output directory or 'allure-report'. ```bash npx allure open ``` -------------------------------- ### Creating an Order with Attachments and Steps Source: https://github.com/allure-framework/allure3/blob/main/docs/agent_enrichment_loop.md This snippet shows how to use `label`, `step`, and `attachment` to enrich a test case. It demonstrates preparing a payload, submitting an order, and asserting the response, with JSON attachments for request and response payloads. ```typescript import { attachment, label, step } from "allure-js-commons"; import { expect, it } from "vitest"; it("creates an order", async () => { await label("feature", "orders"); await label("severity", "critical"); const request = await step("prepare order payload", async () => { const payload = { sku: "book-123", quantity: 1 }; await attachment("request.json", JSON.stringify(payload, null, 2), "application/json"); return payload; }); const response = await step("submit order", async () => { const result = await createOrder(request); await attachment("response.json", JSON.stringify(result, null, 2), "application/json"); return result; }); await step("assert order was created", () => { expect(response.status).toBe(201); expect(response.body.id).toBeDefined(); }); }); ``` -------------------------------- ### Select Test Plan from Latest Agent Run Source: https://github.com/allure-framework/allure3/blob/main/docs/allure-agent-mode.md Prints the review-targeted test plan from a prior agent run. Add filters like `--preset failed` or exact `--label name=value` / `--environment ` when you need a narrower rerun plan. ```bash allure agent select --latest ``` ```bash allure agent select --from ``` -------------------------------- ### Configure Allure Plugin Awesome Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-awesome/README.md Add the 'awesome' plugin to your Allure configuration file. This example shows how to set a custom report name. ```typescript import { defineConfig } from "allure"; export default defineConfig({ name: "Allure Report", output: "./allure-report", historyPath: "./history.jsonl", plugins: { awesome: { options: { reportName: "HelloWorld", }, }, }, }); ``` -------------------------------- ### Clear Both Reports and Results with Multiple Issues Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-jira/README.md Examples of clearing both reports and test results from multiple Jira issues simultaneously. This is the most comprehensive cleanup option. ```shell npx allure jira clear --token dmR2dWto... --webhook https://95f453e... --issue JIRA-1 --results --reports npx allure jira clear --token dmR2dWto... --webhook https://95f453e... --issue JIRA-1 --issue JIRA-2 --results --reports ``` ```shell yarn allure jira clear --token dmR2dWto... --webhook https://95f453e... --issue JIRA-1 --results --reports yarn allure jira clear --token dmR2dWto... --webhook https://95f453e... --issue JIRA-1 --issue JIRA-2 --results --reports ``` ```shell pnpm allure jira clear --token dmR2dWto... --webhook https://95f453e... --issue JIRA-1 --results --reports pnpm allure jira clear --token dmR2dWto... --webhook https://95f453e... --issue JIRA-1 --issue JIRA-2 --results --reports ``` -------------------------------- ### Basic AQL Conditions Source: https://github.com/allure-framework/allure3/blob/main/packages/aql/README.md Demonstrates simple AQL conditions for checking equality, containment, and array membership. These are fundamental building blocks for AQL queries. ```typescript 'status = "passed"' ``` ```typescript 'status IN ["passed", "failed", "broken"]' ``` -------------------------------- ### Compare Run Against Expectations with Environment Variables Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-agent/README.md Compare a test run against an intended scope by providing an expectations file using environment variables. This ensures deterministic paths and uses an agent-only profile. ```shell ALLURE_AGENT_OUTPUT=./out/agent-report \ ALLURE_AGENT_EXPECTATIONS=./out/agent-expected.yaml \ npx allure run -- npm test ``` -------------------------------- ### Clear Test Results with Multiple Issues Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-jira/README.md Examples of clearing test results from multiple Jira issues. This command is useful for cleaning up specific test run data. ```shell npx allure jira clear --token dmR2dWto... --webhook https://95f453e... --issue JIRA-1 --results npx allure jira clear --token dmR2dWto... --webhook https://95f453e... --issue JIRA-1 --issue JIRA-2 --results ``` ```shell yarn allure jira clear --token dmR2dWto... --webhook https://95f453e... --issue JIRA-1 --results yarn allure jira clear --token dmR2dWto... --webhook https://95f453e... --issue JIRA-1 --issue JIRA-2 --results ``` ```shell pnpm allure jira clear --token dmR2dWto... --webhook https://95f453e... --issue JIRA-1 --results pnpm allure jira clear --token dmR2dWto... --webhook https://95f453e... --issue JIRA-1 --issue JIRA-2 --results ``` -------------------------------- ### Configure Allure with Classic Plugin Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-allure2/README.md Add the classic plugin to your Allure configuration file to enable report generation. This example shows how to set a custom report name. ```typescript import { defineConfig } from "allure"; export default defineConfig({ name: "Allure Report", output: "./allure-report", historyPath: "./history.jsonl", plugins: { classic: { options: { reportName: "HelloWorld", }, }, }, }); ``` -------------------------------- ### Initialize Allure and Set Base URL Source: https://github.com/allure-framework/allure3/blob/main/packages/web-summary/src/index.html Initializes the global `allure` object and sets the base URL for the report based on the current window location. This is crucial for correctly resolving relative paths within the report. ```javascript window.allure = window.allure || {}; const { origin, pathname } = window.location; const url = new URL(pathname, origin); const baseEl = document.createElement("base"); baseEl.href = url.toString(); window.document.head.appendChild(baseEl); ``` -------------------------------- ### Signal Report Data Ready Source: https://github.com/allure-framework/allure3/blob/main/packages/web-summary/src/index.html Sets a flag to indicate that the Allure report data is ready to be processed. This is typically used by the front-end to know when to start rendering the report. ```javascript window.allureReportDataReady = true; ``` -------------------------------- ### Enable Allure Agent Plugin via Environment Variables Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-agent/README.md Enable the Allure agent plugin using environment variables for direct control. This is an alternative to direct configuration. ```shell ALLURE_AGENT_OUTPUT=./out/agent-report npx allure run -- npm test ``` -------------------------------- ### Configure Allure CSV Plugin Source: https://github.com/allure-framework/allure3/blob/main/packages/plugin-csv/README.md Add the CSV plugin to your Allure configuration file. This example shows how to enable the plugin and set a custom file name for the generated CSV report. ```diff import { defineConfig } from "allure"; export default defineConfig({ name: "Allure Report", output: "./allure-report", historyPath: "./history.jsonl", plugins: { + csv: { + options: { + fileName: "my-report.csv", + }, + }, }, }); ``` -------------------------------- ### Get Latest Agent Output Directory Source: https://github.com/allure-framework/allure3/blob/main/docs/allure-agent-mode.md Prints the latest agent output directory for the current project. Use this when a prior run omitted `--output` and you need to reopen the most recent agent-mode artifacts. ```bash allure agent latest ``` -------------------------------- ### Author Custom Quality Gate Rule (Simple Count) Source: https://github.com/allure-framework/allure3/blob/main/docs/quality_gates.md Implement a custom quality gate rule by defining its `rule`, `message`, and `validate` functions. This example checks if the number of test results matches an expected value. ```ts import type { QualityGateRule } from "allure/rules"; export const myRule: QualityGateRule = { rule: "myRule", message: ({ expected, actual }) => `The custom rule has failed. Expected: ${expected} doesn't equal to ${actual}`, validate: async ({ trs, expected }) => { const actual = trs.length; const passed = actual === expected; return { success: actual === expected, actual, }; } } ``` -------------------------------- ### Open Report from Results Directory Source: https://github.com/allure-framework/allure3/blob/main/README.md Opens a directory containing Allure result files. The report will be generated on the fly and opened in the browser. ```bash npx allure open ./allure-results ``` -------------------------------- ### Configure Quality Gate Rules with Environment Variables Source: https://github.com/allure-framework/allure3/blob/main/docs/quality_gates.md This JavaScript snippet demonstrates how to import necessary modules, access environment variables, and define quality gate rules in the Allure Runtime configuration. It uses a fallback value if the environment variable is not set. ```javascript import { defineConfig } from "allure"; import { myRule } from "./myRule"; const { MY_RULE_VALUE } = process.env; export default defineConfig({ name: "Allure Report 3", qualityGate: { rules: [ { // use 100 as a fallback value when env variable is not set myRule: Number(MY_RULE_VALUE) || 100, }, ], use: [myRule], }, }); ```