suitest-js-api 3.2.3 → 3.4.0

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.
package/index.d.ts CHANGED
@@ -271,6 +271,8 @@ declare namespace suitest {
271
271
  suitestify: boolean;
272
272
  domainList: string[];
273
273
  variables: Record<string, string>;
274
+ platform: string;
275
+ isHtmlBased: boolean;
274
276
  }
275
277
 
276
278
  interface ConfigureOptions {
@@ -9,6 +9,7 @@ const {
9
9
  cloneComposer,
10
10
  gettersComposer,
11
11
  makeToJSONComposer,
12
+ deepLinkComposer,
12
13
  } = require('../composers');
13
14
  const {
14
15
  invalidInputMessage,
@@ -16,7 +17,7 @@ const {
16
17
  const {validate, validators} = require('../validation');
17
18
  const {getRequestType} = require('../utils/socketChainHelper');
18
19
 
19
- const openAppChainFactary = (classInstance) => {
20
+ const openAppChainFactory = (classInstance) => {
20
21
  const toJSON = data => {
21
22
  const socketMessage = {
22
23
  type: getRequestType(data, false),
@@ -33,6 +34,10 @@ const openAppChainFactary = (classInstance) => {
33
34
  socketMessage.request.launchMode = data.launchMode;
34
35
  }
35
36
 
37
+ if (data.deepLink) {
38
+ socketMessage.request.deepLink = data.deepLink;
39
+ }
40
+
36
41
  return socketMessage;
37
42
  };
38
43
 
@@ -67,6 +72,10 @@ const openAppChainFactary = (classInstance) => {
67
72
  output.push(launchModeComposer);
68
73
  }
69
74
 
75
+ if (!data.deepLink) {
76
+ output.push(deepLinkComposer);
77
+ }
78
+
70
79
  return output;
71
80
  };
72
81
 
@@ -88,4 +97,4 @@ const openAppChainFactary = (classInstance) => {
88
97
  };
89
98
  };
90
99
 
91
- module.exports = openAppChainFactary;
100
+ module.exports = openAppChainFactory;
@@ -0,0 +1,26 @@
1
+ const {makeModifierComposer} = require('../utils/makeComposer');
2
+ const composers = require('../constants/composer');
3
+ const {validate, validators} = require('../validation');
4
+ const {invalidInputMessage} = require('../texts');
5
+
6
+ const METHOD_NAME = 'deepLink';
7
+
8
+ /**
9
+ * Defines launchMode method
10
+ */
11
+ const deepLinkComposer = makeModifierComposer(
12
+ composers.DEEP_LINK,
13
+ [METHOD_NAME],
14
+ (_, meta, value) => {
15
+ return {
16
+ ...meta,
17
+ deepLink: validate(
18
+ validators.NON_EMPTY_STRING,
19
+ value,
20
+ invalidInputMessage(METHOD_NAME, 'wrong argument'),
21
+ ),
22
+ };
23
+ },
24
+ );
25
+
26
+ module.exports = deepLinkComposer;
@@ -44,6 +44,7 @@ const swipeComposer = require('./swipeComposer');
44
44
  const handleComposer = require('./handleComposer');
45
45
  const attributesComposer = require('./attributesComposer');
46
46
  const cssPropsComposer = require('./cssPropsComposer');
47
+ const deepLinkComposer = require('./deepLinkComposer');
47
48
 
48
49
  module.exports = {
49
50
  abandonComposer,
@@ -94,4 +95,5 @@ module.exports = {
94
95
  handleComposer,
95
96
  attributesComposer,
96
97
  cssPropsComposer,
98
+ deepLinkComposer,
97
99
  };
@@ -44,6 +44,7 @@ const composers = {
44
44
  GET_HANDLE: Symbol('handle'),
45
45
  ATTRIBUTES: Symbol('getAttributes'),
46
46
  CSS_PROPS: Symbol('getCssProp'),
47
+ DEEP_LINK: Symbol('deepLink'),
47
48
  };
48
49
 
49
50
  Object.freeze(composers);
@@ -219,10 +219,17 @@ const applyNegation = (comparator, data) => {
219
219
  */
220
220
  const applyUntilCondition = (socketMessage, data) => {
221
221
  if (data.until) {
222
- return {
222
+ const newSocketMessage = {
223
223
  ...socketMessage,
224
224
  condition: data.until,
225
225
  };
226
+
227
+ // need negateCondition is mandatory for snippet command
228
+ if (data.type === 'runSnippet') {
229
+ newSocketMessage.negateCondition = false;
230
+ }
231
+
232
+ return newSocketMessage;
226
233
  }
227
234
 
228
235
  return socketMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suitest-js-api",
3
- "version": "3.2.3",
3
+ "version": "3.4.0",
4
4
  "main": "index.js",
5
5
  "repository": "git@github.com:SuitestAutomation/suitest-js-api.git",
6
6
  "author": "Suitest <hello@suite.st>",
@@ -85,7 +85,7 @@
85
85
  },
86
86
  "dependencies": {
87
87
  "@suitest/smst-to-text": "^4.4.3",
88
- "@suitest/translate": "^4.4.4",
88
+ "@suitest/translate": "^4.5.0",
89
89
  "@types/node": "^14.0.10",
90
90
  "ajv": "^6.12.2",
91
91
  "ansi-regex": "^5.0.0",
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  AbstractChain,
3
3
  BaseChain,
4
- LaunchModeModifier
4
+ LaunchModeModifier,
5
+ DeepLinkModifier,
5
6
  } from './modifiers';
6
7
 
7
8
  export interface OpenAppChain extends
8
9
  BaseChain<OpenAppChain, OpenAppEvalResult, OpenAppAbandonedChain>,
9
- LaunchModeModifier<OpenAppChain>
10
+ LaunchModeModifier<OpenAppChain>,
11
+ DeepLinkModifier<OpenAppChain>
10
12
  {}
11
13
 
12
14
  interface OpenAppAbandonedChain extends AbstractChain {}
@@ -44,6 +44,10 @@ export interface LaunchModeModifier<T> {
44
44
  launchMode(mode: LaunchModeValues): T;
45
45
  }
46
46
 
47
+ export interface DeepLinkModifier<T> {
48
+ deepLink(value: string): T;
49
+ }
50
+
47
51
  export interface Abandable<T> {
48
52
  abandon(): T;
49
53
  }