-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from reportportal/develop
Release 5.0.3
- Loading branch information
Showing
13 changed files
with
1,881 additions
and
1,526 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5.0.2 | ||
5.0.3-SNAPSHOT |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
* Copyright 2022 EPAM Systems | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
import { Reporter } from '../reporter'; | ||
import { getClientConfig } from '../utils'; | ||
import { testId, testName } from './mocks/data'; | ||
import { options } from './mocks/optionsMock'; | ||
import { RPClientMock } from './mocks/RPClientMock'; | ||
|
||
describe('onBeforeCommand', () => { | ||
const reporter = new Reporter(options); | ||
reporter['client'] = new RPClientMock(getClientConfig(options)); | ||
reporter['storage'].addTest({ id: testId, name: testName }); | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('reportSeleniumLogs command. client.send should be called with corresponding params if command.body is not empty', () => { | ||
reporter['options'].reportSeleniumCommands = true; | ||
reporter['options'].seleniumCommandsLogLevel = 'debug'; | ||
|
||
const command = { | ||
method: 'POST', | ||
endpoint: '/session/:sessionId/url', | ||
body: { url: 'https://google.com' }, | ||
result: { value: 'complete' }, | ||
sessionId: 'd315f4dddf5199a74eac978476bad9d0', | ||
cid: '0-0', | ||
}; | ||
|
||
reporter.onBeforeCommand(command); | ||
|
||
const method = `${command.method} ${command.endpoint}`; | ||
const data = JSON.stringify(command.body); | ||
const { seleniumCommandsLogLevel } = reporter['options']; | ||
|
||
expect(reporter['client'].sendLog).toBeCalledWith( | ||
testId, | ||
{ | ||
level: seleniumCommandsLogLevel, | ||
message: `${method} ${data}`, | ||
}, | ||
undefined, | ||
); | ||
}); | ||
it('reportSeleniumLogs command. client.send should be called with corresponding params if command.body is empty', () => { | ||
reporter['options'].reportSeleniumCommands = true; | ||
reporter['options'].seleniumCommandsLogLevel = 'debug'; | ||
|
||
const command = { | ||
method: 'POST', | ||
endpoint: '/session/:sessionId/url', | ||
body: {}, | ||
result: { value: 'complete' }, | ||
sessionId: 'd315f4dddf5199a74eac978476bad9d0', | ||
cid: '0-0', | ||
}; | ||
|
||
reporter.onBeforeCommand(command); | ||
|
||
const method = `${command.method} ${command.endpoint}`; | ||
const { seleniumCommandsLogLevel } = reporter['options']; | ||
|
||
expect(reporter['client'].sendLog).toBeCalledWith( | ||
testId, | ||
{ | ||
level: seleniumCommandsLogLevel, | ||
message: `${method}`, | ||
}, | ||
undefined, | ||
); | ||
}); | ||
|
||
it('reportSeleniumLogs command. client.send should not be called', () => { | ||
reporter['options'].reportSeleniumCommands = false; | ||
reporter['options'].seleniumCommandsLogLevel = 'debug'; | ||
|
||
const command = { | ||
method: 'POST', | ||
endpoint: '/session/:sessionId/url', | ||
body: {}, | ||
result: { value: 'complete' }, | ||
sessionId: 'd315f4dddf5199a74eac978476bad9d0', | ||
cid: '0-0', | ||
}; | ||
|
||
reporter.onBeforeCommand(command); | ||
|
||
expect(reporter['client'].sendLog).not.toBeCalled(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ import { | |
getCodeRef, | ||
getStartLaunchObj, | ||
getSystemAttributes, | ||
limit, | ||
parseTags, | ||
promiseErrorHandler, | ||
} from '../utils'; | ||
|
@@ -65,7 +66,6 @@ describe('utils', () => { | |
restClientConfig: { | ||
agent: { keepAlive: true }, | ||
}, | ||
cucumberNestedSteps: true, | ||
}; | ||
const extendedOptions = { | ||
...options, | ||
|
@@ -174,4 +174,66 @@ describe('utils', () => { | |
expect(parseTags([''])).toEqual([]); | ||
}); | ||
}); | ||
describe('limit', () => { | ||
const baseUser = { | ||
name: 'UserName', | ||
surname: 'UserSurname', | ||
fullName: 'UserName UserSurname', | ||
age: 21, | ||
id: 2, | ||
tel: '12345', | ||
eMail: '[email protected]', | ||
address: 'Some address', | ||
password: '*****', | ||
role: 'Some role', | ||
}; | ||
|
||
const baseValues = new Array(10).fill('some value'); | ||
|
||
it('should not changed value if argument is null', () => { | ||
expect(limit(null)).toBeNull(); | ||
}); | ||
|
||
it('should not changed value if argument is undefined', () => { | ||
expect(limit(undefined)).toBeUndefined(); | ||
}); | ||
|
||
it('should not changed value if argument is 0', () => { | ||
expect(limit(0)).toBe(0); | ||
}); | ||
|
||
it('should not changed value if argument is ""', () => { | ||
expect(limit('')).toBe(''); | ||
}); | ||
|
||
it('should works correctly if string`s length less than 1000', () => { | ||
expect(limit('Value witch length less then 1000')).toBe('Value witch length less then 1000'); | ||
}); | ||
|
||
it('should works correctly with object that has 10 or less properties', () => { | ||
expect(limit(baseUser)).toEqual(baseUser); | ||
}); | ||
|
||
it('should works correctly with object that has more than 10', () => { | ||
const user = { | ||
...baseUser, | ||
hobbies: 'Some hobbies', | ||
}; | ||
|
||
const expectedObject = { ...baseUser, _: `1 more keys: [\"hobbies\"]` }; | ||
|
||
expect(limit(user)).toEqual(expectedObject); | ||
}); | ||
|
||
it('should works correctly with arrays witch length 10 or less', () => { | ||
expect(limit(baseValues)).toEqual(baseValues); | ||
}); | ||
|
||
it('should works correctly with arrays witch length more than 10', () => { | ||
const valuesArray = [...baseValues, 'some value']; | ||
const expectedArray = [...baseValues, '(1 more items)']; | ||
|
||
expect(limit(valuesArray)).toEqual(expectedArray); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ export { | |
Attribute, | ||
BaseObj, | ||
Config, | ||
ClientConfig, | ||
FinishTestItem, | ||
LaunchFinishObj, | ||
LaunchObj, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.