This repository was archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(plugins): add postTest hook for plugins #1859
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,30 @@ | ||
| var env = require('../environment.js'); | ||
|
|
||
| // A small suite to make sure the full functionality of plugins work | ||
| exports.config = { | ||
| // seleniumAddress: env.seleniumAddress, | ||
| mockSelenium: true, | ||
|
|
||
| framework: 'jasmine2', | ||
|
|
||
| // Spec patterns are relative to this directory. | ||
| specs: [ | ||
| '../plugins/fail_spec.js' | ||
| ], | ||
|
|
||
| capabilities: env.capabilities, | ||
|
|
||
| baseUrl: env.baseUrl, | ||
|
|
||
| jasmineNodeOpts: { | ||
| isVerbose: true, | ||
| realtimeFailure: true | ||
| }, | ||
|
|
||
| // Plugin patterns are relative to this directory. | ||
| plugins: [{ | ||
| path: '../plugins/basic_plugin.js' | ||
| }, { | ||
| path: '../plugins/failing_plugin.js' | ||
| }] | ||
| }; |
This file contains hidden or 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
This file contains hidden or 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,9 @@ | ||
| describe('check if plugin setup ran', function() { | ||
| it('should have set protractor.__BASIC_PLUGIN_RAN', function() { | ||
| expect(protractor.__BASIC_PLUGIN_RAN).toBe(true); | ||
| }); | ||
|
|
||
| it('should run multiple tests which fail', function() { | ||
| expect(true).toBe(false); | ||
| }); | ||
| }); |
This file contains hidden or 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,39 @@ | ||
| var q = require('q'); | ||
|
|
||
| var failingResult = function(message) { | ||
| return { | ||
| failedCount: 1, | ||
| specResults: [{ | ||
| description: 'plugin test which fails', | ||
| assertions: [{ | ||
| passed: false, | ||
| errorMsg: message, | ||
| }], | ||
| duration: 4 | ||
| }] | ||
| }; | ||
| }; | ||
|
|
||
| module.exports = { | ||
| setup: function() { | ||
| return q.delay(100).then(function() { | ||
| return failingResult('from setup'); | ||
| }); | ||
| }, | ||
|
|
||
| teardown: function() { | ||
| return q.delay(100).then(function() { | ||
| return failingResult('from teardown'); | ||
| }); | ||
| }, | ||
|
|
||
| postResults: function() { | ||
| // This function should cause no failures. | ||
| }, | ||
|
|
||
| postTest: function(config, passed) { | ||
| return q.delay(100).then(function() { | ||
| return failingResult('from postTest ' + (passed ? 'passing' : 'failing')); | ||
| }); | ||
| } | ||
| }; |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,12 +1,34 @@ | ||
| var q = require('q'); | ||
|
|
||
| var passingResult = { | ||
| failedCount: 0, | ||
| specResults: [{ | ||
| description: 'plugin test which passes', | ||
| assertions: [], | ||
| duration: 4 | ||
| }] | ||
| }; | ||
|
|
||
| module.exports = { | ||
| setup: function() { | ||
| return q.delay(100).then(function() { | ||
| return passingResult; | ||
| }); | ||
| }, | ||
|
|
||
| teardown: function() { | ||
| return { | ||
| failedCount: 0, | ||
| specResults: [{ | ||
| description: 'This succeeds', | ||
| assertions: [], | ||
| duration: 1 | ||
| }] | ||
| }; | ||
| return q.delay(100).then(function() { | ||
| return passingResult; | ||
| }); | ||
| }, | ||
|
|
||
| postResults: function() { | ||
| // This function should cause no failures. | ||
| }, | ||
|
|
||
| postTest: function() { | ||
| return q.delay(100).then(function() { | ||
| return passingResult; | ||
| }); | ||
| } | ||
| }; |
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thee word "test" seems ambiguous. Is this after each
it(),assert(), ordescribe()?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
each
it()(in Jasmine) - another option would bespec. Preference?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please update the comment on line 17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already use
specto refer to the whole file.testcasemight make sense?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated comments.