@zohodesk/testinglibrary 3.2.4 → 3.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ var _testinglibrary = require("@zohodesk/testinglibrary");
4
+ async function executeRpcRequest(page, payload) {
5
+ const url = new URL(page.url());
6
+ const baseUrl = `${url.protocol}//${url.host}`;
7
+ const invokeURL = `${baseUrl}/api/testing/acceptanceTest/rpc/invoke`;
8
+ try {
9
+ const response = await page.request.post(invokeURL, {
10
+ headers: {
11
+ 'Content-Type': 'application/json'
12
+ },
13
+ data: payload
14
+ });
15
+ if (!response.ok()) {
16
+ throw new Error(`HTTP ${response.status()}: ${response.statusText()}`);
17
+ }
18
+ const responseData = await response.json();
19
+ (0, _testinglibrary.expect)(responseData.data).toHaveProperty('status', 'success');
20
+ } catch (error) {
21
+ throw error;
22
+ }
23
+ }
24
+ async function entityIdReConstructor(payload) {
25
+ if (typeof payload !== 'object' || payload === null) {
26
+ throw new Error('Invalid payload. It must be a non-null object.');
27
+ }
28
+ if (!payload.arguments || typeof payload.arguments.entityId !== 'string') {
29
+ throw new Error('Invalid payload.arguments.entityId. It must be a non-empty string.');
30
+ }
31
+ payload.arguments.entityId = payload.arguments.entityId.split(',').map(id => id.trim());
32
+ return payload;
33
+ }
34
+ module.exports = {
35
+ executeRpcRequest,
36
+ entityIdReConstructor
37
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ var _testinglibrary = require("@zohodesk/testinglibrary");
4
+ var _rpcRequestHelper = require("../helpers/rpcRequestHelper");
5
+ const {
6
+ Given
7
+ } = (0, _testinglibrary.createBdd)();
8
+ Given('a search entity', async ({
9
+ page
10
+ }, dataTable) => {
11
+ const data = dataTable.hashes();
12
+ for (const row of data) {
13
+ const {
14
+ moduleName,
15
+ entityId,
16
+ searchString
17
+ } = row;
18
+ const payload = {
19
+ className: 'applicationDriver.rpc.desk.integrations.search.SearchFakeDataPopulator',
20
+ methodName: 'populateSearchData',
21
+ arguments: {
22
+ module: moduleName,
23
+ searchString: searchString,
24
+ entityId: entityId
25
+ }
26
+ };
27
+ await (0, _rpcRequestHelper.entityIdReConstructor)(payload);
28
+ await (0, _rpcRequestHelper.executeRpcRequest)(page, payload);
29
+ }
30
+ });
@@ -85,7 +85,8 @@ function getPlaywrightConfig() {
85
85
  use: {
86
86
  ...commonConfig
87
87
  },
88
- dependencies: dependencies
88
+ dependencies: dependencies,
89
+ retries: 0
89
90
  }];
90
91
  }
91
92
  const playwrightConfig = {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "3.2.4",
3
+ "version": "3.2.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@zohodesk/testinglibrary",
9
- "version": "3.2.4",
9
+ "version": "3.2.5",
10
10
  "hasInstallScript": true,
11
11
  "license": "ISC",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "3.2.4",
3
+ "version": "3.2.5",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -0,0 +1,4 @@
1
+ {
2
+ "status": "passed",
3
+ "failedTests": []
4
+ }