Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions qase-playwright/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# playwright-qase-reporter@2.5.6

## Fixed

- `qase.step` now types `expectedResult` and `data` as optional (`?`) instead of positionally required `string | undefined`. Previously the documented calls `qase.step('action')` and `qase.step('action', 'expected')` failed to compile with `ts(2554): Expected 3 arguments`, forcing callers to pass `undefined` explicitly to omit them. This is a type-only change — runtime behavior is unchanged and fully backward compatible. The docstring now also clarifies that `qase.step` is a title decorator meant to be passed to Playwright's `test.step()`, not a step runner. Fixes #981.

# playwright-qase-reporter@2.5.5

## Fixed
Expand Down
2 changes: 1 addition & 1 deletion qase-playwright/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "playwright-qase-reporter",
"version": "2.5.5",
"version": "2.5.6",
"description": "Qase TMS Playwright Reporter",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
17 changes: 12 additions & 5 deletions qase-playwright/src/playwright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,18 +317,25 @@ qase.tags = function(...values: string[]) {
};

/**
* Set a expected result and data for the test step
* @param action
* @param expectedResult
* @param data
* Build a step title with optional expected result and data markers.
*
* This is a title decorator, not a step runner: it returns a string meant to be
* passed to Playwright's `test.step()`. `expectedResult` and `data` are optional.
*
* @param action — step title
* @param expectedResult — optional expected result
* @param data — optional step data
* @example
* test('test', async ({ page }) => {
* await test.step(qase.step('action'), async () => {
* await page.goto('https://example.com');
* });
* await test.step(qase.step('action', 'expected result', 'data'), async () => {
* await page.goto('https://example.com');
* });
* });
*/
qase.step = function(action: string, expectedResult: string | undefined, data: string | undefined): string {
qase.step = function(action: string, expectedResult?: string, data?: string): string {
return `${action} QaseExpRes:${expectedResult ? `: ${expectedResult}` : ''} QaseData:${data ? `: ${data}` : ''}`;
};

Expand Down
10 changes: 10 additions & 0 deletions qase-playwright/test/playwright.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ describe('qase API', () => {
const result = qase.step('Click button', 'Button should be clicked', 'Button data');
expect(result).toBe('Click button QaseExpRes:: Button should be clicked QaseData:: Button data');
});

it('should accept a single action argument (optional params omitted)', () => {
const result = qase.step('Click button');
expect(result).toBe('Click button QaseExpRes: QaseData:');
});

it('should accept action and expected result without data', () => {
const result = qase.step('Click button', 'Button should be clicked');
expect(result).toBe('Click button QaseExpRes:: Button should be clicked QaseData:');
});
});

describe('qase with non-positive ID (regression test)', () => {
Expand Down
Loading