@mablhq/mabl-cli 2.6.7 → 2.8.18

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.
@@ -21,6 +21,9 @@ class CreateVariableStep extends MablStep_1.MablStep {
21
21
  }
22
22
  calculateGenerationType() {
23
23
  if (this.actions.length === 2 && this.actions[0] instanceof FindAction_1.FindAction) {
24
+ if (this.actions[0].findDescriptor.findType === domUtil_1.FindType.FIND_COOKIE) {
25
+ return CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE;
26
+ }
24
27
  if (this.actions[1] instanceof ExtractAction_1.ExtractAction) {
25
28
  return CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE;
26
29
  }
@@ -45,6 +48,21 @@ class CreateVariableStep extends MablStep_1.MablStep {
45
48
  toStepDescriptor() {
46
49
  let step;
47
50
  switch (this.generationType) {
51
+ case CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE:
52
+ const cookieFindAction = this.actions[0];
53
+ const cookieFind = cookieFindAction.toDescriptor();
54
+ step = {
55
+ name: this.variableName,
56
+ generator: {
57
+ type: CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE,
58
+ cookieSelector: cookieFind.findTarget,
59
+ attribute: this.actions[1].extractionAttribute,
60
+ },
61
+ find: cookieFind,
62
+ descriptorToActionMap: new Map().set(cookieFind, cookieFindAction),
63
+ actionCode: this.actionCode,
64
+ };
65
+ break;
48
66
  case CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE:
49
67
  const findAction = this.actions[0];
50
68
  const find = findAction.toDescriptor();
@@ -186,6 +204,11 @@ class CreateVariableStep extends MablStep_1.MablStep {
186
204
  generator.pattern,
187
205
  ]));
188
206
  break;
207
+ case CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE:
208
+ actions.push(new FindAction_1.FindAction('find_cookie', [generator.cookieSelector]));
209
+ const extractCookieArgs = [generator.attribute];
210
+ actions.push(new ExtractAction_1.ExtractAction('extract_attribute', extractCookieArgs));
211
+ break;
189
212
  }
190
213
  const step = new CreateVariableStep('as', [variableName], actions);
191
214
  step.setStepId(stepArgs.id);
@@ -4,6 +4,7 @@ exports.VariableGenerator = void 0;
4
4
  var VariableGenerator;
5
5
  (function (VariableGenerator) {
6
6
  VariableGenerator["ATTRIBUTE"] = "ATTRIBUTE";
7
+ VariableGenerator["COOKIE_ATTRIBUTE"] = "COOKIE_ATTRIBUTE";
7
8
  VariableGenerator["ELEMENT_COUNT"] = "ELEMENT_COUNT";
8
9
  VariableGenerator["EMAIL"] = "EMAIL";
9
10
  VariableGenerator["JAVASCRIPT"] = "JAVASCRIPT";