Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
chore(jasmine): remove jasmine 1.3
Browse files Browse the repository at this point in the history
and update docs. Also, use jasmine 2 for running all Protractor's unit tests.

BREAKING CHANGE:
Now, both jasmine and jasmine2 frameworks use jasmine 2.3. Users still using
jasmine version <2 will have to upgrade.
  • Loading branch information
hankduan committed Nov 3, 2015
1 parent 31d1b72 commit 2bde92b
Show file tree
Hide file tree
Showing 73 changed files with 177 additions and 380 deletions.
7 changes: 2 additions & 5 deletions debugging/failureConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ exports.config = {

baseUrl: env.baseUrl,

// ----- Options to be passed to minijasminenode.
// ----- Options to be passed to jasmine.
jasmineNodeOpts: {
onComplete: null,
isVerbose: false,
showColors: true,
includeStackTrace: true
showColors: true
}
};
7 changes: 2 additions & 5 deletions debugging/timeoutConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ exports.config = {

baseUrl: env.baseUrl,

// ----- Options to be passed to minijasminenode.
// ----- Options to be passed to jasmine.
jasmineNodeOpts: {
onComplete: null,
isVerbose: false,
showColors: true,
includeStackTrace: true
showColors: true
}
};
5 changes: 2 additions & 3 deletions docs/control-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ The WebDriver Control Flow

The [WebDriverJS API](https://github.com/SeleniumHQ/selenium/wiki/WebDriverJs#understanding_the_api) is based on [promises](https://github.com/SeleniumHQ/selenium/wiki/WebDriverJs#promises),
which are managed by a [control flow](https://github.com/SeleniumHQ/selenium/wiki/WebDriverJs#control-flows)
and adapted for [Jasmine](http://jasmine.github.io/1.3/introduction.html).
and adapted for [Jasmine](http://jasmine.github.io/2.3/introduction.html).
A short summary about how Protractor interacts with the control flow is presented below.


Expand Down Expand Up @@ -42,8 +42,7 @@ Protractor Adaptations
----------------------

Protractor adapts Jasmine so that each spec automatically waits until the
control flow is empty before exiting. This means you don't need to worry
about calling runs() and waitsFor() blocks.
control flow is empty before exiting.

Jasmine expectations are also adapted to understand promises. That's why this
line works - the code actually adds an expectation task to the control flow,
Expand Down
26 changes: 2 additions & 24 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,7 @@ The method to take a screenshot automatically on failure would depend on the typ
* For failures of entire specs (such as timeout or an expectation within the spec failed), you can add a reporter as below:

```javascript
// Note: this is using Jasmine 1.3 reporter syntax.
jasmine.getEnv().addReporter(new function() {
this.reportSpecResults = function(spec) {
if (!spec.results().passed()) {
//take screenshot
}
};
});
```

```javascript
// Note: this is using Jasmine 2.1 reporter syntax.
// Note: this is using Jasmine 2 reporter syntax.
jasmine.getEnv().addReporter(new function() {
this.specDone = function(result) {
if (result.failedExpectations.length >0) {
Expand All @@ -131,18 +120,7 @@ Note, you can also choose to take a screenshot in `afterEach`. However, because
* For failures of individual expectations, you can override jasmine's addMatcherResult/addExpectationResult function as such:

```javascript
// Jasmine 1.3.
var originalAddMatcherResult = jasmine.Spec.prototype.addMatcherResult;
jasmine.Spec.prototype.addMatcherResult = function() {
if (!arguments[0].passed()) {
//take screenshot
}
return originalAddMatcherResult.apply(this, arguments);
};
```

```javascript
// Jasmine 2.1
// Jasmine 2
var originalAddExpectationResult = jasmine.Spec.prototype.addExpectationResult;
jasmine.Spec.prototype.addExpectationResult = function() {
if (!arguments[0]) {
Expand Down
4 changes: 2 additions & 2 deletions docs/frameworks.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Choosing a Framework
====================

Protractor supports four behavior driven development (BDD) test frameworks: Jasmine 1.3, Jasmine 2.0, Mocha, and Cucumber. These frameworks are based on JavaScript and Node.js and provide the syntax, scaffolding, and reporting tools you will use to write and manage your tests.
Protractor supports three behavior driven development (BDD) test frameworks: Jasmine, Mocha, and Cucumber. These frameworks are based on JavaScript and Node.js and provide the syntax, scaffolding, and reporting tools you will use to write and manage your tests.


Using Jasmine
-------------

Currently, Jasmine Versions 1.3 and 2.0 are supported. Jasmine 1.3 is the default test framework and is available for use when you install Protractor. However, we're in the process of upgrading to Jasmine 2.0, and will deprecate support for 1.3 in the future. For more information about Jasmine, see the [Jasmine GitHub site](http://jasmine.github.io/). For more information regarding how to upgrade to Jasmine 2.0 from 1.3, see the [Jasmine upgrade guide](/docs/jasmine-upgrade.md).
Currently, Jasmine Version 2.x is supported and the default test framework when you install Protractor. For more information about Jasmine, see the [Jasmine GitHub site](http://jasmine.github.io/). For more information regarding how to upgrade to Jasmine 2.x from 1.3, see the [Jasmine upgrade guide](/docs/jasmine-upgrade.md).


Using Mocha
Expand Down
4 changes: 2 additions & 2 deletions docs/jasmine-upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Specify that you want to use jasmine2.x:

```javascript
exports.config = {
// Specify you want to use jasmine 2.x as you would with mocha and cucumber.
framework: 'jasmine2'
// Specify you want to use jasmine 2.x as you would with mocha and cucumber. Note, 'jasmine' by default will use the latest jasmine framework.
framework: 'jasmine'
};

```
Expand Down
22 changes: 4 additions & 18 deletions docs/referenceConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ exports.config = {
// ---------------------------------------------------------------------------

// Test framework to use. This may be one of:
// jasmine, jasmine2, cucumber, mocha or custom.
// jasmine, cucumber, mocha or custom.
//
// When the framework is set to "custom" you'll need to additionally
// set frameworkPath with the path relative to the config file or absolute
Expand All @@ -271,26 +271,12 @@ exports.config = {
// See github.com/angular/protractor/blob/master/lib/frameworks/README.md
// to comply with the interface details of your custom implementation.
//
// Jasmine and Jasmine2 are fully supported as test and assertion frameworks.
// Jasmine is fully supported as test and assertion frameworks.
// Mocha and Cucumber have limited support. You will need to include your
// own assertion framework (such as Chai) if working with Mocha.
framework: 'jasmine2',
framework: 'jasmine',

// Options to be passed to minijasminenode.
//
// See the full list at https://github.com/juliemr/minijasminenode/tree/jasmine1
jasmineNodeOpts: {
// If true, display spec names.
isVerbose: false,
// If true, print colors to the terminal.
showColors: true,
// If true, include stack traces in failures.
includeStackTrace: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 30000
},

// Options to be passed to jasmine2.
// Options to be passed to jasmine.
//
// See https://github.com/jasmine/jasmine-npm/blob/master/lib/jasmine.js
// for the exact options available.
Expand Down
2 changes: 1 addition & 1 deletion docs/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ Reference
- [Timeouts](/docs/timeouts.md)
- [The WebDriver Control Flow](/docs/control-flow.md)
- [How It Works](/docs/infrastructure.md)
- [Upgrading to Jasmine 2.0](/docs/jasmine-upgrade.md)
- [Upgrading to Jasmine 2.x](/docs/jasmine-upgrade.md)
- [Mobile Setup](/docs/mobile-setup.md)
- [FAQ](/docs/faq.md)
8 changes: 4 additions & 4 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ Now create the configuration file. Copy the following into conf.js:
```js
// conf.js
exports.config = {
framework: 'jasmine2',
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']
}
```

This configuration tells Protractor where your test files (`specs`) are, and where to talk to your Selenium Server (`seleniumAddress`). It specifies that we will be using Jasmine version 2 for the test framework. It will use the defaults for all other configuration. Chrome is the default browser.
This configuration tells Protractor where your test files (`specs`) are, and where to talk to your Selenium Server (`seleniumAddress`). It specifies that we will be using Jasmine for the test framework. It will use the defaults for all other configuration. Chrome is the default browser.

Now run the test with

Expand Down Expand Up @@ -157,7 +157,7 @@ Now that we've written some basic tests, let's take a look at the configuration
```js
// conf.js
exports.config = {
framework: 'jasmine2',
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js'],
capabilities: {
Expand All @@ -173,7 +173,7 @@ You can also run tests on more than one browser at once. Change conf.js to:
```js
// conf.js
exports.config = {
framework: 'jasmine2',
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js'],
multiCapabilities: [{
Expand Down
2 changes: 1 addition & 1 deletion docs/webdriver-vs-protractor.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ adding chaining and utilities for dealing with lists. See
Jasmine Integration
-------------------

Protractor uses [`jasminewd`](https://github.com/angular/jasminewd), which
Protractor uses [`jasminewd2`](https://github.com/angular/jasminewd), which
wraps around jasmine's `expect` so that you can write:
```js
expect(el.getText()).toBe('Hello, World!')
Expand Down
4 changes: 2 additions & 2 deletions example/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ exports.config = {
'browserName': 'chrome'
},

// Framework to use. Jasmine 2 is recommended.
framework: 'jasmine2',
// Framework to use. Jasmine is recommended.
framework: 'jasmine',

// Spec patterns are relative to the current working directly when
// protractor is called.
Expand Down
2 changes: 0 additions & 2 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ var optimist = require('optimist').
alias('platform-version', 'capabilities.version').
alias('tags', 'capabilities.tags').
alias('build', 'capabilities.build').
alias('verbose', 'jasmineNodeOpts.isVerbose').
alias('stackTrace', 'jasmineNodeOpts.includeStackTrace').
alias('grep', 'jasmineNodeOpts.grep').
alias('invert-grep', 'jasmineNodeOpts.invertGrep').
alias('explorer', 'elementExplorer').
Expand Down
2 changes: 0 additions & 2 deletions lib/configParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ var ConfigParser = function() {
params: {},
framework: 'jasmine',
jasmineNodeOpts: {
isVerbose: false,
showColors: true,
includeStackTrace: true,
stackFilter: helper.filterStackTrace,
defaultTimeoutInterval: (30 * 1000)
},
Expand Down
2 changes: 1 addition & 1 deletion lib/frameworks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ to use your own framework via the config file:

```js
exports.config = {
// set to "custom" instead of jasmine/jasmine2/mocha/cucumber.
// set to "custom" instead of jasmine/mocha/cucumber.
framework: 'custom',
// path relative to the current config file
frameworkPath: './frameworks/my_custom_jasmine.js',
Expand Down
Loading

0 comments on commit 2bde92b

Please sign in to comment.