diff options
| -rw-r--r-- | Gruntfile.js | 4 | ||||
| -rw-r--r-- | docs/content/guide/expression.ngdoc | 4 | ||||
| -rw-r--r-- | docs/src/ngdoc.js | 19 | ||||
| -rwxr-xr-x | jenkins_build.sh | 12 | ||||
| -rw-r--r-- | lib/grunt/utils.js | 6 | ||||
| -rw-r--r-- | package.json | 4 | ||||
| -rw-r--r-- | protractor-jenkins-conf.js | 36 | ||||
| -rwxr-xr-x | scripts/travis/build.sh | 7 | ||||
| -rw-r--r-- | src/ng/directive/input.js | 8 | ||||
| -rw-r--r-- | src/ng/directive/ngInclude.js | 9 | ||||
| -rw-r--r-- | src/ng/filter/filters.js | 8 | ||||
| -rw-r--r-- | test/e2e/docsAppE2E.js | 1 | 
12 files changed, 99 insertions, 19 deletions
| diff --git a/Gruntfile.js b/Gruntfile.js index ff4db327..7f36395f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -91,7 +91,8 @@ module.exports = function(grunt) {      runprotractor: { -      normal: 'protractor-conf.js' +      normal: 'protractor-conf.js', +      jenkins: 'protractor-jenkins-conf.js'      }, @@ -291,6 +292,7 @@ module.exports = function(grunt) {    grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']);    grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['tests:jqlite', 'tests:jquery', 'tests:modules']);    grunt.registerTask('test:protractor', 'Run the end to end tests with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'runprotractor:normal']); +  grunt.registerTask('test:ci-protractor', 'Run the end to end tests with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'runprotractor:jenkins']);    grunt.registerTask('test:e2e', 'Alias for test:protractor', ['test:protractor']);    grunt.registerTask('test:docgen', ['jasmine_node']);    grunt.registerTask('test:promises-aplus',['build:promises-aplus-adapter','shell:promises-aplus-tests']); diff --git a/docs/content/guide/expression.ngdoc b/docs/content/guide/expression.ngdoc index f1e2735b..99cc7514 100644 --- a/docs/content/guide/expression.ngdoc +++ b/docs/content/guide/expression.ngdoc @@ -110,6 +110,10 @@ prevent accidental access to the global state (a common source of subtle bugs).  </doc:source>  <doc:protractor>    it('should calculate expression in binding', function() { +    if (browser.params.browser = 'safari') { +      // Safari can't handle dialogs. +      return; +    };      element(by.css('[ng-click="greet()"]')).click();      var alertDialog = browser.switchTo().alert(); diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 970f5c56..1e8896d0 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -1113,14 +1113,25 @@ function scenarios(docs){  function writeProtractorTest(doc){    var lines = [];    lines.push('describe("' + doc.section + '/' + doc.id + '", function() {'); -  lines.push('  beforeEach(function() {'); -  lines.push('    browser.get("index-nocache.html#!/' + doc.section + '/' + doc.id + '");'); -  lines.push('  });'); +  lines.push('  describe("angular+jqLite", function() {') +  lines.push('    beforeEach(function() {'); +  lines.push('      browser.get("index-nocache.html#!/' + doc.section + '/' + doc.id + '");'); +  lines.push('    });');    lines.push('');    doc.protractorTests.forEach(function(test){ -    lines.push(indentCode(trim(test), 2)); +    lines.push(indentCode(trim(test), 4)); +    lines.push(''); +  }); +  lines.push('  });'); +  lines.push('  describe("angular+jQuery", function() {') +  lines.push('    beforeEach(function() {'); +  lines.push('      browser.get("index-jq-nocache.html#!/' + doc.section + '/' + doc.id + '");'); +  lines.push('    });'); +  doc.protractorTests.forEach(function(test){ +    lines.push(indentCode(trim(test), 4));      lines.push('');    }); +  lines.push('  });');    lines.push('});');    lines.push('');    return lines.join('\n'); diff --git a/jenkins_build.sh b/jenkins_build.sh index 17610a92..bacac5e7 100755 --- a/jenkins_build.sh +++ b/jenkins_build.sh @@ -13,12 +13,6 @@ then    BROWSERS="Chrome,Firefox,Opera,/Users/jenkins/bin/safari.sh,/Users/jenkins/bin/ie8.sh,/Users/jenkins/bin/ie9.sh"  fi -if [[ -z "$BROWSERS_E2E" ]] -then -  BROWSERS_E2E="Chrome,Firefox,/Users/jenkins/bin/safari.sh" -fi - -  # CLEAN #  rm -f angular.min.js.gzip.size  rm -f angular.js.size @@ -28,6 +22,8 @@ rm -f angular.js.size  npm install --color false  grunt ci-checks package --no-color +mkdir test_out +  # DOCS generator unit tests #  grunt test:docgen --no-color @@ -35,7 +31,9 @@ grunt test:docgen --no-color  grunt test:unit --browsers $BROWSERS --reporters=dots,junit --no-colors --no-color  # END TO END TESTS # -grunt test:protractor +grunt test:ci-protractor +grunt test:ci-protractor --browser safari +grunt test:ci-protractor --browser firefox  # Promises/A+ TESTS #  grunt test:promises-aplus --no-color diff --git a/lib/grunt/utils.js b/lib/grunt/utils.js index 311bbef2..a3a7e7b2 100644 --- a/lib/grunt/utils.js +++ b/lib/grunt/utils.js @@ -141,6 +141,7 @@ module.exports = {        // Skip the webdriver-manager update on Travis, since the browsers will        // be provided remotely.        done(); +      return;      }      var p = spawn('node', ['node_modules/protractor/bin/webdriver-manager', 'update']);      p.stdout.pipe(process.stdout); @@ -156,11 +157,16 @@ module.exports = {      var sauceKey = grunt.option('sauceKey');      var tunnelIdentifier = grunt.option('capabilities.tunnel-identifier');      var sauceBuild = grunt.option('capabilities.build'); +    var browser = grunt.option('browser');      var args = ['node_modules/protractor/bin/protractor', config];      if (sauceUser) args.push('--sauceUser=' + sauceUser);      if (sauceKey) args.push('--sauceKey=' + sauceKey);      if (tunnelIdentifier) args.push('--capabilities.tunnel-identifier=' + tunnelIdentifier);      if (sauceBuild) args.push('--capabilities.build=' + sauceBuild); +    if (browser) { +      args.push('--browser=' + browser); +      args.push('--params.browser=' + browser); +    }      var p = spawn('node', args); diff --git a/package.json b/package.json index e7283aa8..51c4c06a 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,9 @@      "promises-aplus-tests": "~1.3.2",      "semver": "~2.1.0",      "lodash": "~2.1.0", -    "browserstacktunnel-wrapper": "~1.1.1" +    "browserstacktunnel-wrapper": "~1.1.1", +    "grunt-jscs-checker": "~0.3.2", +    "jasmine-reporters": "~0.2.1"    },    "licenses": [      { diff --git a/protractor-jenkins-conf.js b/protractor-jenkins-conf.js new file mode 100644 index 00000000..a2491474 --- /dev/null +++ b/protractor-jenkins-conf.js @@ -0,0 +1,36 @@ +exports.config = { +  allScriptsTimeout: 11000, + +  specs: [ +    'build/docs/ptore2e/**/*.js', +    'test/e2e/docsAppE2E.js' +  ], + +  capabilities: { +    'browserName': 'chrome' +  }, + +  baseUrl: 'http://localhost:8000/build/docs/', + +  framework: 'jasmine', + +  onPrepare: function() { +    // Disable animations so e2e tests run more quickly +    var disableNgAnimate = function() { +      angular.module('disableNgAnimate', []).run(function($animate) { +        $animate.enabled(false); +      }); +    }; + +    browser.addMockModule('disableNgAnimate', disableNgAnimate); + +    require('jasmine-reporters'); +    jasmine.getEnv().addReporter( +      new jasmine.JUnitXmlReporter('test_out/e2e-' + this.capabilities.browserName + '-', true, true)); +  }, + +  jasmineNodeOpts: { +    defaultTimeoutInterval: 30000, +    showColors: false +  } +}; diff --git a/scripts/travis/build.sh b/scripts/travis/build.sh index 32cd8af8..b28b8e02 100755 --- a/scripts/travis/build.sh +++ b/scripts/travis/build.sh @@ -10,10 +10,13 @@ if [ $JOB = "unit" ]; then    grunt test:promises-aplus    grunt test:unit --browsers SL_Chrome,SL_Safari,SL_Firefox,SL_IE_8,SL_IE_9,SL_IE_10,SL_IE_11 --reporters dots  elif [ $JOB = "e2e" ]; then -  grunt test:protractor --sauceUser $SAUCE_USERNAME \ +  export SAUCE_OPTIONS="--sauceUser $SAUCE_USERNAME \        --sauceKey $SAUCE_ACCESS_KEY \        --capabilities.tunnel-identifier=$TRAVIS_JOB_NUMBER \ -      --capabilities.build=$TRAVIS_BUILD_NUMBER +      --capabilities.build=$TRAVIS_BUILD_NUMBER" +  grunt test:protractor $SAUCE_OPTIONS +  grunt test:protractor $SAUCE_OPTIONS --browser=firefox +  grunt test:protractor $SAUCE_OPTIONS --browser=safari  else    echo "Unknown job type. Please set JOB=unit or JOB=e2e."  fi diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index 85d0f22d..27813a46 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -955,11 +955,17 @@ var VALID_CLASS = 'ng-valid',      </file>      <file name="protractorTest.js">        it('should data-bind and become invalid', function() { +        if (browser.params.browser = 'safari') { +          // SafariDriver can't handle contenteditable. +          return; +        };          var contentEditable = element(by.css('.doc-example-live [contenteditable]'));          expect(contentEditable.getText()).toEqual('Change me!'); -        contentEditable.clear(); +        // Firefox driver doesn't trigger the proper events on 'clear', so do this hack +        contentEditable.click(); +        contentEditable.sendKeys(protractor.Key.chord(protractor.Key.COMMAND, "a"));          contentEditable.sendKeys(protractor.Key.BACK_SPACE);          expect(contentEditable.getText()).toEqual(''); diff --git a/src/ng/directive/ngInclude.js b/src/ng/directive/ngInclude.js index 4935edd4..b559b576 100644 --- a/src/ng/directive/ngInclude.js +++ b/src/ng/directive/ngInclude.js @@ -119,12 +119,21 @@        });        it('should load template2.html', function() { +        if (browser.params.browser == 'firefox') { +          // Firefox can't handle using selects +          // See https://github.com/angular/protractor/issues/480 +          return; +        }          templateSelect.click();          templateSelect.element.all(by.css('option')).get(2).click();          expect(includeElem.getText()).toMatch(/Content of template2.html/);        });        it('should change to blank', function() { +        if (browser.params.browser == 'firefox') { +          // Firefox can't handle using selects +          return; +        }          templateSelect.click();          templateSelect.element.all(by.css('option')).get(0).click();          expect(includeElem.isPresent()).toBe(false); diff --git a/src/ng/filter/filters.js b/src/ng/filter/filters.js index 63ea270c..f655c7a6 100644 --- a/src/ng/filter/filters.js +++ b/src/ng/filter/filters.js @@ -34,9 +34,13 @@           expect(element(by.binding('amount | currency:"USD$"')).getText()).toBe('USD$1,234.56');         });         it('should update', function() { +         if (browser.params.browser == 'safari') { +           // Safari does not understand the minus key. See +           // https://github.com/angular/protractor/issues/481 +           return; +         }           element(by.model('amount')).clear(); -         element(by.model('amount')).sendKeys('-1234'); -         expect(element(by.id('currency-default')).getText()).toBe('($1,234.00)'); +         element(by.model('amount')).sendKeys('-1234');         expect(element(by.id('currency-default')).getText()).toBe('($1,234.00)');           expect(element(by.binding('amount | currency:"USD$"')).getText()).toBe('(USD$1,234.00)');         });       </doc:protractor> diff --git a/test/e2e/docsAppE2E.js b/test/e2e/docsAppE2E.js index f92d834e..625e384c 100644 --- a/test/e2e/docsAppE2E.js +++ b/test/e2e/docsAppE2E.js @@ -30,7 +30,6 @@ describe('docs.angularjs.org', function () {        browser.sleep(500);        var nameInput = element(by.input('user.name')); -      nameInput.click();        nameInput.sendKeys('!!!');        var code = element(by.css('.doc-example-live tt')); | 
