From d14ec3d5b20a0849f2a5d1ae5e679c4e51e5204b Mon Sep 17 00:00:00 2001 From: "Vivek M. Chawla" Date: Thu, 9 May 2019 04:43:41 -0700 Subject: [PATCH] refactor(test): Return test code to normal Update mock input sequence inside create.test.ts. Update testbed ADK project to use the latest schema for sfdx-project.json. Turn tslint back on as part of post-test actions. Related to: #139 --- package.json | 2 +- .../commands/falcon/adk/create.test.ts | 30 ++++++++++--------- .../commands/falcon/adk/install.test.ts | 8 ++--- .../.sfdx-falcon/sfdx-falcon-config.json | 1 + test/projects/adk-test-01/sfdx-project.json | 5 ++-- 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 07c8793..fccc3f5 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "repository": "sfdx-isv/sfdx-falcon", "scripts": { "postpack": "rm -f oclif.manifest.json npm-shrinkwrap.json", - "posttest": "#tslint -p test -t stylish", + "posttest": "tslint -p test -t stylish", "prepare": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme && npm shrinkwrap", "test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"", "version": "oclif-dev readme && git add README.md" diff --git a/test/integration-tests/commands/falcon/adk/create.test.ts b/test/integration-tests/commands/falcon/adk/create.test.ts index c621921..27c413f 100644 --- a/test/integration-tests/commands/falcon/adk/create.test.ts +++ b/test/integration-tests/commands/falcon/adk/create.test.ts @@ -32,16 +32,18 @@ describe('falcon:adk:create', () => { 'falcon:adk:create' // First member of the array must be the CLI command we want to run. ], [ - {input: KEY.ENTER, delay: 45000}, // Choose first DevHub listed - {input: KEY.ENTER, delay: 500}, // ??? - {input: KEY.ENTER, delay: 500}, // ??? - {input: 'N' + KEY.ENTER, delay: 500}, // ??? - {input: 'Y' + KEY.ENTER, delay: 500}, // ??? - {input: KEY.ENTER, delay: 500}, // ??? - {input: KEY.ENTER, delay: 500}, // ??? - {input: KEY.ENTER, delay: 500}, // ??? - {input: KEY.ENTER, delay: 500}, // ??? - {input: 'Y' + KEY.ENTER, delay: 500} // ??? + {input: KEY.ENTER, delay: 45000}, // Choose default Target Directory + {input: KEY.ENTER, delay: 500}, // Choose first DevHub on the list + {input: KEY.ENTER, delay: 500}, // Choose first EnvHub on the list + {input: KEY.ENTER, delay: 500}, // Choose default Company Name + {input: KEY.ENTER, delay: 500}, // Choose default Company Alias + {input: KEY.ENTER, delay: 500}, // Choose default Project Name + {input: KEY.ENTER, delay: 500}, // Choose default Project Alias + {input: 'Y' + KEY.ENTER, delay: 500}, // Choose YES to initialize Git + {input: 'Y' + KEY.ENTER, delay: 500}, // Choose YES that I've created a remote Git Repo + {input: KEY.ENTER, delay: 500}, // Choose default Git Remote URI + {input: 'Y' + KEY.ENTER, delay: 2000}, // Choose YES to continue with unreachable Git Remote + {input: 'Y' + KEY.ENTER, delay: 500} // Choose YES to create a new ADK project ], { envVars: { @@ -65,10 +67,10 @@ describe('falcon:adk:create', () => { // Check final output for success indicators. // TODO: Figure out why the git stage/commit step works locally but not at CircleCI // In the meantime, let's just focus on an exit code of ZERO to indicate success. - // expect(commandResponse.stdoutLines) - // .to - // .include('Command Succeded : falcon:adk:create completed successfully', - // 'FAILURE! Final output missing success message'); + expect(commandResponse.stdoutLines) + .to + .include('Command Succeded : falcon:adk:create completed successfully, but with some warnings (see above)', + 'FAILURE! Incorrect Final Status message'); }).timeout(120000); //───────────────────────────────────────────────────────────────────────────┐ diff --git a/test/integration-tests/commands/falcon/adk/install.test.ts b/test/integration-tests/commands/falcon/adk/install.test.ts index b93bbfa..71b96a5 100644 --- a/test/integration-tests/commands/falcon/adk/install.test.ts +++ b/test/integration-tests/commands/falcon/adk/install.test.ts @@ -40,8 +40,8 @@ describe('falcon:adk:install', () => { ], { envVars: { - SFDX_JSON_TO_STDOUT: true, // Sends all JSON output to STDOUT - SFDX_AUTOUPDATE_DISABLE: true // Disables the Salesforce CLI AutoUpdate feature + 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: process.env.FALCON_TEST_SHOW_STDOUT ? true : false, @@ -90,8 +90,8 @@ describe('falcon:adk:install', () => { ], { envVars: { - SFDX_JSON_TO_STDOUT: true, // Sends all JSON output to STDOUT - SFDX_AUTOUPDATE_DISABLE: true // Disables the Salesforce CLI AutoUpdate feature + 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: process.env.FALCON_TEST_SHOW_STDOUT ? true : false, diff --git a/test/projects/adk-test-01/.sfdx-falcon/sfdx-falcon-config.json b/test/projects/adk-test-01/.sfdx-falcon/sfdx-falcon-config.json index 8a3df5a..f3d895c 100644 --- a/test/projects/adk-test-01/.sfdx-falcon/sfdx-falcon-config.json +++ b/test/projects/adk-test-01/.sfdx-falcon/sfdx-falcon-config.json @@ -1,6 +1,7 @@ { "devHubAlias": "DevHub-PBO", "envHubAlias": "NOT_SPECIFIED", + "pkgOrgAlias": "NOT_SPECIFIED", "appxProject": {}, "appxDemo": { "installedDemos": [] diff --git a/test/projects/adk-test-01/sfdx-project.json b/test/projects/adk-test-01/sfdx-project.json index 653b23b..805c0cb 100644 --- a/test/projects/adk-test-01/sfdx-project.json +++ b/test/projects/adk-test-01/sfdx-project.json @@ -3,14 +3,15 @@ {"path": "sfdx-source/force-app", "default": true} ], "sfdcLoginUrl": "https://login.salesforce.com", - "sourceApiVersion": "44.0", + "sourceApiVersion": "45.0", "plugins": { "sfdxFalcon": { "developerAlias" : "sfdc", "developerName" : "Salesforce", "projectAlias" : "adk-testbed", "projectName" : "ADK Testbed", - "projectType" : "appx:single-demo", + "projectFamily" : "ADK", + "projectType" : "single-demo", "defaultRecipe" : "falcon-test-01-recipe.json", "gitRemoteUri" : "https://github.com/sfdx-isv/testbed-falcon-adk.git", "gitHubUrl" : "https://github.com/sfdx-isv/testbed-falcon-adk",