@twilio/flex-plugin-e2e-tests 6.3.3-beta.0 → 6.3.4-alpha.202404080558

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.
@@ -1,6 +1,3 @@
1
1
  import { TestSuite } from '../core';
2
- export declare const originalCode = "const [isOpen, setIsOpen] = useState(true);";
3
- export declare const codeWithViolation = "const config = {\n colorTheme: {\n baseLight: \"white\",\n },\n sdkOptions: {\n voice: {\n iceServers: [],\n },\n },\n };\n const [isOpen, setIsOpen] = useState(true);";
4
- export declare const WARNING_REGEX: RegExp;
5
2
  declare const testSuite: TestSuite;
6
3
  export default testSuite;
@@ -56,61 +56,67 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
56
56
  to[j] = from[i];
57
57
  return to;
58
58
  };
59
+ var __importDefault = (this && this.__importDefault) || function (mod) {
60
+ return (mod && mod.__esModule) ? mod : { "default": mod };
61
+ };
59
62
  Object.defineProperty(exports, "__esModule", { value: true });
60
- exports.WARNING_REGEX = exports.codeWithViolation = exports.originalCode = void 0;
61
63
  /* eslint-disable import/no-unused-modules */
62
64
  var replace_in_file_1 = require("replace-in-file");
63
- var flex_dev_utils_1 = require("@twilio/flex-dev-utils");
65
+ var semver_1 = __importDefault(require("semver"));
64
66
  var utils_1 = require("../utils");
65
- exports.originalCode = 'const [isOpen, setIsOpen] = useState(true);';
66
- exports.codeWithViolation = "const config = {\n colorTheme: {\n baseLight: \"white\",\n },\n sdkOptions: {\n voice: {\n iceServers: [],\n },\n },\n };\n const [isOpen, setIsOpen] = useState(true);";
67
- exports.WARNING_REGEX = /(Warning:)/;
68
- // Validate plugin
67
+ // Deploy plugin
69
68
  var testSuite = function (_a) {
70
69
  var scenario = _a.scenario, config = _a.config;
71
70
  return __awaiter(void 0, void 0, void 0, function () {
72
- var plugin, ext, result, noWarnings;
73
- var _b, _c;
74
- return __generator(this, function (_d) {
75
- switch (_d.label) {
71
+ var plugin, ext, resource, result, apiPlugin, pluginVersion, latest;
72
+ return __generator(this, function (_b) {
73
+ switch (_b.label) {
76
74
  case 0:
77
75
  plugin = scenario.plugins[0];
76
+ utils_1.assertion.not.isNull(plugin);
78
77
  ext = scenario.isTS ? 'tsx' : 'jsx';
78
+ plugin.newlineValue = "This is a dismissible demo component " + Date.now();
79
+ plugin.changelog = "e2e test " + Date.now();
79
80
  return [4 /*yield*/, replace_in_file_1.replaceInFile({
80
81
  files: utils_1.joinPath(plugin.dir, 'src', 'components', 'CustomTaskList', "CustomTaskList." + ext),
81
- from: exports.originalCode,
82
- to: exports.codeWithViolation,
82
+ from: /This is a dismissible demo component.*/,
83
+ to: plugin.newlineValue,
83
84
  })];
84
85
  case 1:
85
- _d.sent();
86
- flex_dev_utils_1.logger.info('Running {{twilio flex:plugins:validate}} on a plugin with validation issues');
87
- return [4 /*yield*/, utils_1.spawn('twilio', __spreadArray(['flex:plugins:validate', '-l', 'debug'], __read(config.regionFlag)), {
88
- cwd: plugin.dir,
89
- })];
86
+ _b.sent();
87
+ return [4 /*yield*/, utils_1.api.getLatestPluginVersion(plugin.name)];
90
88
  case 2:
91
- result = _d.sent();
92
- noWarnings = ((_b = result.stdout.match(exports.WARNING_REGEX)) === null || _b === void 0 ? void 0 : _b.length) || 0;
93
- utils_1.assertion.equal(noWarnings, 2);
94
- return [4 /*yield*/, replace_in_file_1.replaceInFile({
95
- files: utils_1.joinPath(plugin.dir, 'src', 'components', 'CustomTaskList', "CustomTaskList." + ext),
96
- from: exports.codeWithViolation,
97
- to: exports.originalCode,
98
- })];
99
- case 3:
100
- _d.sent();
101
- flex_dev_utils_1.logger.info('Running {{twilio flex:plugins:validate}} on a plugin with 0 validation issues');
102
- return [4 /*yield*/, utils_1.spawn('twilio', __spreadArray(['flex:plugins:validate', '-l', 'debug'], __read(config.regionFlag)), {
89
+ resource = _b.sent();
90
+ plugin.version = semver_1.default.inc((resource === null || resource === void 0 ? void 0 : resource.version) || '0.0.0', 'patch');
91
+ return [4 /*yield*/, utils_1.spawn('twilio', __spreadArray(['flex:plugins:deploy', '--changelog', "\"" + plugin.changelog + "\"", '--patch', '-l', 'debug'], __read(config.regionFlag)), {
103
92
  cwd: plugin.dir,
104
93
  })];
94
+ case 3:
95
+ result = _b.sent();
96
+ utils_1.assertion.fileExists([plugin.dir, 'build', plugin.name + ".js"]);
97
+ utils_1.assertion.fileContains([plugin.dir, 'build', plugin.name + ".js"], plugin.newlineValue);
98
+ utils_1.assertion.jsonFileContains([plugin.dir, 'package.json'], 'version', plugin.version);
99
+ utils_1.assertion.stringContains(result.stdout, 'Next Steps');
100
+ utils_1.assertion.stringContains(result.stdout, 'twilio flex:plugins:release');
101
+ utils_1.assertion.stringContains(result.stdout, plugin.name);
102
+ return [4 /*yield*/, utils_1.api.getPlugin(plugin.name)];
105
103
  case 4:
106
- result = _d.sent();
107
- noWarnings = ((_c = result.stdout.match(exports.WARNING_REGEX)) === null || _c === void 0 ? void 0 : _c.length) || 0;
108
- utils_1.assertion.equal(noWarnings, 0);
104
+ apiPlugin = _b.sent();
105
+ return [4 /*yield*/, utils_1.api.getPluginVersion(plugin.name, plugin.version)];
106
+ case 5:
107
+ pluginVersion = _b.sent();
108
+ return [4 /*yield*/, utils_1.api.getLatestPluginVersion(plugin.name)];
109
+ case 6:
110
+ latest = _b.sent();
111
+ utils_1.assertion.equal(apiPlugin.unique_name, plugin.name);
112
+ utils_1.assertion.equal(pluginVersion.version, plugin.version);
113
+ utils_1.assertion.equal(pluginVersion.changelog, plugin.changelog);
114
+ utils_1.assertion.equal(pluginVersion, latest);
109
115
  return [2 /*return*/];
110
116
  }
111
117
  });
112
118
  });
113
119
  };
114
- testSuite.description = 'Running {{twilio flex:plugins:validate}}';
120
+ testSuite.description = 'Running {{twilio flex:plugins:deploy}}';
115
121
  exports.default = testSuite;
116
122
  //# sourceMappingURL=step007.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"step007.js","sourceRoot":"","sources":["../../src/tests/step007.ts"],"names":[],"mappings":";;;;;;;;;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F,iBAAS,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;oBACtD,iBAAS,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;oBACvE,iBAAS,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;oBAEnC,qBAAM,WAAG,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAA;;oBAA5C,SAAS,GAAG,SAAgC;oBAC5B,qBAAM,WAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,EAAA;;oBAAvE,aAAa,GAAG,SAAuD;oBAC9D,qBAAM,WAAG,CAAC,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAA;;oBAAtD,MAAM,GAAG,SAA6C;oBAE5D,iBAAS,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;oBACpD,iBAAS,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;oBACvD,iBAAS,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;oBAC3D,iBAAS,CAAC,KAAK,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;;;;;CACxC,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,wCAAwC,CAAC;AAEjE,kBAAe,SAAS,CAAC"}
@@ -57,131 +57,47 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
57
57
  return to;
58
58
  };
59
59
  Object.defineProperty(exports, "__esModule", { value: true });
60
- /* eslint-disable import/no-unused-modules */
61
- var replace_in_file_1 = require("replace-in-file");
62
- var flex_dev_utils_1 = require("@twilio/flex-dev-utils");
60
+ /* eslint-disable import/no-unused-modules, @typescript-eslint/no-non-null-assertion */
63
61
  var utils_1 = require("../utils");
64
- var step007_1 = require("./step007");
65
- // Deploy plugin
62
+ // Release plugin
66
63
  var testSuite = function (_a) {
67
64
  var scenario = _a.scenario, config = _a.config;
68
65
  return __awaiter(void 0, void 0, void 0, function () {
69
- var plugin, ext, result, noWarnings, resource, apiPlugin, pluginVersion, latest;
70
- var _b, _c, _d;
71
- return __generator(this, function (_e) {
72
- switch (_e.label) {
66
+ var plugin, result, release, plugins;
67
+ return __generator(this, function (_b) {
68
+ switch (_b.label) {
73
69
  case 0:
74
70
  plugin = scenario.plugins[0];
75
71
  utils_1.assertion.not.isNull(plugin);
76
- ext = scenario.isTS ? 'tsx' : 'jsx';
77
- plugin.newlineValue = "This is a dismissible demo component " + Date.now();
78
- plugin.changelog = "e2e test " + Date.now();
79
- return [4 /*yield*/, replace_in_file_1.replaceInFile({
80
- files: utils_1.joinPath(plugin.dir, 'src', 'components', 'CustomTaskList', "CustomTaskList." + ext),
81
- from: /This is a dismissible demo component.*/,
82
- to: plugin.newlineValue,
83
- })];
84
- case 1:
85
- _e.sent();
86
- // Deploy with validation errors in the plugin with option fix
87
- return [4 /*yield*/, replace_in_file_1.replaceInFile({
88
- files: utils_1.joinPath(plugin.dir, 'src', 'components', 'CustomTaskList', "CustomTaskList." + ext),
89
- from: step007_1.originalCode,
90
- to: step007_1.codeWithViolation,
91
- })];
92
- case 2:
93
- // Deploy with validation errors in the plugin with option fix
94
- _e.sent();
95
- flex_dev_utils_1.logger.info('Running {{flex:plugins:deploy}} with --option {{fix}}');
96
72
  return [4 /*yield*/, utils_1.spawn('twilio', __spreadArray([
97
- 'flex:plugins:deploy',
98
- '--changelog',
99
- "\"" + plugin.changelog + "\"",
100
- '--patch',
101
- '--option',
102
- 'fix',
73
+ 'flex:plugins:release',
74
+ '--plugin',
75
+ plugin.name + "@" + plugin.version,
103
76
  '-l',
104
77
  'debug'
105
- ], __read(config.regionFlag)), {
106
- cwd: plugin.dir,
107
- })];
78
+ ], __read(config.regionFlag)))];
79
+ case 1:
80
+ result = _b.sent();
81
+ return [4 /*yield*/, utils_1.sleep(1000)];
82
+ case 2:
83
+ _b.sent();
84
+ return [4 /*yield*/, utils_1.api.getActiveRelease()];
108
85
  case 3:
109
- result = _e.sent();
110
- noWarnings = ((_b = result.stdout.match(step007_1.WARNING_REGEX)) === null || _b === void 0 ? void 0 : _b.length) || 0;
111
- // Should display violations
112
- utils_1.assertion.equal(noWarnings, 2);
113
- // Should not deploy the plugin
114
- utils_1.assertion.not.stringContains(result.stdout, 'Next Steps');
115
- utils_1.assertion.not.stringContains(result.stdout, 'twilio flex:plugins:release');
116
- // Deploy with validation errors in the plugin with option deploy
117
- flex_dev_utils_1.logger.info('Running {{flex:plugins:deploy}} with --option {{deploy}}');
118
- return [4 /*yield*/, utils_1.spawn('twilio', __spreadArray([
119
- 'flex:plugins:deploy',
120
- '--changelog',
121
- "\"" + plugin.changelog + "\"",
122
- '--patch',
123
- '--option',
124
- 'deploy',
125
- '-l',
126
- 'debug'
127
- ], __read(config.regionFlag)), {
128
- cwd: plugin.dir,
129
- })];
86
+ release = _b.sent();
87
+ return [4 /*yield*/, utils_1.api.getActivePlugins(release.configuration_sid)];
130
88
  case 4:
131
- result = _e.sent();
132
- noWarnings = ((_c = result.stdout.match(step007_1.WARNING_REGEX)) === null || _c === void 0 ? void 0 : _c.length) || 0;
133
- // Should display violations
134
- utils_1.assertion.equal(noWarnings, 2);
135
- // Should deploy the plugin
136
- utils_1.assertion.stringContains(result.stdout, 'Next Steps');
137
- utils_1.assertion.stringContains(result.stdout, 'twilio flex:plugins:release');
138
- // Deploy without validation errors in the plugin
139
- return [4 /*yield*/, replace_in_file_1.replaceInFile({
140
- files: utils_1.joinPath(plugin.dir, 'src', 'components', 'CustomTaskList', "CustomTaskList." + ext),
141
- from: step007_1.codeWithViolation,
142
- to: step007_1.originalCode,
143
- })];
144
- case 5:
145
- // Deploy without validation errors in the plugin
146
- _e.sent();
147
- flex_dev_utils_1.logger.info('Running {{flex:plugins:deploy}} on a plugin with 0 valdiation issues');
148
- return [4 /*yield*/, utils_1.spawn('twilio', __spreadArray(['flex:plugins:deploy', '--changelog', "\"" + plugin.changelog + "\"", '--patch', '-l', 'debug'], __read(config.regionFlag)), {
149
- cwd: plugin.dir,
150
- })];
151
- case 6:
152
- result = _e.sent();
153
- return [4 /*yield*/, utils_1.api.getLatestPluginVersion(plugin.name)];
154
- case 7:
155
- resource = _e.sent();
156
- plugin.version = (resource === null || resource === void 0 ? void 0 : resource.version) || '0.0.2'; // 0.0.2 is the default for first time plugin deployment in a Flex account
157
- noWarnings = ((_d = result.stdout.match(step007_1.WARNING_REGEX)) === null || _d === void 0 ? void 0 : _d.length) || 0;
158
- // Should display 0 violations
159
- utils_1.assertion.equal(noWarnings, 0);
160
- // Should deploy plugin
161
- utils_1.assertion.fileExists([plugin.dir, 'build', plugin.name + ".js"]);
162
- utils_1.assertion.fileContains([plugin.dir, 'build', plugin.name + ".js"], plugin.newlineValue);
163
- utils_1.assertion.jsonFileContains([plugin.dir, 'package.json'], 'version', plugin.version);
164
- utils_1.assertion.stringContains(result.stdout, 'Next Steps');
165
- utils_1.assertion.stringContains(result.stdout, 'twilio flex:plugins:release');
166
- utils_1.assertion.stringContains(result.stdout, plugin.name);
167
- return [4 /*yield*/, utils_1.api.getPlugin(plugin.name)];
168
- case 8:
169
- apiPlugin = _e.sent();
170
- return [4 /*yield*/, utils_1.api.getPluginVersion(plugin.name, plugin.version)];
171
- case 9:
172
- pluginVersion = _e.sent();
173
- return [4 /*yield*/, utils_1.api.getLatestPluginVersion(plugin.name)];
174
- case 10:
175
- latest = _e.sent();
176
- utils_1.assertion.equal(apiPlugin.unique_name, plugin.name);
177
- utils_1.assertion.equal(pluginVersion.version, plugin.version);
178
- utils_1.assertion.equal(pluginVersion.changelog, plugin.changelog);
179
- utils_1.assertion.equal(pluginVersion, latest);
89
+ plugins = _b.sent();
90
+ utils_1.assertion.stringContains(result.stdout, 'successful');
91
+ utils_1.assertion.stringContains(result.stdout, 'Configuration FJ');
92
+ utils_1.assertion.stringContains(result.stdout, 'enabled');
93
+ utils_1.assertion.equal(1, plugins.plugins.length);
94
+ utils_1.assertion.equal(plugins.plugins[0].unique_name, plugin.name);
95
+ utils_1.assertion.equal(plugins.plugins[0].version, plugin.version);
180
96
  return [2 /*return*/];
181
97
  }
182
98
  });
183
99
  });
184
100
  };
185
- testSuite.description = 'Running {{twilio flex:plugins:deploy}}';
101
+ testSuite.description = 'Running {{twilio flex:plugins:release}}';
186
102
  exports.default = testSuite;
187
103
  //# sourceMappingURL=step008.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"step008.js","sourceRoot":"","sources":["../../src/tests/step008.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA6C;AAC7C,mDAAgD;AAChD,yDAAgD;AAEhD,kCAA2D;AAE3D,qCAA2E;AAE3E,gBAAgB;AAChB,IAAM,SAAS,GAAc,UAAO,EAAgC;QAA9B,QAAQ,cAAA,EAAE,MAAM,YAAA;;;;;;;oBAC9C,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;oBACnC,iBAAS,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;oBAEvB,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;oBAC1C,MAAM,CAAC,YAAY,GAAG,0CAAwC,IAAI,CAAC,GAAG,EAAI,CAAC;oBAC3E,MAAM,CAAC,SAAS,GAAG,cAAY,IAAI,CAAC,GAAG,EAAI,CAAC;oBAE5C,qBAAM,+BAAa,CAAC;4BAClB,KAAK,EAAE,gBAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,oBAAkB,GAAK,CAAC;4BAC3F,IAAI,EAAE,wCAAwC;4BAC9C,EAAE,EAAE,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AC,EAAA;;oBAAhE,OAAO,GAAG,SAAsD;oBAEtE,iBAAS,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;oBACtD,iBAAS,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;oBAC5D,iBAAS,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;oBACnD,iBAAS,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;oBAC3C,iBAAS,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;oBAC7D,iBAAS,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;;;;;CAC7D,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,yCAAyC,CAAC;AAElE,kBAAe,SAAS,CAAC"}
@@ -35,69 +35,81 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
- var __read = (this && this.__read) || function (o, n) {
39
- var m = typeof Symbol === "function" && o[Symbol.iterator];
40
- if (!m) return o;
41
- var i = m.call(o), r, ar = [], e;
42
- try {
43
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
- }
45
- catch (error) { e = { error: error }; }
46
- finally {
47
- try {
48
- if (r && !r.done && (m = i["return"])) m.call(i);
49
- }
50
- finally { if (e) throw e.error; }
51
- }
52
- return ar;
53
- };
54
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
55
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
56
- to[j] = from[i];
57
- return to;
58
- };
59
38
  Object.defineProperty(exports, "__esModule", { value: true });
60
- /* eslint-disable import/no-unused-modules, @typescript-eslint/no-non-null-assertion */
61
39
  var utils_1 = require("../utils");
62
- // Release plugin
40
+ var PLUGIN_RELEASED_TIMEOUT = 30000;
41
+ var PLUGIN_RELEASED_POLL_INTERVAL = 5000;
42
+ // Plugin visible on the Hosted Flex
63
43
  var testSuite = function (_a) {
64
- var scenario = _a.scenario, config = _a.config;
44
+ var scenario = _a.scenario, config = _a.config, secrets = _a.secrets, environment = _a.environment;
65
45
  return __awaiter(void 0, void 0, void 0, function () {
66
- var plugin, result, release, plugins;
46
+ var plugin, release, plugins, releasedPlugin, accountSid, e_1;
67
47
  return __generator(this, function (_b) {
68
48
  switch (_b.label) {
69
49
  case 0:
70
50
  plugin = scenario.plugins[0];
71
51
  utils_1.assertion.not.isNull(plugin);
72
- return [4 /*yield*/, utils_1.spawn('twilio', __spreadArray([
73
- 'flex:plugins:release',
74
- '--plugin',
75
- plugin.name + "@" + plugin.version,
76
- '-l',
77
- 'debug'
78
- ], __read(config.regionFlag)))];
79
- case 1:
80
- result = _b.sent();
81
- return [4 /*yield*/, utils_1.sleep(1000)];
82
- case 2:
83
- _b.sent();
52
+ if (!plugin.newlineValue) {
53
+ throw new Error("scenario.plugin.newlineValue does not have a valid value");
54
+ }
84
55
  return [4 /*yield*/, utils_1.api.getActiveRelease()];
85
- case 3:
56
+ case 1:
86
57
  release = _b.sent();
58
+ if (!release) {
59
+ throw new Error('Account does not have an active release');
60
+ }
87
61
  return [4 /*yield*/, utils_1.api.getActivePlugins(release.configuration_sid)];
88
- case 4:
62
+ case 2:
89
63
  plugins = _b.sent();
90
- utils_1.assertion.stringContains(result.stdout, 'successful');
91
- utils_1.assertion.stringContains(result.stdout, 'Configuration FJ');
92
- utils_1.assertion.stringContains(result.stdout, 'enabled');
93
- utils_1.assertion.equal(1, plugins.plugins.length);
94
- utils_1.assertion.equal(plugins.plugins[0].unique_name, plugin.name);
95
- utils_1.assertion.equal(plugins.plugins[0].version, plugin.version);
96
- return [2 /*return*/];
64
+ releasedPlugin = plugins.plugins.find(function (plgin) { return plgin.unique_name === plugin.name; });
65
+ if (!releasedPlugin) {
66
+ throw new Error("Did not find plugin with name: " + plugin.name + " in released plugins");
67
+ }
68
+ return [4 /*yield*/, utils_1.Browser.create({ flex: config.hostedFlexBaseUrl, twilioConsole: config.consoleBaseUrl })];
69
+ case 3:
70
+ _b.sent();
71
+ _b.label = 4;
72
+ case 4:
73
+ _b.trys.push([4, 11, 13, 15]);
74
+ // Log into Flex
75
+ return [4 /*yield*/, utils_1.Browser.app.twilioConsole.login('admin', secrets.api.accountSid, config.localhostPort)];
76
+ case 5:
77
+ // Log into Flex
78
+ _b.sent();
79
+ return [4 /*yield*/, utils_1.assertion.app.view.adminDashboard.isVisible()];
80
+ case 6:
81
+ _b.sent();
82
+ return [4 /*yield*/, utils_1.Browser.app.getFlexAccountSid()];
83
+ case 7:
84
+ accountSid = _b.sent();
85
+ utils_1.assertion.equal(accountSid, secrets.api.accountSid);
86
+ // Make sure that /plugins contain the plugin
87
+ return [4 /*yield*/, utils_1.pluginHelper.waitForPluginToRelease(releasedPlugin, PLUGIN_RELEASED_TIMEOUT, PLUGIN_RELEASED_POLL_INTERVAL)];
88
+ case 8:
89
+ // Make sure that /plugins contain the plugin
90
+ _b.sent();
91
+ return [4 /*yield*/, utils_1.Browser.app.agentDesktop.open()];
92
+ case 9:
93
+ _b.sent();
94
+ return [4 /*yield*/, utils_1.assertion.app.view.plugins.plugin.isVisible(plugin.newlineValue)];
95
+ case 10:
96
+ _b.sent();
97
+ return [3 /*break*/, 15];
98
+ case 11:
99
+ e_1 = _b.sent();
100
+ return [4 /*yield*/, utils_1.Browser.app.takeScreenshot(environment.cwd)];
101
+ case 12:
102
+ _b.sent();
103
+ throw e_1;
104
+ case 13: return [4 /*yield*/, utils_1.Browser.kill()];
105
+ case 14:
106
+ _b.sent();
107
+ return [7 /*endfinally*/];
108
+ case 15: return [2 /*return*/];
97
109
  }
98
110
  });
99
111
  });
100
112
  };
101
- testSuite.description = 'Running {{twilio flex:plugins:release}}';
113
+ testSuite.description = 'Released Plugin visible on the Hosted Flex';
102
114
  exports.default = testSuite;
103
115
  //# sourceMappingURL=step009.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"step009.js","sourceRoot":"","sources":["../../src/tests/step009.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uFAAuF;AACvF,kCAAwD;AAGxD,iBAAiB;AACjB,IAAM,SAAS,GAAc,UAAO,EAAgC;QAA9B,QAAQ,cAAA,EAAE,MAAM,YAAA;;;;;;oBAC9C,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;oBACnC,iBAAS,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;oBAEd,qBAAM,aAAK,CAAC,QAAQ;4BACjC,sBAAsB;4BACtB,UAAU;4BACP,MAAM,CAAC,IAAI,SAAI,MAAM,CAAC,OAAS;4BAClC,IAAI;4BACJ,OAAO;kCACJ,MAAM,CAAC,UAAU,GACpB,EAAA;;oBAPI,MAAM,GAAG,SAOb;oBACF,qBAAM,aAAK,CAAC,IAAI,CAAC,EAAA;;oBAAjB,SAAiB,CAAC;oBAEF,qBAAM,WAAG,CAAC,gBAAgB,EAAE,EAAA;;oBAAtC,OAAO,GAAG,SAA4B;oBAC5B,qBAAM,WAAG,CAAC,gBAAgB,CAAC,OAAQ,CAAC,iBAAiB,CAAC,EAAA;;oBAAhE,OAAO,GAAG,SAAsD;oBAEtE,iBAAS,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;oBACtD,iBAAS,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;oBAC5D,iBAAS,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;oBACnD,iBAAS,CAAC,KA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C,YAAY,CAAC,EAAA;;oBAAtE,SAAsE,CAAC;;;;oBAEvE,qBAAM,eAAO,CAAC,GAAG,CAAC,cAAc,CAAC,WAAW,CAAC,GAAG,CAAC,EAAA;;oBAAjD,SAAiD,CAAC;oBAClD,MAAM,GAAC,CAAC;yBAER,qBAAM,eAAO,CAAC,IAAI,EAAE,EAAA;;oBAApB,SAAoB,CAAC;;;;;;CAExB,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,4CAA4C,CAAC;AAErE,kBAAe,SAAS,CAAC"}
@@ -35,66 +35,115 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
+ var __read = (this && this.__read) || function (o, n) {
39
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
40
+ if (!m) return o;
41
+ var i = m.call(o), r, ar = [], e;
42
+ try {
43
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
+ }
45
+ catch (error) { e = { error: error }; }
46
+ finally {
47
+ try {
48
+ if (r && !r.done && (m = i["return"])) m.call(i);
49
+ }
50
+ finally { if (e) throw e.error; }
51
+ }
52
+ return ar;
53
+ };
54
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
55
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
56
+ to[j] = from[i];
57
+ return to;
58
+ };
38
59
  Object.defineProperty(exports, "__esModule", { value: true });
60
+ /* eslint-disable import/no-unused-modules */
61
+ var replace_in_file_1 = require("replace-in-file");
62
+ var core_1 = require("../core");
39
63
  var utils_1 = require("../utils");
40
- var PLUGIN_RELEASED_TIMEOUT = 30000;
41
- var PLUGIN_RELEASED_POLL_INTERVAL = 5000;
42
- // Plugin visible on the Hosted Flex
64
+ // Starting multiple plugins using 2 local and one remote works
43
65
  var testSuite = function (_a) {
44
66
  var scenario = _a.scenario, config = _a.config, secrets = _a.secrets, environment = _a.environment;
45
67
  return __awaiter(void 0, void 0, void 0, function () {
46
- var plugin, release, plugins, releasedPlugin, accountSid, e_1;
68
+ var plugin1, plugin2, plugin3, flags, ext, startPlugin, setup, twilioCliResult, e_1;
47
69
  return __generator(this, function (_b) {
48
70
  switch (_b.label) {
49
71
  case 0:
50
- plugin = scenario.plugins[0];
51
- utils_1.assertion.not.isNull(plugin);
52
- if (!plugin.newlineValue) {
53
- throw new Error("scenario.plugin.newlineValue does not have a valid value");
72
+ plugin1 = scenario.plugins[0];
73
+ plugin2 = scenario.plugins[1];
74
+ plugin3 = scenario.plugins[2];
75
+ utils_1.assertion.not.isNull(plugin1);
76
+ utils_1.assertion.not.isNull(plugin2);
77
+ utils_1.assertion.not.isNull(plugin3);
78
+ if (!plugin1.newlineValue) {
79
+ throw new Error('scenario.plugin.newlineValue does not have a valid value');
54
80
  }
55
- return [4 /*yield*/, utils_1.api.getActiveRelease()];
56
- case 1:
57
- release = _b.sent();
58
- if (!release) {
59
- throw new Error('Account does not have an active release');
81
+ flags = [];
82
+ ext = scenario.isTS ? 'tsx' : 'jsx';
83
+ startPlugin = function (url) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
84
+ return [2 /*return*/, utils_1.pluginHelper.waitForPluginToStart(url, core_1.testParams.config.start.timeout, core_1.testParams.config.start.pollInterval)];
85
+ }); }); };
86
+ if (scenario.isTS) {
87
+ flags.push('--typescript');
60
88
  }
61
- return [4 /*yield*/, utils_1.api.getActivePlugins(release.configuration_sid)];
89
+ setup = function (plugin) { return __awaiter(void 0, void 0, void 0, function () {
90
+ return __generator(this, function (_a) {
91
+ switch (_a.label) {
92
+ case 0: return [4 /*yield*/, utils_1.spawn('twilio', __spreadArray(['flex:plugins:create', plugin.name], __read(flags)))];
93
+ case 1:
94
+ _a.sent();
95
+ utils_1.pluginHelper.changeFlexUIVersionIfRequired(scenario, plugin);
96
+ return [4 /*yield*/, utils_1.spawn('npm', ['i'], { cwd: plugin.dir })];
97
+ case 2:
98
+ _a.sent();
99
+ return [4 /*yield*/, replace_in_file_1.replaceInFile({
100
+ files: utils_1.joinPath(plugin.dir, 'src', 'components', 'CustomTaskList', "CustomTaskList." + ext),
101
+ from: /This is a dismissible demo component.*/,
102
+ to: plugin.componentText,
103
+ })];
104
+ case 3:
105
+ _a.sent();
106
+ return [2 /*return*/];
107
+ }
108
+ });
109
+ }); };
110
+ // Set up two new plugins
111
+ return [4 /*yield*/, Promise.all([setup(plugin2), setup(plugin3)])];
112
+ case 1:
113
+ // Set up two new plugins
114
+ _b.sent();
115
+ return [4 /*yield*/, utils_1.spawn('twilio', ['flex:plugins:start', '--name', plugin1.name + "@" + plugin1.version, '--name', plugin2.name, '-l', 'debug'], { detached: true, cwd: plugin3.dir })];
62
116
  case 2:
63
- plugins = _b.sent();
64
- releasedPlugin = plugins.plugins.find(function (plgin) { return plgin.unique_name === plugin.name; });
65
- if (!releasedPlugin) {
66
- throw new Error("Did not find plugin with name: " + plugin.name + " in released plugins");
67
- }
68
- return [4 /*yield*/, utils_1.Browser.create({ flex: config.hostedFlexBaseUrl, twilioConsole: config.consoleBaseUrl })];
117
+ twilioCliResult = _b.sent();
118
+ return [4 /*yield*/, Promise.all([startPlugin(plugin2.localhostUrl), startPlugin(plugin3.localhostUrl)])];
69
119
  case 3:
70
120
  _b.sent();
71
121
  _b.label = 4;
72
122
  case 4:
73
- _b.trys.push([4, 11, 13, 15]);
74
- // Log into Flex
75
- return [4 /*yield*/, utils_1.Browser.app.twilioConsole.login('admin', secrets.api.accountSid, config.localhostPort)];
123
+ _b.trys.push([4, 11, 13, 16]);
124
+ // Load local plugin
125
+ return [4 /*yield*/, utils_1.Browser.create({ flex: plugin3.localhostUrl, twilioConsole: config.consoleBaseUrl })];
76
126
  case 5:
77
- // Log into Flex
127
+ // Load local plugin
78
128
  _b.sent();
79
- return [4 /*yield*/, utils_1.assertion.app.view.adminDashboard.isVisible()];
129
+ return [4 /*yield*/, utils_1.Browser.app.twilioConsole.login('admin', secrets.api.accountSid, config.localhostPort)];
80
130
  case 6:
81
131
  _b.sent();
82
- return [4 /*yield*/, utils_1.Browser.app.getFlexAccountSid()];
132
+ // Check if local plugin loaded okay
133
+ return [4 /*yield*/, utils_1.assertion.app.view.agentDesktop.isVisible()];
83
134
  case 7:
84
- accountSid = _b.sent();
85
- utils_1.assertion.equal(accountSid, secrets.api.accountSid);
86
- // Make sure that /plugins contain the plugin
87
- return [4 /*yield*/, utils_1.pluginHelper.waitForPluginToRelease(releasedPlugin, PLUGIN_RELEASED_TIMEOUT, PLUGIN_RELEASED_POLL_INTERVAL)];
135
+ // Check if local plugin loaded okay
136
+ _b.sent();
137
+ return [4 /*yield*/, utils_1.assertion.app.view.plugins.plugin.isVisible(plugin1.newlineValue)];
88
138
  case 8:
89
- // Make sure that /plugins contain the plugin
90
139
  _b.sent();
91
- return [4 /*yield*/, utils_1.Browser.app.agentDesktop.open()];
140
+ return [4 /*yield*/, utils_1.assertion.app.view.plugins.plugin.isVisible(plugin2.componentText)];
92
141
  case 9:
93
142
  _b.sent();
94
- return [4 /*yield*/, utils_1.assertion.app.view.plugins.plugin.isVisible(plugin.newlineValue)];
143
+ return [4 /*yield*/, utils_1.assertion.app.view.plugins.plugin.isVisible(plugin3.componentText)];
95
144
  case 10:
96
145
  _b.sent();
97
- return [3 /*break*/, 15];
146
+ return [3 /*break*/, 16];
98
147
  case 11:
99
148
  e_1 = _b.sent();
100
149
  return [4 /*yield*/, utils_1.Browser.app.takeScreenshot(environment.cwd)];
@@ -103,13 +152,16 @@ var testSuite = function (_a) {
103
152
  throw e_1;
104
153
  case 13: return [4 /*yield*/, utils_1.Browser.kill()];
105
154
  case 14:
155
+ _b.sent();
156
+ return [4 /*yield*/, utils_1.killChildProcess(twilioCliResult.child, environment.operatingSystem)];
157
+ case 15:
106
158
  _b.sent();
107
159
  return [7 /*endfinally*/];
108
- case 15: return [2 /*return*/];
160
+ case 16: return [2 /*return*/];
109
161
  }
110
162
  });
111
163
  });
112
164
  };
113
- testSuite.description = 'Released Plugin visible on the Hosted Flex';
165
+ testSuite.description = 'Running {{twilio flex:plugins:start}} with multiple plugins: 2 local and 1 remote';
114
166
  exports.default = testSuite;
115
167
  //# sourceMappingURL=step010.js.map