flex-plugin-e2e-tests
Advanced tools
Comparing version 4.7.6-dev.202104220123 to 4.7.6-dev.202104222038
@@ -10,3 +10,6 @@ export interface TestParams { | ||
} | ||
export declare type TestSuite = (params: TestParams) => Promise<void>; | ||
export interface TestSuite { | ||
description: string; | ||
(params: TestParams): Promise<void>; | ||
} | ||
export declare const homeDir: string; |
@@ -67,4 +67,20 @@ "use strict"; | ||
}; | ||
var runTest = function (step) { return __awaiter(void 0, void 0, void 0, function () { | ||
var stepStr, testFile, testSuite; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
stepStr = '0'.repeat(Math.max(0, 3 - String(step).length)) + String(step); | ||
testFile = "step" + stepStr; | ||
testSuite = require(__dirname + "/tests/" + testFile).default; | ||
flex_plugins_utils_logger_1.logger.info("Step " + stepStr + " - " + testSuite.description); | ||
return [4 /*yield*/, testSuite(testParams)]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }; | ||
(function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var i; | ||
var i, step; | ||
return __generator(this, function (_a) { | ||
@@ -83,3 +99,3 @@ switch (_a.label) { | ||
if (!(i < testSuites.length)) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, require(__dirname + "/tests/" + testSuites[i]).default(testParams)]; | ||
return [4 /*yield*/, runTest(i + 1)]; | ||
case 2: | ||
@@ -92,3 +108,5 @@ _a.sent(); | ||
case 4: return [2 /*return*/]; | ||
case 5: return [4 /*yield*/, require(__dirname + "/tests/step" + getArg('--step')).default(testParams)]; | ||
case 5: | ||
step = getArg('--step'); | ||
return [4 /*yield*/, runTest(parseInt(step, 10))]; | ||
case 6: | ||
@@ -95,0 +113,0 @@ _a.sent(); |
@@ -39,4 +39,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* eslint-disable import/no-unused-modules */ | ||
var flex_plugins_utils_logger_1 = require("flex-plugins-utils-logger"); | ||
var utils_1 = require("../utils"); | ||
@@ -48,5 +46,3 @@ // Install Twilio CLI and Plugins CLI | ||
switch (_a.label) { | ||
case 0: | ||
flex_plugins_utils_logger_1.logger.info('Step 001 - Installing Twilio CLI and Plugins CLI'); | ||
return [4 /*yield*/, utils_1.spawn('npm', ['install', "--prefix=" + params.homeDir, '-g', 'twilio-cli'])]; | ||
case 0: return [4 /*yield*/, utils_1.spawn('npm', ['install', "--prefix=" + params.homeDir, '-g', 'twilio-cli'])]; | ||
case 1: | ||
@@ -66,3 +62,4 @@ twilioCliResult = _a.sent(); | ||
}); }; | ||
testSuite.description = 'Installing Twilio CLI and Plugins CLI'; | ||
exports.default = testSuite; | ||
//# sourceMappingURL=step001.js.map |
@@ -39,4 +39,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* eslint-disable import/no-unused-modules, sonarjs/no-duplicate-string */ | ||
var flex_plugins_utils_logger_1 = require("flex-plugins-utils-logger"); | ||
var utils_1 = require("../utils"); | ||
@@ -48,5 +46,3 @@ // Install Twilio CLI and Plugins CLI | ||
switch (_a.label) { | ||
case 0: | ||
flex_plugins_utils_logger_1.logger.info('Step 002 - Creating a Plugin'); | ||
return [4 /*yield*/, utils_1.spawn('twilio', ['flex:plugins:create', params.plugin.name])]; | ||
case 0: return [4 /*yield*/, utils_1.spawn('twilio', ['flex:plugins:create', params.plugin.name])]; | ||
case 1: | ||
@@ -69,3 +65,3 @@ twilioCliResult = _a.sent(); | ||
// Assert package.json | ||
utils_1.assertion.jsonFileContains([params.plugin.dir, 'package.json'], "dependencies['flex-plugin-scripts']", "^" + params.packageVersion); | ||
utils_1.assertion.jsonFileContains([params.plugin.dir, 'package.json'], "dependencies['flex-plugin-scripts']", params.packageVersion); | ||
utils_1.assertion.jsonFileContains([params.plugin.dir, 'package.json'], "dependencies['react']", "16.5.2"); | ||
@@ -78,3 +74,4 @@ utils_1.assertion.jsonFileContains([params.plugin.dir, 'package.json'], "dependencies['react-dom']", "16.5.2"); | ||
}); }; | ||
testSuite.description = 'Creating a Plugin'; | ||
exports.default = testSuite; | ||
//# sourceMappingURL=step002.js.map |
@@ -39,4 +39,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* eslint-disable import/no-unused-modules */ | ||
var flex_plugins_utils_logger_1 = require("flex-plugins-utils-logger"); | ||
var utils_1 = require("../utils"); | ||
@@ -48,5 +46,3 @@ // Install Twilio CLI and Plugins CLI | ||
switch (_a.label) { | ||
case 0: | ||
flex_plugins_utils_logger_1.logger.info('Step 003 - Running {{npm i}}'); | ||
return [4 /*yield*/, utils_1.spawn('npm', ['i'], { cwd: params.plugin.dir })]; | ||
case 0: return [4 /*yield*/, utils_1.spawn('npm', ['i'], { cwd: params.plugin.dir })]; | ||
case 1: | ||
@@ -62,3 +58,4 @@ result = _a.sent(); | ||
}); }; | ||
testSuite.description = 'Running {{npm i}}'; | ||
exports.default = testSuite; | ||
//# sourceMappingURL=step003.js.map |
@@ -39,4 +39,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* eslint-disable import/no-unused-modules */ | ||
var flex_plugins_utils_logger_1 = require("flex-plugins-utils-logger"); | ||
var utils_1 = require("../utils"); | ||
@@ -48,5 +46,3 @@ // Install Twilio CLI and Plugins CLI | ||
switch (_a.label) { | ||
case 0: | ||
flex_plugins_utils_logger_1.logger.info('Step 004 - Running {{twilio flex:plugins:test}}'); | ||
return [4 /*yield*/, utils_1.spawn('twilio', ['flex:plugins:test'], { cwd: params.plugin.dir })]; | ||
case 0: return [4 /*yield*/, utils_1.spawn('twilio', ['flex:plugins:test'], { cwd: params.plugin.dir })]; | ||
case 1: | ||
@@ -59,3 +55,4 @@ result = _a.sent(); | ||
}); }; | ||
testSuite.description = 'Running {{twilio flex:plugins:test}}'; | ||
exports.default = testSuite; | ||
//# sourceMappingURL=step004.js.map |
@@ -40,3 +40,2 @@ "use strict"; | ||
/* eslint-disable import/no-unused-modules */ | ||
var flex_plugins_utils_logger_1 = require("flex-plugins-utils-logger"); | ||
var replace_in_file_1 = require("replace-in-file"); | ||
@@ -50,3 +49,2 @@ var utils_1 = require("../utils"); | ||
case 0: | ||
flex_plugins_utils_logger_1.logger.info('Step 005 - Running {{twilio flex:plugins:build}}'); | ||
newline = "This is a dismissible demo component " + new Date(); | ||
@@ -72,3 +70,4 @@ return [4 /*yield*/, replace_in_file_1.replaceInFile({ | ||
}); }; | ||
testSuite.description = 'Running {{twilio flex:plugins:build}}'; | ||
exports.default = testSuite; | ||
//# sourceMappingURL=step005.js.map |
@@ -67,2 +67,4 @@ "use strict"; | ||
PATH: process.env.PATH + ":/" + __1.homeDir + "/bin", | ||
TWILIO_ACCOUNT_SID: process.env.TWILIO_ACCOUNT_SID, | ||
TWILIO_AUTH_TOKEN: process.env.TWILIO_AUTH_TOKEN, | ||
}, | ||
@@ -69,0 +71,0 @@ }; |
{ | ||
"name": "flex-plugin-e2e-tests", | ||
"version": "4.7.6-dev.202104220123", | ||
"version": "4.7.6-dev.202104222038", | ||
"description": "Flex Plugin E2E Tests framework", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
"dependencies": { | ||
"flex-plugins-utils-logger": "^4.7.6-dev.202104220123", | ||
"flex-plugins-utils-logger": "^4.7.6-dev.202104222038", | ||
"lodash": "4.17.21", | ||
@@ -48,3 +48,3 @@ "replace-in-file": "^6.2.0" | ||
}, | ||
"gitHead": "bda2ea817a36f8b535b5db08fa2e2f2d9190bb90" | ||
"gitHead": "61f0de353faf6d409ac95ae9bb0e942eab727904" | ||
} |
@@ -9,2 +9,22 @@ ![npm](https://img.shields.io/npm/v/flex-plugin-e2e-tests.svg?style=square) | ||
## Running Locally | ||
To run locally: | ||
```bash | ||
# cd into this package | ||
cd packages/flex-plugin-e2e-tests | ||
npm run build | ||
# This is the sandbox environment created to test CLI installation and to create plugin. Remove before re-running a test | ||
rm -rf ~/.local | ||
PACKAGE_VERSION="4.7.5-beta.0" npm start | ||
``` | ||
You can also run a specific step by using: | ||
```bash | ||
PACKAGE_VERSION="4.7.5-beta.0" npm start -- --step 2 | ||
``` | ||
## Contributors | ||
@@ -11,0 +31,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
53874
734
36
10