This repository has been 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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugins): add postTest hook for plugins
Additionally, add some tests to make sure that plugins can fail properly. Closes #1842
- Loading branch information
Showing
11 changed files
with
176 additions
and
18 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
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
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
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
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,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 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 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 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 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 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 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