-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(integration): Tests for falcon:adk:install
Create falcon/adk/install.test.ts. Create secondary recipe file falcon-test-01B-recipe.json. Update init.js with env var that tracks location of Falcon Test TempDir. Related to: #133
- Loading branch information
1 parent
e5bb0db
commit 42959a1
Showing
3 changed files
with
250 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
test/integration-tests/commands/falcon/adk/install.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
//─────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
/** | ||
* @file test/integration-tests/commands/falcon/adk/install.test.ts | ||
* @copyright Vivek M. Chawla - 2019 | ||
* @author Vivek M. Chawla <@VivekMChawla> | ||
* @summary Integration tests for the falcon:adk:install command. | ||
* @description Integration tests for the falcon:adk:install command. | ||
* @version 1.0.0 | ||
* @license MIT | ||
*/ | ||
//─────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
// Import Modules | ||
import {expect} from 'chai'; | ||
import {executeWithInput} from '../../../../helpers/cmd'; | ||
import {getOutputLines} from '../../../../helpers/cmd'; | ||
import {KEY} from '../../../../helpers/cmd'; | ||
|
||
// Require Modules | ||
const path = require('path'); | ||
|
||
|
||
//─────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
/** | ||
* Test suite for falcon:adk:install. | ||
*/ | ||
//─────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
describe('falcon:adk:install', () => { | ||
|
||
// Test One | ||
it('should successfully run the default Recipe inside project "adk-test-01"', async () => { | ||
const commandResponse = await executeWithInput( | ||
process.env.FALCON_COMMAND_RUNNER, // Path to the process that will be run. | ||
[ | ||
'falcon:adk:install' // First member of the array must be the CLI command we want to run. | ||
], | ||
[ | ||
{input: 'Y' + KEY.ENTER, delay: 10000} | ||
], | ||
{ | ||
envVars: { | ||
SFDX_JSON_TO_STDOUT: true, // Sends all JSON output to STDOUT | ||
SFDX_AUTOUPDATE_DISABLE: true // Disables the Salesforce CLI AutoUpdate feature | ||
}, | ||
workingDir: path.join(process.env.FALCON_TEST_PROJECTDIR, 'adk-test-01'), | ||
showStdout: false, | ||
showStderr: true, | ||
showResult: true, | ||
minTimeout: 100, | ||
maxTimeout: 300000 | ||
} | ||
); | ||
|
||
// Check exit code. | ||
expect(commandResponse.exitCode) | ||
.to | ||
.equal(0, 'Non-zero Exit Code'); | ||
// Check final output. | ||
expect(getOutputLines(commandResponse, [-1])) | ||
.to | ||
.equal('Recipe Executed Successfully'); | ||
}).timeout(600000); | ||
|
||
// Test Two | ||
it(`should successfully run PART OF the specific Recipe "falcon-test-01B-recipe.json" inside project "adk-test-01"`, async () => { | ||
const commandResponse = await executeWithInput( | ||
process.env.FALCON_COMMAND_RUNNER, // Path to the process that will be run. | ||
[ | ||
'falcon:adk:install', // First member of the array must be the CLI command we want to run. | ||
'-f', | ||
'falcon-test-01B-recipe.json' | ||
], | ||
[ | ||
{input: 'Y' + KEY.ENTER, delay: 10000}, | ||
{input: 'Y' + KEY.ENTER, delay: 500}, | ||
{input: 'Y' + KEY.ENTER, delay: 500}, | ||
{input: 'I' + KEY.ENTER, delay: 500}, | ||
{input: KEY.DOWN, delay: 500}, | ||
{input: KEY.SPACE, delay: 500}, | ||
{input: KEY.ENTER, delay: 500}, | ||
{input: 'Y' + KEY.ENTER, delay: 500}, | ||
{input: 'Y' + KEY.ENTER, delay: 25000} | ||
], | ||
{ | ||
envVars: { | ||
SFDX_JSON_TO_STDOUT: true, // Sends all JSON output to STDOUT | ||
SFDX_AUTOUPDATE_DISABLE: true // Disables the Salesforce CLI AutoUpdate feature | ||
}, | ||
workingDir: path.join(process.env.FALCON_TEST_PROJECTDIR, 'adk-test-01'), | ||
showStdout: true, | ||
showStderr: true, | ||
showResult: true, | ||
minTimeout: 100, | ||
maxTimeout: 300000 | ||
} | ||
); | ||
|
||
// Check exit code. | ||
expect(commandResponse.exitCode) | ||
.to | ||
.equal(0, 'Non-zero Exit Code'); | ||
// Check final output. | ||
expect(getOutputLines(commandResponse, [-1])) | ||
.to | ||
.equal('Recipe Executed Successfully'); | ||
}).timeout(300000); | ||
}); |
140 changes: 140 additions & 0 deletions
140
test/projects/adk-test-01/config/falcon-test-01B-recipe.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
{ | ||
"recipeName": "Falcon Test: Recipe 01", | ||
"description": "Test Recipe for Building an ADK Demo", | ||
"recipeType": "appx:demo-recipe", | ||
"recipeVersion": "1.0.0", | ||
"schemaVersion": "0.1.2", | ||
"options": { | ||
"haltOnError": true, | ||
"noCustomInstall": false, | ||
"skipGroups": [], | ||
"skipActions": [], | ||
"targetOrgs": [ | ||
{ | ||
"orgName": "Falcon Test: Recipe 01", | ||
"alias": "falcon-test-recipe-01", | ||
"description": "Falcon Test Scratch Org", | ||
"isScratchOrg": true, | ||
"scratchDefJson": "falcon-test-01-scratch-def.json" | ||
} | ||
] | ||
}, | ||
"recipeStepGroups": [ | ||
{ | ||
"stepGroupName": "Install Packages", | ||
"alias": "install-packages", | ||
"description": "Installs managed and unmanged packages required by this test", | ||
"recipeSteps": [ | ||
{ | ||
"stepName": "Install Falcon-X Managed Package", | ||
"description": "Installs version 1.2 (Beta 10) of the Falcon-X package", | ||
"action": "install-package", | ||
"options": { | ||
"packageName": "Falcon-X, Version 1.2 (Beta 10)", | ||
"packageVersionId": "04t1N000001bW4g" | ||
} | ||
}, | ||
{ | ||
"stepName": "Install VMC Base Package", | ||
"description": "Installs version 1.37 (Beta 1) of the VMC Base Package", | ||
"action": "install-package", | ||
"options": { | ||
"packageName": "VMC Base Package, Version 1.37 (Beta 1)", | ||
"packageVersionId": "04t360000011vqy" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"stepGroupName": "Deploy Metadata", | ||
"alias": "deploy-metadata", | ||
"description": "Deploys code from the mdapi-source directory", | ||
"recipeSteps": [ | ||
{ | ||
"stepName": "Deploy App Config", | ||
"description": "Deploys metadata found in mdapi-source/app-config", | ||
"action": "deploy-metadata", | ||
"options": { | ||
"mdapiSource": "app-config" | ||
} | ||
}, | ||
{ | ||
"stepName": "Deploy Data Config", | ||
"description": "Deploys metadata found in mdapi-source/data-config", | ||
"action": "deploy-metadata", | ||
"options": { | ||
"mdapiSource": "data-config" | ||
} | ||
}, | ||
{ | ||
"stepName": "Deploy Org Config", | ||
"description": "Deploys metadata found in mdapi-source/org-config", | ||
"action": "deploy-metadata", | ||
"options": { | ||
"mdapiSource": "org-config" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"stepGroupName": "Create and Configure Users", | ||
"alias": "create-users", | ||
"description": "Configure the Admin User and create primary and secondary demo users", | ||
"recipeSteps": [ | ||
{ | ||
"stepName": "Configure Admin User", | ||
"description": "Configures the Admin User based on demo-user-admin.json", | ||
"action": "configure-admin-user", | ||
"options": { | ||
"definitionFile": "falcon-test-01-demo-user-admin.json" | ||
} | ||
}, | ||
{ | ||
"stepName": "Create Primary Demo User", | ||
"description": "Creates a demo user based on demo-user-primary.json", | ||
"action": "create-user", | ||
"options": { | ||
"definitionFile": "falcon-test-01-demo-user-primary.json", | ||
"sfdxUserAlias": "sfdc_primary-demo-user" | ||
} | ||
}, | ||
{ | ||
"stepName": "Create Secondary Demo User", | ||
"description": "Creates a demo user based on demo-user-secondary.json", | ||
"action": "create-user", | ||
"options": { | ||
"definitionFile": "falcon-test-01-demo-user-secondary.json", | ||
"sfdxUserAlias": "sfdc_secondary-demo-user" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"stepGroupName": "Import/Create Data", | ||
"alias": "import-data", | ||
"description": "Imports or creates data in the demo org", | ||
"recipeSteps": [ | ||
{ | ||
"stepName": "Import Custom Settings", | ||
"description": "Imports custom settings data", | ||
"action": "import-data-tree", | ||
"options": { | ||
"plan": "custom-settings/data-plan.json" | ||
} | ||
}, | ||
{ | ||
"stepName": "Import Sample Data", | ||
"description": "Imports sample account and DriveWealth data", | ||
"action": "import-data-tree", | ||
"options": { | ||
"plan": "sample-customers/data-plan.json" | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"handlers": [ | ||
{}, | ||
{} | ||
] | ||
} |