From 550bed2b07278fe34b744bc0da70973777927b6e Mon Sep 17 00:00:00 2001 From: formarfr Date: Tue, 29 May 2018 11:36:18 -0500 Subject: [PATCH 01/25] added TFS CI Variables --- index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/index.js b/index.js index 3fba422..b3f0ab7 100755 --- a/index.js +++ b/index.js @@ -582,6 +582,17 @@ protractorUtil.prototype.obtainCIVariables = function(env) { url: 'https://travis-this.ci.org/' + env.TRAVIS_REPO_SLUG + '/builds/' + env.TRAVIS_BUILD_ID } } + if (env.TF_BUILD) { + return { + build: env.BUILD_BUILDNUMBER, + branch: env.BUILD_SOURCEBRANCHNAME, + sha: env.BUILD_SOURCEVERSION, + tag: 'N/A', + name: env.BUILD_DEFINITIONNAME, + commit: env.BUILD_SOURCEVERSIONMESSAGE, + url: env.SYSTEM_TEAMFOUNDATIONSERVERURI + env.SYSTEM_TEAMPROJECT + '/_build/index?buildId=' + env.BUILDID + } + } return {}; } /** From d255dd1c91db59e263a8c68236b4ac4f25c234c4 Mon Sep 17 00:00:00 2001 From: formarfr Date: Tue, 29 May 2018 12:19:10 -0500 Subject: [PATCH 02/25] Fixed build id env variable for tfs --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index b3f0ab7..600a551 100755 --- a/index.js +++ b/index.js @@ -590,7 +590,7 @@ protractorUtil.prototype.obtainCIVariables = function(env) { tag: 'N/A', name: env.BUILD_DEFINITIONNAME, commit: env.BUILD_SOURCEVERSIONMESSAGE, - url: env.SYSTEM_TEAMFOUNDATIONSERVERURI + env.SYSTEM_TEAMPROJECT + '/_build/index?buildId=' + env.BUILDID + url: env.SYSTEM_TEAMFOUNDATIONSERVERURI + env.SYSTEM_TEAMPROJECT + '/_build/index?buildId=' + env.BUILD_BUILDID } } return {}; From 7d85739565c04408cd36c445ee5964076b511c13 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 08:58:33 -0500 Subject: [PATCH 03/25] Create config for tfs-ci-variable test --- .../protractor-config/tfs-ci-variables.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 spec/integrational/protractor-config/tfs-ci-variables.js diff --git a/spec/integrational/protractor-config/tfs-ci-variables.js b/spec/integrational/protractor-config/tfs-ci-variables.js new file mode 100644 index 0000000..5d15bd2 --- /dev/null +++ b/spec/integrational/protractor-config/tfs-ci-variables.js @@ -0,0 +1,17 @@ +var env = require('../environment'); + +exports.config = { + seleniumAddress: env.seleniumAddress, + framework: 'jasmine2', + specs: ['../protractor/tfs-ci-variables.js'], + plugins: [{ + path: '../../../index.js', + screenshotPath: '.tmp/tfs-ci-variables', + writeReportFreq: 'asap' + }], + capabilities: { + 'browserName': env.capabilities.browserName, + 'shardTestFiles': true, + 'maxInstances': 5 + } +}; From b242a63c242da125d49094a0bfd4f594397b47d8 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 09:11:24 -0500 Subject: [PATCH 04/25] renamed file, use angular homepage test --- .../{tfs-ci-variables.js => ci-variables-tfs.js} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename spec/integrational/protractor-config/{tfs-ci-variables.js => ci-variables-tfs.js} (76%) diff --git a/spec/integrational/protractor-config/tfs-ci-variables.js b/spec/integrational/protractor-config/ci-variables-tfs.js similarity index 76% rename from spec/integrational/protractor-config/tfs-ci-variables.js rename to spec/integrational/protractor-config/ci-variables-tfs.js index 5d15bd2..4d3ee75 100644 --- a/spec/integrational/protractor-config/tfs-ci-variables.js +++ b/spec/integrational/protractor-config/ci-variables-tfs.js @@ -3,10 +3,10 @@ var env = require('../environment'); exports.config = { seleniumAddress: env.seleniumAddress, framework: 'jasmine2', - specs: ['../protractor/tfs-ci-variables.js'], + specs: ['../protractor/angularjs-homepage-test.js'], plugins: [{ path: '../../../index.js', - screenshotPath: '.tmp/tfs-ci-variables', + screenshotPath: '.tmp/ci-variables-tfs', writeReportFreq: 'asap' }], capabilities: { From 0781b5924e8a19321e9242aaf9adc1078822a727 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 09:37:02 -0500 Subject: [PATCH 05/25] added test for TFS variables --- spec/unit/screenshoter.unit.spec.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/spec/unit/screenshoter.unit.spec.js b/spec/unit/screenshoter.unit.spec.js index ddff29f..94b6741 100644 --- a/spec/unit/screenshoter.unit.spec.js +++ b/spec/unit/screenshoter.unit.spec.js @@ -224,6 +224,30 @@ describe("Screenshoter unit", function() { expect(ci.commit).toEqual('commit'); expect(ci.url).toEqual('https://circleci.com/some/ulr'); }); + + it("should support TFS", function() { + var env = { + TF_BUILD: true, + BUILD_BUILDNUMBER: '1.0.1234', + BUILD_SOURCEBRANCHNAME: 'master', + BUILD_SOURCEVERSION: 'sha', + // No variable for 'tag', will display 'N/A' + BUILD_DEFINITIONNAME: 'a/b', + BUILD_SOURCEVERSIONMESSAGE: 'commit', + SYSTEM_TEAMFOUNDATIONSERVERURI: 'https://www.visualstudio.com/tfs/' + } + var ci = screenshoter.obtainCIVariables(env); + + expect(ci).toBeDefined(); + expect(ci.build).toEqual('1.0.1234'); + expect(ci.tag).toEqual('N/A'); // hard coded + expect(ci.sha).toEqual('sha'); + expect(ci.branch).toEqual('master'); + expect(ci.name).toEqual('a/b'); + expect(ci.commit).toEqual('commit'); + expect(ci.url).toEqual('https://www.visualstudio.com/tfs/'); + }); + it("should support Local environment", function() { var env = {} From 5f778be7955c1816a89b45a5b9db981dff033c76 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 11:28:32 -0500 Subject: [PATCH 06/25] fixed url property, added buildid, projectname --- spec/unit/screenshoter.unit.spec.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/unit/screenshoter.unit.spec.js b/spec/unit/screenshoter.unit.spec.js index 94b6741..3e7af8c 100644 --- a/spec/unit/screenshoter.unit.spec.js +++ b/spec/unit/screenshoter.unit.spec.js @@ -229,12 +229,14 @@ describe("Screenshoter unit", function() { var env = { TF_BUILD: true, BUILD_BUILDNUMBER: '1.0.1234', + BUILD_BUILDID: '1234', BUILD_SOURCEBRANCHNAME: 'master', BUILD_SOURCEVERSION: 'sha', // No variable for 'tag', will display 'N/A' BUILD_DEFINITIONNAME: 'a/b', BUILD_SOURCEVERSIONMESSAGE: 'commit', - SYSTEM_TEAMFOUNDATIONSERVERURI: 'https://www.visualstudio.com/tfs/' + SYSTEM_TEAMFOUNDATIONSERVERURI: 'https://www.visualstudio.com/tfs/', + SYSTEM_TEAMPROJECT: 'ProjectName' } var ci = screenshoter.obtainCIVariables(env); @@ -245,7 +247,7 @@ describe("Screenshoter unit", function() { expect(ci.branch).toEqual('master'); expect(ci.name).toEqual('a/b'); expect(ci.commit).toEqual('commit'); - expect(ci.url).toEqual('https://www.visualstudio.com/tfs/'); + expect(ci.url).toEqual('https://www.visualstudio.com/tfs/ProjectName/_build/index?buildId=1234'); }); From 4f23c5273fd5c092536ed4a6de8dab3d78940faa Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 13:29:33 -0500 Subject: [PATCH 07/25] added config for tfs variable test --- spec/integrational/protractor-config/ci-variables-tfs.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spec/integrational/protractor-config/ci-variables-tfs.js b/spec/integrational/protractor-config/ci-variables-tfs.js index 4d3ee75..3cdeeb9 100644 --- a/spec/integrational/protractor-config/ci-variables-tfs.js +++ b/spec/integrational/protractor-config/ci-variables-tfs.js @@ -7,11 +7,10 @@ exports.config = { plugins: [{ path: '../../../index.js', screenshotPath: '.tmp/ci-variables-tfs', - writeReportFreq: 'asap' + writeReportFreq: 'asap', + clearFoldersBeforeTest: true }], capabilities: { - 'browserName': env.capabilities.browserName, - 'shardTestFiles': true, - 'maxInstances': 5 + 'browserName': env.capabilities.browserName } }; From 642ef50a8a339ca7090c1223057d44f3c212a39c Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 13:47:14 -0500 Subject: [PATCH 08/25] Delete config --- .../protractor-config/ci-variables-tfs.js | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 spec/integrational/protractor-config/ci-variables-tfs.js diff --git a/spec/integrational/protractor-config/ci-variables-tfs.js b/spec/integrational/protractor-config/ci-variables-tfs.js deleted file mode 100644 index 3cdeeb9..0000000 --- a/spec/integrational/protractor-config/ci-variables-tfs.js +++ /dev/null @@ -1,16 +0,0 @@ -var env = require('../environment'); - -exports.config = { - seleniumAddress: env.seleniumAddress, - framework: 'jasmine2', - specs: ['../protractor/angularjs-homepage-test.js'], - plugins: [{ - path: '../../../index.js', - screenshotPath: '.tmp/ci-variables-tfs', - writeReportFreq: 'asap', - clearFoldersBeforeTest: true - }], - capabilities: { - 'browserName': env.capabilities.browserName - } -}; From 3b0dbfab2f9f8a8a447b42d9606ea4dced555297 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 13:54:09 -0500 Subject: [PATCH 09/25] check for tfs build tags --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 600a551..28cf983 100755 --- a/index.js +++ b/index.js @@ -587,7 +587,7 @@ protractorUtil.prototype.obtainCIVariables = function(env) { build: env.BUILD_BUILDNUMBER, branch: env.BUILD_SOURCEBRANCHNAME, sha: env.BUILD_SOURCEVERSION, - tag: 'N/A', + tag: env.BUILD_Tag? env.BUILD_Tag : 'N/A', name: env.BUILD_DEFINITIONNAME, commit: env.BUILD_SOURCEVERSIONMESSAGE, url: env.SYSTEM_TEAMFOUNDATIONSERVERURI + env.SYSTEM_TEAMPROJECT + '/_build/index?buildId=' + env.BUILD_BUILDID From ac052c2aed1b00051697c83a104912fd36c96052 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 14:29:16 -0500 Subject: [PATCH 10/25] Update for TFS support --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6efe9b6..3022135 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ 3. For each **expectation** or spec can capture console logs for **each browser instance** 4. It can generate a report analyzer - angular+bootstrap **HTML reports** with active filtering to easily find out why your tests are failing 5. HTML reports allow you to analyze your browser's **console logs** as well. -6. Supports extracting build information (the report displays a build number, a branch, etc. ) for [GitLab](https://gitlab.com) **CI/CD**, [CircleCI](https://circleci.com) and [Travis](https://travis-ci.org/). +6. Supports extracting build information (the report displays a build number, a branch, etc. ) for [GitLab](https://gitlab.com) **CI/CD**, [CircleCI](https://circleci.com), [Travis](https://travis-ci.org/) and [TFS](https://www.visualstudio.com/tfs/). 7. Supports parallel tests execution 8. Makes optional **Ascii** screenshots 9. **Multi capabilities** are supported @@ -272,7 +272,7 @@ If there is a failure (based on the config) it creates also an ASCII image into ## Environmental variables -Screenshoter out-of-box obtains build information. However, some CI does not have an environmental variable for a commit message. Thus you need to obtain it manually: +Screenshoter out-of-box obtains build information. However, some CI does not have an environmental variable for a commit message or tags. Thus you need to obtain it manually: **GitLab** ```sh @@ -284,6 +284,12 @@ Screenshoter out-of-box obtains build information. However, some CI does not hav export CIRCLE_MSG=$(git log -1 --pretty=%B) ``` +**TFS** +(To obtain tags, please use [TFS Rest API](https://docs.microsoft.com/en-us/rest/api/vsts/build/tags/get%20build%20tags?view=vsts-rest-4.1).) +```sh + process.env["BUILD_TAG"] = TFS REST API RESPONSE; +``` + If CI will support one day these variables, you won't need to enter anything in your build process. Do you want to see exactly what is extracted, consult the code directly [obtainCIVariables](index.js#L551) From 47c7734dbcabc3f4956361638c51b12aa6fd2322 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 14:31:27 -0500 Subject: [PATCH 11/25] renamed env variable --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 28cf983..d91cb49 100755 --- a/index.js +++ b/index.js @@ -587,7 +587,7 @@ protractorUtil.prototype.obtainCIVariables = function(env) { build: env.BUILD_BUILDNUMBER, branch: env.BUILD_SOURCEBRANCHNAME, sha: env.BUILD_SOURCEVERSION, - tag: env.BUILD_Tag? env.BUILD_Tag : 'N/A', + tag: env.BUILD_TAGS? env.BUILD_TAGS : 'N/A', name: env.BUILD_DEFINITIONNAME, commit: env.BUILD_SOURCEVERSIONMESSAGE, url: env.SYSTEM_TEAMFOUNDATIONSERVERURI + env.SYSTEM_TEAMPROJECT + '/_build/index?buildId=' + env.BUILD_BUILDID From 5aba9951b04d93e4f7e1c2c968bc1337209836c5 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 14:36:18 -0500 Subject: [PATCH 12/25] removed unneccessary check --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index d91cb49..13b6416 100755 --- a/index.js +++ b/index.js @@ -587,7 +587,7 @@ protractorUtil.prototype.obtainCIVariables = function(env) { build: env.BUILD_BUILDNUMBER, branch: env.BUILD_SOURCEBRANCHNAME, sha: env.BUILD_SOURCEVERSION, - tag: env.BUILD_TAGS? env.BUILD_TAGS : 'N/A', + tag: env.BUILD_TAGS, name: env.BUILD_DEFINITIONNAME, commit: env.BUILD_SOURCEVERSIONMESSAGE, url: env.SYSTEM_TEAMFOUNDATIONSERVERURI + env.SYSTEM_TEAMPROJECT + '/_build/index?buildId=' + env.BUILD_BUILDID From 4bf9a61121fe987d20d22dbd2f0cf2ce99b74d64 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 14:57:11 -0500 Subject: [PATCH 13/25] Updated test for assigning tfs tags variable --- spec/unit/screenshoter.unit.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/unit/screenshoter.unit.spec.js b/spec/unit/screenshoter.unit.spec.js index 3e7af8c..1c30f55 100644 --- a/spec/unit/screenshoter.unit.spec.js +++ b/spec/unit/screenshoter.unit.spec.js @@ -232,7 +232,7 @@ describe("Screenshoter unit", function() { BUILD_BUILDID: '1234', BUILD_SOURCEBRANCHNAME: 'master', BUILD_SOURCEVERSION: 'sha', - // No variable for 'tag', will display 'N/A' + BUILD_TAGS: ['tag1', 'tag2'] BUILD_DEFINITIONNAME: 'a/b', BUILD_SOURCEVERSIONMESSAGE: 'commit', SYSTEM_TEAMFOUNDATIONSERVERURI: 'https://www.visualstudio.com/tfs/', @@ -242,7 +242,7 @@ describe("Screenshoter unit", function() { expect(ci).toBeDefined(); expect(ci.build).toEqual('1.0.1234'); - expect(ci.tag).toEqual('N/A'); // hard coded + expect(ci.tag).toEqual(['tag1', 'tag2']); expect(ci.sha).toEqual('sha'); expect(ci.branch).toEqual('master'); expect(ci.name).toEqual('a/b'); From 12b928d9d5e648204f205e0ff0340e8880ea326d Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 15:06:11 -0500 Subject: [PATCH 14/25] insert missing comma --- spec/unit/screenshoter.unit.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/screenshoter.unit.spec.js b/spec/unit/screenshoter.unit.spec.js index 1c30f55..01a6400 100644 --- a/spec/unit/screenshoter.unit.spec.js +++ b/spec/unit/screenshoter.unit.spec.js @@ -232,7 +232,7 @@ describe("Screenshoter unit", function() { BUILD_BUILDID: '1234', BUILD_SOURCEBRANCHNAME: 'master', BUILD_SOURCEVERSION: 'sha', - BUILD_TAGS: ['tag1', 'tag2'] + BUILD_TAGS: ['tag1', 'tag2'], BUILD_DEFINITIONNAME: 'a/b', BUILD_SOURCEVERSIONMESSAGE: 'commit', SYSTEM_TEAMFOUNDATIONSERVERURI: 'https://www.visualstudio.com/tfs/', From 4e42a13e55d4f2b5c92b023c1cf347598ef3b71f Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 15:14:01 -0500 Subject: [PATCH 15/25] added back for good --- .../protractor-config/ci-variables-tfs.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 spec/integrational/protractor-config/ci-variables-tfs.js diff --git a/spec/integrational/protractor-config/ci-variables-tfs.js b/spec/integrational/protractor-config/ci-variables-tfs.js new file mode 100644 index 0000000..3cdeeb9 --- /dev/null +++ b/spec/integrational/protractor-config/ci-variables-tfs.js @@ -0,0 +1,16 @@ +var env = require('../environment'); + +exports.config = { + seleniumAddress: env.seleniumAddress, + framework: 'jasmine2', + specs: ['../protractor/angularjs-homepage-test.js'], + plugins: [{ + path: '../../../index.js', + screenshotPath: '.tmp/ci-variables-tfs', + writeReportFreq: 'asap', + clearFoldersBeforeTest: true + }], + capabilities: { + 'browserName': env.capabilities.browserName + } +}; From 85843164f73f4f4e2b3f641744d181ce17b8fc54 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 15:20:42 -0500 Subject: [PATCH 16/25] Create ci-variables-tfs.js --- .../protractor/.tmp/ci-variables-tfs.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 spec/integrational/protractor/.tmp/ci-variables-tfs.js diff --git a/spec/integrational/protractor/.tmp/ci-variables-tfs.js b/spec/integrational/protractor/.tmp/ci-variables-tfs.js new file mode 100644 index 0000000..e72613f --- /dev/null +++ b/spec/integrational/protractor/.tmp/ci-variables-tfs.js @@ -0,0 +1,12 @@ +process.env["TF_BUILD"] = true; +process.env["BUILD_BUILDNUMBER"] = '1.0.286408'; +process.env["BUILD_BUILDID"] = '286408'; +process.env["BUILD_SOURCEBRANCHNAME"] = 'master'; +process.env["BUILD_SOURCEVERSION"] = 'sha'; +process.env["BUILD_DEFINITIONNAME"] = 'a/b'; +process.env["BUILD_SOURCEVERSIONMESSAGE"] = 'commit'; +process.env["SYSTEM_TEAMFOUNDATIONSERVERURI"] = 'http://tfsServer:8080/tfs/Collection/'; +process.env["SYSTEM_TEAMPROJECT"] = 'MyProjectName'; +process.env["BUILD_TAGS"] = ["tag1, tag2"]; + +require("../angularjs-homepage-simple-failure-test.js"); From b40aed2ecc1ac7c5c23ef03d023c96117763be4d Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 15:22:12 -0500 Subject: [PATCH 17/25] Create ci-variables-tfs.js --- spec/integrational/protractor/ci-variables-tfs.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 spec/integrational/protractor/ci-variables-tfs.js diff --git a/spec/integrational/protractor/ci-variables-tfs.js b/spec/integrational/protractor/ci-variables-tfs.js new file mode 100644 index 0000000..e72613f --- /dev/null +++ b/spec/integrational/protractor/ci-variables-tfs.js @@ -0,0 +1,12 @@ +process.env["TF_BUILD"] = true; +process.env["BUILD_BUILDNUMBER"] = '1.0.286408'; +process.env["BUILD_BUILDID"] = '286408'; +process.env["BUILD_SOURCEBRANCHNAME"] = 'master'; +process.env["BUILD_SOURCEVERSION"] = 'sha'; +process.env["BUILD_DEFINITIONNAME"] = 'a/b'; +process.env["BUILD_SOURCEVERSIONMESSAGE"] = 'commit'; +process.env["SYSTEM_TEAMFOUNDATIONSERVERURI"] = 'http://tfsServer:8080/tfs/Collection/'; +process.env["SYSTEM_TEAMPROJECT"] = 'MyProjectName'; +process.env["BUILD_TAGS"] = ["tag1, tag2"]; + +require("../angularjs-homepage-simple-failure-test.js"); From 8e40af093ba6f58bfcdb4ba1d4c03914372d1442 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 15:22:41 -0500 Subject: [PATCH 18/25] Delete file --- .../protractor/.tmp/ci-variables-tfs.js | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 spec/integrational/protractor/.tmp/ci-variables-tfs.js diff --git a/spec/integrational/protractor/.tmp/ci-variables-tfs.js b/spec/integrational/protractor/.tmp/ci-variables-tfs.js deleted file mode 100644 index e72613f..0000000 --- a/spec/integrational/protractor/.tmp/ci-variables-tfs.js +++ /dev/null @@ -1,12 +0,0 @@ -process.env["TF_BUILD"] = true; -process.env["BUILD_BUILDNUMBER"] = '1.0.286408'; -process.env["BUILD_BUILDID"] = '286408'; -process.env["BUILD_SOURCEBRANCHNAME"] = 'master'; -process.env["BUILD_SOURCEVERSION"] = 'sha'; -process.env["BUILD_DEFINITIONNAME"] = 'a/b'; -process.env["BUILD_SOURCEVERSIONMESSAGE"] = 'commit'; -process.env["SYSTEM_TEAMFOUNDATIONSERVERURI"] = 'http://tfsServer:8080/tfs/Collection/'; -process.env["SYSTEM_TEAMPROJECT"] = 'MyProjectName'; -process.env["BUILD_TAGS"] = ["tag1, tag2"]; - -require("../angularjs-homepage-simple-failure-test.js"); From 849ba51c23328343f59a6184faddf38b912d94c9 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 15:23:16 -0500 Subject: [PATCH 19/25] fix path to referenced test --- spec/integrational/protractor/ci-variables-tfs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integrational/protractor/ci-variables-tfs.js b/spec/integrational/protractor/ci-variables-tfs.js index e72613f..5718d15 100644 --- a/spec/integrational/protractor/ci-variables-tfs.js +++ b/spec/integrational/protractor/ci-variables-tfs.js @@ -9,4 +9,4 @@ process.env["SYSTEM_TEAMFOUNDATIONSERVERURI"] = 'http://tfsServer:8080/tfs/Colle process.env["SYSTEM_TEAMPROJECT"] = 'MyProjectName'; process.env["BUILD_TAGS"] = ["tag1, tag2"]; -require("../angularjs-homepage-simple-failure-test.js"); +require("./angularjs-homepage-simple-failure-test.js"); From cf7634e5f07e75f7418738122569d407a7f08f13 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 15:24:53 -0500 Subject: [PATCH 20/25] renamed test --- .../protractor/{ci-variables-tfs.js => ci-variables-tfs-test.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename spec/integrational/protractor/{ci-variables-tfs.js => ci-variables-tfs-test.js} (100%) diff --git a/spec/integrational/protractor/ci-variables-tfs.js b/spec/integrational/protractor/ci-variables-tfs-test.js similarity index 100% rename from spec/integrational/protractor/ci-variables-tfs.js rename to spec/integrational/protractor/ci-variables-tfs-test.js From e98eb6d016a8c86176c05835de6d85d6f8e878b2 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 15:25:20 -0500 Subject: [PATCH 21/25] updated spec array --- spec/integrational/protractor-config/ci-variables-tfs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integrational/protractor-config/ci-variables-tfs.js b/spec/integrational/protractor-config/ci-variables-tfs.js index 3cdeeb9..26fdcf2 100644 --- a/spec/integrational/protractor-config/ci-variables-tfs.js +++ b/spec/integrational/protractor-config/ci-variables-tfs.js @@ -3,7 +3,7 @@ var env = require('../environment'); exports.config = { seleniumAddress: env.seleniumAddress, framework: 'jasmine2', - specs: ['../protractor/angularjs-homepage-test.js'], + specs: ['../protractor/ci-variables-tfs-test.js'], plugins: [{ path: '../../../index.js', screenshotPath: '.tmp/ci-variables-tfs', From a44aef7f4999acd94469bc5633bc29f5e08f9ad3 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 15:35:40 -0500 Subject: [PATCH 22/25] added tfs ci variables test --- spec/integrational/screenshoter.int.spec.js | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/spec/integrational/screenshoter.int.spec.js b/spec/integrational/screenshoter.int.spec.js index 03f5c8c..2c635ae 100644 --- a/spec/integrational/screenshoter.int.spec.js +++ b/spec/integrational/screenshoter.int.spec.js @@ -1523,6 +1523,32 @@ describe("Screenshoter running under protractor", function() { done(); }); }); + + }); + + describe("tfs ci variables on report", function() { + beforeAll(function() { + runProtractorWithConfig('ci-variables-tfs.js'); + }); + + it("should generate report.js with tfs ci variables", function(done) { + fs.readFile('./tmp/ci-variables-tfs/report.js', 'utf8', function(err, data) { + if (err) { + return done.fail(err); + } + expect(data).toContain("angular.module('reporter').constant('data'"); + var report = getReportAsJson(data); + expect(report.ci).toBeDefined(); + expect(report.ci.build).toBe('1.0.286408'); + expect(report.ci.tag).toEqual(['tag1', 'tag2']); + expect(report.ci.sha).toBe('sha'); + expect(report.ci.branch).toBe('master'); + expect(report.ci.name).toBe('a/b'); + expect(report.ci.commit).toBe('commit'); + expect(report.ci.url).toBeDefined(); + }); + }); + }); From a1f5aaf2f53b5faad37d74302ccdfbdcd7afd196 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 15:36:36 -0500 Subject: [PATCH 23/25] Update screenshoter.int.spec.js --- spec/integrational/screenshoter.int.spec.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/integrational/screenshoter.int.spec.js b/spec/integrational/screenshoter.int.spec.js index 2c635ae..b17ca76 100644 --- a/spec/integrational/screenshoter.int.spec.js +++ b/spec/integrational/screenshoter.int.spec.js @@ -1523,7 +1523,6 @@ describe("Screenshoter running under protractor", function() { done(); }); }); - }); describe("tfs ci variables on report", function() { @@ -1548,7 +1547,6 @@ describe("Screenshoter running under protractor", function() { expect(report.ci.commit).toBe('commit'); expect(report.ci.url).toBeDefined(); }); - }); }); From 1fcfe365ad5f30815e3a3199569984ba00723af1 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 15:45:53 -0500 Subject: [PATCH 24/25] fix braces --- spec/integrational/screenshoter.int.spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/integrational/screenshoter.int.spec.js b/spec/integrational/screenshoter.int.spec.js index b17ca76..42ff6dd 100644 --- a/spec/integrational/screenshoter.int.spec.js +++ b/spec/integrational/screenshoter.int.spec.js @@ -1330,7 +1330,6 @@ describe("Screenshoter running under protractor", function() { done(); }); }); - }); describe("pause on spec", function() { @@ -1359,7 +1358,6 @@ describe("Screenshoter running under protractor", function() { done(); }); }); - }); describe("suitesConsoleErrors", function() { @@ -1546,6 +1544,7 @@ describe("Screenshoter running under protractor", function() { expect(report.ci.name).toBe('a/b'); expect(report.ci.commit).toBe('commit'); expect(report.ci.url).toBeDefined(); + }); }); }); From bf14f330cdb29cae5f438b3091522d7b48d53257 Mon Sep 17 00:00:00 2001 From: formarfr Date: Fri, 1 Jun 2018 16:10:16 -0500 Subject: [PATCH 25/25] took out cleaning folder before test --- spec/integrational/protractor-config/ci-variables-tfs.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/integrational/protractor-config/ci-variables-tfs.js b/spec/integrational/protractor-config/ci-variables-tfs.js index 26fdcf2..af53fbc 100644 --- a/spec/integrational/protractor-config/ci-variables-tfs.js +++ b/spec/integrational/protractor-config/ci-variables-tfs.js @@ -7,8 +7,7 @@ exports.config = { plugins: [{ path: '../../../index.js', screenshotPath: '.tmp/ci-variables-tfs', - writeReportFreq: 'asap', - clearFoldersBeforeTest: true + writeReportFreq: 'asap' }], capabilities: { 'browserName': env.capabilities.browserName