Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-84613 Playwright tags are parsed to the RP's attributes and attached to the tests #133

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
095e5ec
refactor: EPMRPP-84613 Playwright tags are parsed to the RP's attribu…
abdelrhman-arnos Jan 22, 2024
c85fe55
feat: unit-testing for tags
abdelrhman-arnos Feb 2, 2024
54a75a8
feat: extract tags from title
abdelrhman-arnos Feb 2, 2024
dc62061
refactor: use grep & grepInvert from pw config
abdelrhman-arnos Feb 6, 2024
5cb66de
refactor: update the tag tests
abdelrhman-arnos Feb 7, 2024
b595507
feat: consider @key:value title attributes
abdelrhman-arnos Mar 4, 2024
5756fa6
style: format reporter.ts
abdelrhman-arnos Mar 4, 2024
51e7139
test: fix client.startTestItem should be called with retry=true params
abdelrhman-arnos Mar 4, 2024
1abdab5
test: update tags tests in startSuiteTestReporting.spec.ts
abdelrhman-arnos Mar 4, 2024
b681254
test: update tags tests in startSuiteTestReporting.spec.ts
abdelrhman-arnos Mar 4, 2024
37771b9
test: fix the tests of the tags
abdelrhman-arnos Mar 5, 2024
9710249
Update retriesReporting.spec.ts
abdelrhman-arnos Mar 6, 2024
6dbea24
Update src/__tests__/reporter/startSuiteTestReporting.spec.ts
abdelrhman-arnos Mar 6, 2024
cf46677
Update src/__tests__/reporter/startSuiteTestReporting.spec.ts
abdelrhman-arnos Mar 6, 2024
0520150
doc: tag for test title in add attributes
abdelrhman-arnos Mar 6, 2024
41ad667
Update README.md
abdelrhman-arnos Mar 6, 2024
ee5559b
Update README.md
abdelrhman-arnos Mar 6, 2024
94fb633
Update README.md
abdelrhman-arnos Mar 6, 2024
f6955ca
doc: grep options under Reporting section in README
abdelrhman-arnos Mar 6, 2024
e672879
doc: update advanced Test Filtering with grep Options in README
abdelrhman-arnos Mar 7, 2024
c158a3a
doc: rm markdown in README
abdelrhman-arnos Mar 7, 2024
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [5.1.7] - 2024-01-22
abdelrhman-arnos marked this conversation as resolved.
Show resolved Hide resolved
### Changed
abdelrhman-arnos marked this conversation as resolved.
Show resolved Hide resolved
- The Playwright's tags are parsed to the RP's attributes and attached to the tests.

## [5.1.6] - 2023-12-19
### Fixed
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/reporter/attributesReporting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('attributes reporting', () => {
titlePath: () => ['', suiteName, 'testTitle'],
};

test('reporter.testItems should be updated with attributes', () => {
test('@smoke reporter.testItems should be updated with attributes', () => {
abdelrhman-arnos marked this conversation as resolved.
Show resolved Hide resolved
reporter.testItems = new Map([['testItemId', { id: 'tempTestItemId', name: 'testTitle' }]]);
// @ts-ignore
reporter.addAttributes(attributes, testCase);
Expand All @@ -47,7 +47,7 @@ describe('attributes reporting', () => {
expect(reporter.testItems).toEqual(expectedTestItems);
});

test('reporter.suitesInfo should be with attributes', () => {
test('@smoke reporter.suitesInfo should be with attributes', () => {
// @ts-ignore
reporter.addAttributes(attributes, testCase, suiteName);
const expectedSuitesInfo = new Map([
Expand Down
22 changes: 11 additions & 11 deletions src/__tests__/reporter/launchesReporting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ describe('start launch', () => {

beforeAll(() => reporter.onBegin());

test('client.startLaunch should be called with corresponding params', () => {
test('@smoke client.startLaunch should be called with corresponding params', () => {
expect(reporter.client.startLaunch).toHaveBeenCalledTimes(1);
expect(reporter.client.startLaunch).toHaveBeenCalledWith(startLaunchObj);
});

test('reporter.launchId should be set', () => {
test('@smoke reporter.launchId should be set', () => {
expect(reporter.launchId).toEqual('tempLaunchId');
});
});
Expand All @@ -64,12 +64,12 @@ describe('start launch', () => {

beforeAll(() => reporter.onBegin());

test('client.startLaunch should be called with corresponding params', () => {
test('@smoke client.startLaunch should be called with corresponding params', () => {
expect(reporter.client.startLaunch).toHaveBeenCalledTimes(1);
expect(reporter.client.startLaunch).toHaveBeenCalledWith(startLaunchObj);
});

test('reporter.launchId should be set', () => {
test('@smoke reporter.launchId should be set', () => {
expect(reporter.launchId).toEqual('tempLaunchId');
});
});
Expand All @@ -92,12 +92,12 @@ describe('start launch', () => {

beforeAll(() => reporter.onBegin());

test('client.startLaunch should be called with corresponding params', () => {
test('@smoke client.startLaunch should be called with corresponding params', () => {
expect(reporter.client.startLaunch).toHaveBeenCalledTimes(1);
expect(reporter.client.startLaunch).toHaveBeenCalledWith(startLaunchObj);
});

test('reporter.launchId should be set', () => {
test('@smoke reporter.launchId should be set', () => {
expect(reporter.launchId).toEqual('tempLaunchId');
});
});
Expand Down Expand Up @@ -125,12 +125,12 @@ describe('start launch', () => {
delete process.env.RP_LAUNCH_ID;
});

test('client.startLaunch should be called with corresponding params', () => {
test('@smoke client.startLaunch should be called with corresponding params', () => {
expect(reporter.client.startLaunch).toHaveBeenCalledTimes(1);
expect(reporter.client.startLaunch).toHaveBeenCalledWith(startLaunchObj);
});

test('reporter.launchId should be set', () => {
test('@smoke reporter.launchId should be set', () => {
expect(reporter.launchId).toEqual('tempLaunchId');
});
});
Expand All @@ -144,7 +144,7 @@ describe('finish launch', () => {

beforeAll(() => reporter.onEnd());

test('launch should be finished', () => {
test('@smoke launch should be finished', () => {
expect(reporter.client.finishLaunch).toHaveBeenCalledTimes(1);
expect(reporter.client.finishLaunch).toHaveBeenCalledWith('tempLaunchId', {
endTime: mockedDate,
Expand All @@ -164,7 +164,7 @@ describe('finish launch', () => {

beforeAll(() => reporter.onEnd());

test('launch finish request should not be sent', () => {
test('@smoke launch finish request should not be sent', () => {
expect(reporter.client.finishLaunch).toHaveBeenCalledTimes(0);
expect(reporter.isLaunchFinishSend).toBe(true);
});
Expand All @@ -186,7 +186,7 @@ describe('finish launch', () => {
delete process.env.RP_LAUNCH_ID;
});

test('launch finish request should not be sent', () => {
test('@smoke launch finish request should not be sent', () => {
expect(reporter.client.finishLaunch).toHaveBeenCalledTimes(0);
expect(reporter.isLaunchFinishSend).toBe(true);
});
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/reporter/retriesReporting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('retries reporting', () => {

const spyStartTestItem = jest.spyOn(reporter.client, 'startTestItem');

test('client.startTestItem should be called with retry=true params', () => {
test('@smoke client.startTestItem should be called with retry=true params', () => {
const parentId = 'tempTestItemId';
const expectedTestObj: StartTestObjType = {
startTime: reporter.client.helpers.now(),
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/reporter/startSuiteTestReporting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('start reporting suite/test', () => {
jest.clearAllMocks();
});

test('client.startTestItem should be called with corresponding params to report suites and test item', () => {
test('@smoke client.startTestItem should be called with corresponding params to report suites and test item', () => {
const expectedSuites = new Map([
[
rootSuite,
Expand Down Expand Up @@ -149,7 +149,7 @@ describe('start reporting suite/test', () => {
expect(reporter.testItems).toEqual(expectedTestItems);
});

test('client.startTestItem should not be called in case of launch finish request have been send', () => {
test('@smoke client.startTestItem should not be called in case of launch finish request have been send', () => {
reporter.isLaunchFinishSend = true;
// @ts-ignore
reporter.onTestBegin(testCase);
Expand Down
5 changes: 4 additions & 1 deletion src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@
extendTestDescriptionWithLastError: true,
...config,
launchId: process.env.RP_LAUNCH_ID || config.launchId,
// TODO: consider the "grep" and "grep-invert" options

Check failure on line 98 in src/reporter.ts

View workflow job for this annotation

GitHub Actions / test

Delete `··⏎····`
abdelrhman-arnos marked this conversation as resolved.
Show resolved Hide resolved
};
this.suites = new Map();
this.suitesInfo = new Map();
Expand Down Expand Up @@ -375,8 +377,9 @@
!includePlaywrightProjectNameToCodeReference && playwrightProjectName,
);
const { id: parentId } = parentSuiteObj;
const name = test.title.replace(/^@\w+\s/, '');
const startTestItem: StartTestObjType = {
name: test.title,
name,

Check failure on line 382 in src/reporter.ts

View workflow job for this annotation

GitHub Actions / test

Delete `·`
startTime: this.client.helpers.now(),
type: TEST_ITEM_TYPES.STEP,
codeRef,
abdelrhman-arnos marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading