Skip to content

Commit

Permalink
release: qase-playwright 2.0.2
Browse files Browse the repository at this point in the history
Added new annotation for test case ignoring `qase.ignore()`.
This annotation will mark the test as ignored in the Qase.io test run.
  • Loading branch information
gibiw committed Jun 6, 2024
1 parent 93650f1 commit a24fb36
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 2 deletions.
5 changes: 5 additions & 0 deletions qase-playwright/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ describe('Test suite', () => {
test(qase(2, 'This syntax is still supported'), () => {
expect(true).toBe(true);
});

test('Running, but not reported to Qase', () => {
qase.ignore();
expect(true).toBe(true);
});
});
```

Expand Down
14 changes: 14 additions & 0 deletions qase-playwright/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# [email protected]

## What's new

Added new annotation `qase.ignore()`.
Tests marked with it will run as usual but won't appear in the Qase report.

```js
test('test', async ({ page }) => {
qase.ignore();
await page.goto('https://example.com');
});
```

# [email protected]

## What's new
Expand Down
4 changes: 2 additions & 2 deletions qase-playwright/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "playwright-qase-reporter",
"version": "2.0.1",
"version": "2.0.2",
"description": "Qase TMS Playwright Reporter",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -44,7 +44,7 @@
"license": "Apache-2.0",
"dependencies": {
"chalk": "^4.1.2",
"qase-javascript-commons": "^2.0.0",
"qase-javascript-commons": "^2.0.8",
"uuid": "^9.0.0"
},
"peerDependencies": {
Expand Down
16 changes: 16 additions & 0 deletions qase-playwright/src/playwright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface MetadataMessage {
title?: string;
fields?: Record<string, string>;
parameters?: Record<string, string>;
ignore?: boolean;
}

/**
Expand Down Expand Up @@ -166,6 +167,21 @@ qase.attach = function(attach: {
return this;
};

/**
* Ignore the test case result in Qase
* @example
* test('test', async ({ page }) => {
* qase.ignore();
* await page.goto('https://example.com');
* });
*/
qase.ignore = function() {
addMetadata({
ignore: true,
});
return this;
};

const addMetadata = (metadata: MetadataMessage): void => {
test.info().attach('qase-metadata.json', {
contentType: ReporterContentType,
Expand Down
11 changes: 11 additions & 0 deletions qase-playwright/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ interface TestCaseMetadata {
fields: Record<string, string>;
parameters: Record<string, string>;
attachments: Attachment[];
ignore: boolean;
}

export type PlaywrightQaseOptionsType = ConfigType;
Expand Down Expand Up @@ -96,6 +97,7 @@ export class PlaywrightQaseReporter implements Reporter {
fields: {},
parameters: {},
attachments: [],
ignore: false,
};
const attachments: Attachment[] = [];

Expand Down Expand Up @@ -125,6 +127,10 @@ export class PlaywrightQaseReporter implements Reporter {
metadata.parameters = message.parameters;
}

if (message.ignore) {
metadata.ignore = message.ignore;
}

continue;
}

Expand Down Expand Up @@ -295,6 +301,11 @@ export class PlaywrightQaseReporter implements Reporter {
*/
public async onTestEnd(test: TestCase, result: TestResult) {
const testCaseMetadata = this.transformAttachments(result.attachments);

if (testCaseMetadata.ignore) {
return;
}

const error = result.error ? PlaywrightQaseReporter.transformError(result.error) : null;
const suites = PlaywrightQaseReporter.transformSuiteTitle(test);
const testResult: TestResultType = {
Expand Down

0 comments on commit a24fb36

Please sign in to comment.