E2E test framework for Angular apps

Overview

Protractor Build Status CircleCI Status Join the chat at https://gitter.im/angular/protractor

Protractor is an end-to-end test framework for Angular and AngularJS applications. Protractor is a Node.js program built on top of WebDriverJS. Protractor runs tests against your application running in a real browser, interacting with it as a user would.

Compatibility

Protractor 5 is compatible with Nodejs v6 and v8 only.

Protractor 6 has been deprecated.

Protractor 7 is compatible with Nodejs v10, v12, and newer.

Protractor works with AngularJS versions greater than 1.0.6/1.1.4, and is compatible with Angular applications. Note that for Angular apps, the binding and model locators are not supported. We recommend using by.css.

Getting Started

See the Protractor Website for most documentation.

To get set up and running quickly:

Once you are familiar with the tutorial, you’re ready to move on. To modify your environment, see the Protractor Setup docs. To start writing tests, see the Protractor Tests docs.

To better understand how Protractor works with the Selenium WebDriver and Selenium Server see the reference materials.

Getting Help

Check the Protractor FAQ and read through the Top 20 questions on StackOverflow.

Please ask usage and debugging questions on StackOverflow (use the "protractor" tag), the Gitter chat room, or in the Angular discussion group. (Please do not ask support questions here on Github.)

For Contributors

See DEVELOPER.md

Comments
  • Cucumber-JS stops on failure

    Cucumber-JS stops on failure

    Since 0.23.0, Cucumber-JS stops after a failing step in Protractor. Before 0.23.0 it continues executing other scenario's and reporting the final results. This appears to be a bug in Protractor.

    0.23.0:

    Feature: some feature
    
      Scenario: some scenario
       When some step
       Then some FAILURE
    

    before:

    Feature: some feature
    
      Scenario: some scenario
       When some step
       Then some FAILURE
    
      Scenario: other scenario
        When ...
    
    xx scenarios (1 failed)
    xx steps (1 failed, xx passed)
    
    PRs plz! 
    opened by stejanse 89
  • Future of Angular E2E & Plans for Protractor

    Future of Angular E2E & Plans for Protractor

    TLDR

    The Angular team plans to end development of Protractor at the end of 2022 (in conjunction with Angular v15).

    Why?

    Protractor was created in 2013 when WebDriver APIs were not yet a standard and end-to-end (e2e) tests were hard to write due to lack of support for async / await. To solve this problem, Protractor wraps selenium-webdriver and abstracted asynchronous operations from developers with the use of Control Flow.

    Since then, the JavaScript standard and ecosystem advanced considerably, providing modern syntax and much better development tools. Nonetheless, Protractor is not able to leverage such technology without forcing users to rewrite their tests. Meanwhile, robust alternatives have emerged in the web testing space. Developers will see more benefits from adopting a more modern testing tool than from updating to a breaking version of Protractor which does not provide additional functionality or developer ergonomic improvements.

    We would like to hear from the community on

    • the deprecation timeline
    • what we can do to provide reliable integration with third-party solutions
    • how users can transition by following migration guidelines
    • additional concerns that would ensure a smooth transition

    This RFC will close on Friday April 16, 2021.


    State of Protractor

    The Angular team created Protractor in 2013 when WebDriver APIs were not yet a standard and end-to-end (e2e) tests were challenging to set up. The proliferation of callback patterns in JavaScript back then made asynchronous operations difficult to write and manage.

    Protractor, echoing the approach taken by the underlying selenium-webdriver, solved this problem by managing promises via Control Flow. Control Flow makes asynchronous calls appear synchronous, thereby avoids the use of Promises entirely.

    This strategy worked well for some time, but as the JavaScript standards and toolings evolve, Protractor regressed. Starting from ES2017, async / await makes handling Promises significantly easier because they no longer have to be chained. However, async / await is fundamentally incompatible with Control Flow, and support for Control Flow is dropped from selenium-webdriver v4.0 completely. Protractor, being dependent on selenium-webdriver, is not able to upgrade to the new version without introducing a huge breaking change and forcing users to do a migration for all their tests.

    Besides dropping support for Control Flow, making Protractor compatible with ES2017 involves a significant amount of work to overhaul its implementation. Legacy dependencies such as jasminewd2 and Q promise library ought to be removed, which will bring about further breaking changes.

    Since Protractor was initially designed to support AngularJS, many of its features like locators and mock modules are specific to AngularJS. These features only work in AngularJS and not Angular. They will no longer be relevant once development on AngularJS ceases by December 31, 2021.

    Removing Control Flow and dropping AngularJS-specific features would make Protractor essentially just a wrapper around selenium-webdriver that provides no additional functionality.

    Current Landscape for Web Testing

    Many testing solutions have appeared since the creation of Protractor, and they offer better stability and much improved support for features like cross-browsers testing. Some even eschew the WebDriver standards completely in favor of using the DevTools protocols directly.

    In order to understand the adoption trend of these alternatives in the Angular community, we conducted a survey on e2e testing in January 2021. We received close to 1000 responses and got a lot of feedback from the community. A clear signal that we received is that there is no one-size-fits-all solution for all Angular projects out there. Fewer than 20% of the respondents use Protractor in their project. Some users prioritize the cross-browsers support that the WebDriver standards guarantee, whereas other users prefer the stability and flexibility that DevTools protocol offers. A similar survey focused entirely on enterprise customers yielded comparable results.

    Screen Shot 2021-03-24 at 6 31 33 PM

    Moving Forward

    Deprecating Protractor is not a decision that is taken lightly by the team. Inside Google, we support thousands of projects and hundreds of thousands of test targets that depend on Protractor. After evaluating the costs and benefits of updating Protractor vs migration effort imposed on users, we conclude that the best strategy to set users up for success in the long term is to encourage migration to a more modern and framework-agnostic testing platform. The reasoning is as follows:

    Removing Control Flow from user code is a gigantic effort because it forces users to update all their tests. Google went through this effort, and it took a major infrastructure team half of their time in 2018. Even then, they could only migrate tests written in TypeScript due to the availability of more robust tooling for source code analysis and transformation.

    After going through such a massive endeavour, we realize the “new” Protractor is no better than other existing solutions. The only feature that differentiates Protractor from selenium-webdriver at this point is the ability to automatically wait for the application under test to become stable (waitForAngular feature in Protractor).

    Although waitForAngular is useful, it strongly couples the testing platform to the Angular framework. Some teams at Google have found that solutions that do not require knowledge of Angular can perform the tests equally well by using a robust retry strategy. We believe this is how e2e testing should be done going forward, and projects in Google are already converging towards a testing platform that is WebDriver compliant and framework agnostic. This allows our web test team to maintain a single solution for all web applications.

    Externally, there are many excellent alternatives available to the open source community, such as:

    1. Cypress
    2. PlayWright
    3. Puppeteer
    4. Selenium-webdriver
    5. TestCafe
    6. WebdriverIO

    (The list is sorted in alphabetical order and is non-exhaustive.)

    Deprecation

    The most important focus for the Angular team is to ensure a smooth transition for Protractor users. We have been engaging with different vendors to ensure

    • there is sufficient documentation / tooling to help users migrate to other platforms
    • third-party platforms integrate well with Angular CLI, so that CLI configurations are automatically handled by vendor-specific builders

    So far, the Angular team has reached out to the teams at Cypress and WebdriverIO to achieve the goals above. We will provide regular updates as more resources become available. If there is a particular platform that you’d like us to reach out to, please let us know in the comments below.

    Our proposed deprecation timeline is as follows:

    • Angular version 12 (May 2021)
      • Announcement of deprecation
      • Angular CLI will not include Protractor for new projects
      • Show warning when @angular-devkit/build-angular:protractor is used
      • Only PRs that address security issues and fixes for browser releases that break Protractor tests will be merged
    • Angular version 15 (end of 2022)
      • End of development on Protractor

    No decision is final until we assess all the feedback from this RFC.

    Extended LTS

    For users who require extended long-term support after the end of life of Protractor, we suggest reaching out to our external partners:

    If your team / company provides similar services, please let us know!

    FAQs

    1. What about Component Harnesses? Angular CDK's component harnesses include a ProtractorHarnessEnvironment for using harnesses in Protractor. This environment will be deprecated and replaced with a new environment backed by selenium-webdriver. The harness APIs themselves will be unchanged.
    2. How will Angular CLI handle ng e2e for new projects starting from version 12? The CLI will not include a default e2e builder for new projects, and users will decide which third-party builder to install. This is because picking an e2e platform really depends on the requirements of the project and there is no clear best fit for all Angular projects.
    3. In version 15, would all Protractor tests break? The Protractor builder will continue to work until version 15. After that, we plan to remove the Protractor builder (@angular-devkit/build-angular:protractor), which means ng e2e will no longer run Protractor. However, we are open to revising the timeline based on user feedback. Please let us know in the comments below.
    4. Protractor is useful because it automatically waits for the application to become stable. How can I use that in other platforms? Under the hood, Protractor uses Testability provided by @angular/core to check if the app is stable. This feature can be integrated into other platforms in a straightforward way. See the example for selenium-webdriver.
    5. Which e2e framework is the lowest effort and cost to migrate to from Protractor? In terms of APIs, selenium-webdriver is most similar to Protractor because it is used under the hood. If your tests still use Control Flow, you’ll have to remove it first by adding async / await to the Protractor calls. After that, you can replace the Protractor methods with those in selenium-webdriver. Although they are not 1:1 replacements, they are very close.
    6. Where will e2e migration strategies be documented? We are consolidating a list of migration strategies doc written by vendors and community members. See Links section below.
    7. What other packages will be deprecated along with Protractor at the end of 2022?
    8. My team just did a migration to disable Control Flow. What are our options? It is possible to create a thin wrapper around selenium-webdriver to provide APIs that are compatible with Protractor's. This is an idea that needs further exploration. Please let us know in the comments below if such tool is useful to you.

    Open questions

    1. Should the Angular team provide a different deprecation timeline?
    2. In addition to migration docs and CLI integration, how can the Angular team support Protractor users in the transition to other platforms?
    3. What are the alternatives to deprecating Protractor?

    Links

    This section is a work in progress. We will continue to consolidate more links and migration guides here.

    1. Migrating from Protractor to Cypress https://nx.dev/latest/angular/modern-angular/protractor-to-cypress
    2. Cypress official doc for Protractor users (placeholder link for now, will be live in the future) http://on.cypress.io/protractor-to-cypress
    opened by kyliau 80
  • "Detected a page unload event" error in phantom.js

    Trying to run "onMocha.js" example with phantomjs or chromedriver doesn't seem to work.

    Here's the code, I only changed webdriver.Capabilities.chrome() to webdriver.Capabilities.phantomjs() and expect.js to chai

    /**
     * This example shows how to use the protractor library in a Mocha test.
     * It assumes that a selenium server is running at localhost:4444.
     * Run this test with:
     *   mocha onMocha.js
     */
    
    var util = require('util');
    var expect = require('chai').expect;
    var webdriver = require('selenium-webdriver');
    var protractor = require('../lib/protractor.js');
    
    describe('angularjs.org homepage', function() {
      this.timeout(80000);
    
      var driver, ptor;
    
      before(function() {
        driver = new webdriver.Builder().
            withCapabilities(webdriver.Capabilities.phantomjs()).build();
    
        driver.manage().timeouts().setScriptTimeout(10000);
        ptor = protractor.wrapDriver(driver);
      });
    
      after(function(done) {
        driver.quit().then(function() {done()});
      })
    
      it('should greet using binding', function(done) {
        ptor.get('http://www.angularjs.org');
    
        ptor.findElement(protractor.By.input('yourName')).sendKeys('Julie');
    
        ptor.findElement(protractor.By.binding('{{yourName}}')).
            getText().then(function(text) {
              expect(text).to.eql('Hello Julie!');
              done();
            });
      });
    
      ... snip
    });
    

    Here's the error

    Uncaught UnknownError: Error Message => 'Detected a page unload event; asynchronous script execution does not work across page loads.'
     caused by Request => {"headers":{"Accept":"application/json; charset=utf-8","Connection":"keep-alive","Content-Length":"425","Content-Type":"application/json;charset=UTF-8","Host":"192.168.128.240:56087"},"httpVersion":"1.1","method":"POST","post":"{\"script\":\"return (function () {\\n  var attempts = arguments[0];\\n  var callback = arguments[arguments.length - 1];\\n  var check = function(n) {\\n    if (window.angular && window.angular.resumeBootstrap) {\\n      callback(true);\\n    } else if (n < 1) {\\n      callback(false);\\n    } else {\\n      window.setTimeout(function() {check(n - 1)}, 1000);\\n    }\\n  };\\n  check(attempts);\\n}).apply(null, arguments);\",\"args\":[10]}","url":"/execute_async","urlParsed":{"anchor":"","query":"","file":"execute_async","directory":"/","path":"/execute_async","relative":"/execute_async","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/execute_async","queryKey":{},"chunks":["execute_async"]},"urlOriginal":"/session/e2dbebc0-1b3f-11e3-84c0-67b730e3988e/execute_async"}
          at new bot.Error (./node_modules/selenium-webdriver/lib/atoms/error.js:109:18)
          at Object.bot.response.checkResponse (./node_modules/selenium-webdriver/lib/atoms/response.js:106:9)
          at ./node_modules/selenium-webdriver/lib/webdriver/webdriver.js:275:20
          at ./node_modules/selenium-webdriver/lib/goog/base.js:1178:15
          at webdriver.promise.ControlFlow.runInNewFrame_ (./node_modules/selenium-webdriver/lib/webdriver/promise.js:1438:20)
          at notify (./node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
          at notifyAll (./node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
          at fulfill (./node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
          at ./node_modules/selenium-webdriver/lib/webdriver/promise.js:1305:10
          at ./node_modules/selenium-webdriver/lib/goog/base.js:1178:15
          at webdriver.promise.ControlFlow.runInNewFrame_ (./node_modules/selenium-webdriver/lib/webdriver/promise.js:1438:20)
          at notify (./node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
          at notifyAll (./node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
          at fulfill (./node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
          at ./node_modules/selenium-webdriver/lib/goog/base.js:1178:15
          at webdriver.promise.ControlFlow.runInNewFrame_ (./node_modules/selenium-webdriver/lib/webdriver/promise.js:1438:20)
          at notify (./node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
          at notifyAll (./node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
          at fulfill (./node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
          at ./node_modules/selenium-webdriver/lib/webdriver/promise.js:607:51
          at ./node_modules/selenium-webdriver/lib/webdriver/http/http.js:96:5
          at IncomingMessage.<anonymous> (./node_modules/selenium-webdriver/http/index.js:113:7)
          at IncomingMessage.EventEmitter.emit (events.js:117:20)
          at _stream_readable.js:895:16
          at process._tickCallback (node.js:415:13)
      ==== async task ====
      WebDriver.executeScript()
          at webdriver.WebDriver.schedule (./node_modules/selenium-webdriver/lib/webdriver/webdriver.js:266:15)
          at webdriver.WebDriver.executeAsyncScript (./node_modules/selenium-webdriver/lib/webdriver/webdriver.js:506:15)
          at Protractor.get (./node_modules/protractor/lib/protractor.js:556:15)
          at Context.<anonymous> (./node_modules/protractor/example/onMocha.js:32:10)
          at Test.Runnable.run (./node_modules/protractor/node_modules/mocha/lib/runnable.js:194:15)
          at Runner.runTest (./node_modules/protractor/node_modules/mocha/lib/runner.js:355:10)
          at ./node_modules/protractor/node_modules/mocha/lib/runner.js:401:12
          at next (./node_modules/protractor/node_modules/mocha/lib/runner.js:281:14)
          at ./node_modules/protractor/node_modules/mocha/lib/runner.js:290:7
          at next (./node_modules/protractor/node_modules/mocha/lib/runner.js:234:23)
          at Object._onImmediate (./node_modules/protractor/node_modules/mocha/lib/runner.js:258:5)
          at processImmediate [as _immediateCallback] (timers.js:317:15)
    

    phantom

    > phantomjs --version                                                                                                                                                                                            
    1.9.1
    
    type: bug 
    opened by alexgorbatchev 72
  • Element explorer doesn't work on Node 8

    Element explorer doesn't work on Node 8

    Bug report

    • Node Version: 8.0.0
    • Protractor Version: 5.1.2
    • Angular Version: n/a
    • Browser(s): Chrome / chromedriver 2.29.0
    • Operating System and Version Mac Sierra 10.12.5
    • Your protractor configuration file n/a

    After installing node v8.0.0 and npm v5.0.0, reinstalling protractor globally and running webdriver-manager update, I cannot run protractor --elementExplorer because I receive the following error:

    protractor --elementExplorer
    (node:76684) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
    [11:04:10] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
    [11:04:11] I/protractor -
    [11:04:11] I/protractor - ------- Element Explorer -------
    [11:04:11] I/protractor - Starting WebDriver debugger in a child process. Element Explorer is still beta, please report issues at github.com/angular/protractor
    [11:04:11] I/protractor -
    [11:04:11] I/protractor - Type <tab> to see a list of locator strategies.
    [11:04:11] I/protractor - Use the `list` helper function to find elements by strategy:
    [11:04:11] I/protractor -   e.g., list(by.binding('')) gets all bindings.
    [11:04:11] I/protractor -
    module.js:487
        throw err;
        ^
    
    Error: Cannot find module '_debugger'
        at Function.Module._resolveFilename (module.js:485:15)
        at Function.Module._load (module.js:437:25)
        at Module.require (module.js:513:17)
        at require (internal/module.js:11:18)
        at Object.<anonymous> (/usr/local/lib/node_modules/protractor/built/debugger/debuggerCommons.js:1:82)
        at Module._compile (module.js:569:30)
        at Object.Module._extensions..js (module.js:580:10)
        at Module.load (module.js:503:32)
        at tryModuleLoad (module.js:466:12)
        at Function.Module._load (module.js:458:3)
    

    If I revert back to node 7.10.0 I don't get this error.

    status: needs investigation PRs plz! 
    opened by monkpit 65
  • Protractor tests hanging in Chrome after navigating to initial data url

    Protractor tests hanging in Chrome after navigating to initial data url

    After the recent Chrome update I've been having issues getting my specs to run using ChromeDriver. The test execution stalls after trying to navigate to the first data URL. It seems that the URL gets garbled somehow on its way into the browser, as it ends up as: "data:," in the URL field.

    Here is the output from the driver:

    A Jasmine spec timed out. Resetting the WebDriver Control Flow. The last active task was:

    WebDriver.navigate().to(data:text/html,<html></html>)
    

    The chrome driver version is 2.10, and the browser version is 36.0.1985.143

    status: needs more info 
    opened by diegope 61
  • PhantomJS sometimes crashes

    PhantomJS sometimes crashes

    I have been successfully running a fairly comprehensive suite of Protractor e2e tests using Chrome on OSX (Mavericks: 10.9.2).

    We have a technical requirement to run these tests headlessly, so I swapped in PhantomJS instead of Chrome, and after 20 seconds (consistently), I get the following error:

    Runner Process Exited With Error Code: 8
    Fatal error: protractor exited with code: 1
    

    Now for some more detailed information.

    Here is the full error output from the grunt task I am running:

    Running "protractor:phantomjs" (protractor) task
    ------------------------------------
    PID: 9678 (capability: phantomjs #1)
    ------------------------------------
    Starting selenium standalone server...
    Selenium standalone server started at http://192.168.1.111:4444/wd/hub
    /path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1562
    throw error;
    ^
    UnknownError: null
    at new bot.Error (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:109:18)
    at Object.bot.response.checkResponse (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)
    at /path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:135:24
    at /path/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
    at webdriver.promise.ControlFlow.runInNewFrame_ (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1455:20)
    at notify (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
    at notifyAll (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
    at fulfill (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
    at /path/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
    at webdriver.promise.ControlFlow.runInNewFrame_ (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1455:20)
    ==== async task ====
        WebDriver.createSession()
    at Function.webdriver.WebDriver.acquireSession_ (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:132:49)
    at Function.webdriver.WebDriver.createSession (/path/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:111:30)
    at Builder.build (/path/node_modules/protractor/node_modules/selenium-webdriver/builder.js:105:20)
    at LocalDriverProvider.getDriver (/path/node_modules/protractor/lib/driverProviders/local.dp.js:128:9)
    at /path/node_modules/protractor/lib/runner.js:327:35
    at _fulfilled (/path/node_modules/protractor/node_modules/q/q.js:797:54)
    at self.promiseDispatch.done (/path/node_modules/protractor/node_modules/q/q.js:826:30)
    at Promise.promise.promiseDispatch (/path/node_modules/protractor/node_modules/q/q.js:759:13)
    at /path/node_modules/protractor/node_modules/q/q.js:573:44
        [launcher] Runner Process Exited With Error Code: 8
    >>
    Fatal error: protractor exited with code: 1
    

    Package versions:

    "grunt-protractor-runner": "~0.2.3"
    "protractor": "0.19.0"
    "selenium-webdriver": "~2.40"
    

    Contents of protractor.conf.js:

    exports.config = {
        seleniumServerJar: '../../node_modules/protractor/selenium/selenium-server-standalone-2.39.0.jar',
        seleniumPort: 4444,
        seleniumArgs: ['-browserTimeout=60'],
        specs: [
            '../e2e/utils.js',
            '../e2e/**/*-suite.js'
        ],
        capabilities: {
            browserName: 'phantomjs',
            'phantomjs.binary.path': './node_modules/karma-phantomjs-launcher/node_modules/phantomjs/bin/phantomjs',
            'phantomjs.cli.args': ['--debug=true', '--webdriver', '--webdriver-logfile=webdriver.log', '--webdriver-loglevel=DEBUG']
        },
        baseUrl: 'http://localhost:9292',
        rootElement: 'body',
        onPrepare: function () {
            require('jasmine-reporters');
            jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter('test/results/', true, true));
        },
        framework: 'jasmine',
        jasmineNodeOpts: {
            onComplete: function () {
            },
            isVerbose: true,
            showColors: true,
            includeStackTrace: true,
            defaultTimeoutInterval: 30000
        }
    };
    

    I have tried installing version ~1.9.7-1 of the phantomjs package independently of the one that protractor depends upon, and updating the phantomjs.binary.path property in protractor.conf.js, but I get the same result.

    After spending far too long debugging the JS to try to isolate where the error is occurring, I know that it is falling over in runner.js.

    Specifically in Runner.prototype.runJasmine_(), the anonymous function passed to webdriver.promise.controlFlow().execute() here is never executed.

    Can anyone help?

    Let me know if you need more information.

    Matt

    type: external bug needs to be filed browser: phantomjs status: external bug filed 
    opened by mcalthrop 61
  • Avoid waiting for $timeout()s ?

    Avoid waiting for $timeout()s ?

    In our app we display "popup" messages to our user when certain buttons are clicked. These popup messages are only visible for about 20 seconds (after which $timeout removes them).

    The problem is that Protractor seems to wait until the $timeout is completed before it .findElement() and .expect()s things. However, when the $timeout is timed out, the message is gone, and the element is not found.

    Any suggestion on how to bypass/solve this? (We need to assert that the correct "popup" message is displayed to the user)

    Thanks

    type: question 
    opened by drhumlen 59
  • Calling element.sendKeys() seems to not send all the keys

    Calling element.sendKeys() seems to not send all the keys

    I am doing the following two tests:

       it("Should be able to populate the firstname field", function () {
    
            expect(capturePageModel.findFirstNameFieldValue()).toEqual("");
            capturePageModel.setFirstNameFieldValue("Adam");
            expect(capturePageModel.findFirstNameFieldValue()).toEqual("Adam");
    
        });
    
        it("Should be able to populate the lastname field", function () {
            expect(capturePageModel.findLastNameField()).toEqual("");
            capturePageModel.setLastNameFieldValue("Parrish");
            expect(capturePageModel.findLastNameField()).toEqual("Parrish")
        });
    

    When I execute both tests in the same describe block I definitely am seeing the second test only send the "sh" value of the "Parrish" value I am passing in. Thus the test fails.

    However each test runs fine by itself. I am attempting to use PageObjects to write a few documents on how this could work but curious if you have seen anything like this happen.

    Simple example of my setter and getter functions in my PageObjects

    this.setLastNameFieldValue = function( value ) {
    
        var lastNameElement = element(by.model('presubmitUser.lastName'))
        lastNameElement.sendKeys( value );
    
    }
    
    this.findLastNameField = function() {
        var firstNameElement = element(by.id('lastName'))
        return firstNameElement.getAttribute('value');
    }
    

    The first name field is identical to the last name field.

    status: needs investigation type: external bug needs to be filed 
    opened by neosavvy 56
  • Failed: Error while waiting for Protractor to sync with the page:

    Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"

    After updated Protaractor to 1.6.1 , webdriver , chromedriver, jasmine to 2.0, when i try to run my tests i got:

    "Using ChromeDriver directly...
    [launcher] Running 1 instances of WebDriver
    Start test TC06_01_01_Binary_1_1
    Started
    Execute test TC06_01_01_Binary_1_1
    Login as Admin
    Execute script no 18
    F
    
    Failures:
    1) TC06_01_01_Binary_1_1 TC06_01_01_Binary_1_1 Should be able to add record with different values
      Message:
        Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
      Stack:
        Error: Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
           at C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:104:1
    6
            at C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\go
    og\base.js:1582:15
            at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (C:\Users\E2Euser\AppData\Roaming\npm\
    node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1654:20)
            at notify (C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdrive
    r\lib\webdriver\promise.js:465:12)
      Message:
        Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on the windo
    w"
      Stack:
        Error: Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on th
    e window"
            at C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:104:1
    6
            at C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\go
    og\base.js:1582:15
            at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (C:\Users\E2Euser\AppData\Roaming\npm\
    node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1654:20)
            at notify (C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdrive
    r\lib\webdriver\promise.js:465:12)
      Message:
        Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on the windo
    w"
      Stack:
        Error: Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on th
    e window"
            at C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:104:1
    6
            at C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\go
    og\base.js:1582:15
            at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (C:\Users\E2Euser\AppData\Roaming\npm\
    node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1654:20)
            at notify (C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdrive
    r\lib\webdriver\promise.js:465:12)
    
    1 spec, 1 failure
    Finished in 1.409 seconds
    [launcher] 0 instance(s) of WebDriver still running
    [launcher] chrome #1 failed 1 test(s)
    [launcher] overall: 1 failed spec(s)
    [launcher] Process exited with error code 1"
    

    any idea why Angular cannot be found? or how should i fix this?

    status: needs investigation 
    opened by softacid 52
  • chore(core): Add better error message for client-side redirects

    chore(core): Add better error message for client-side redirects

    If the test clicks a link or something which causes a redirect outside of browser.get or browser.refresh, then the next time waitForAngular is called the user will probably run into this error message (since we didn't wait for Angular to load), which is not very helpful.

    Users should be told what's going wrong and about potential work-arounds (e.g. using browser.get or browser.refresh to fix the bootstrapping).

    type: debuggability 
    opened by sjelin 49
  • Heads up: Protractor is not working with Firefox 35/36

    Heads up: Protractor is not working with Firefox 35/36

    Yesterday things were working just fine, but today Firefox got updated and protractor suddenly wouldn't run the tests anymore. It'd just show the page - like it never requested the whole thing - and, after a while, it shows the Jasmine spec timeout type of error.

    Apparently it's something related to the driver, since when I downgraded Firefox to 33.1 and ran the tests again, they worked like a charm.

    When they release the compatible version (firefox/driver), do I have to update the webdriver-manager or will protractor have to be updated as well?

    Thanks!

    type: external bug needs to be filed status: external bug filed browser: firefox 
    opened by ericmdantas 49
  • Interview partners for research about communication in GitHub projects wanted

    Interview partners for research about communication in GitHub projects wanted

    Hi. My name is Verena Ebert, and I am a PhD student at the University of Stuttgart in Germany.
    A few months ago, I have examined 90 GitHub projects to see what communication channels they use and how they write about them in the written documents, for example README or wiki. If you are interested in the previous results, you can find them here: https://arxiv.org/abs/2205.01440 Your project was one of these 90 projects and, therefore, I am interested in further details about your communication setup.

    To gather more data about your communication setup, I kindly ask one of the maintainers to do an interview with me. The interview will be about 30-35 minutes long and via Skype, WebEx or any other provider you prefer. The interviews should be done in November 2022, if possible.

    In this interview, I would like to ask some questions about the reasons behind the channels, to understand the thoughts of the maintainers in addition to the written information.

    The long goal of my PhD is to understand how communication works in GitHub projects and how a good set of communication channels and information for other maintainers and developers looks like. One possible outcome is a COMMUNICATION.md with instructions and tips about which channels could be useful and how these channels should be introduced to other projects participants. Of course, if you are interested, I will keep you up to date about any further results in my research.

    If you are interested in doing an interview, please respond here or contact me via email ([email protected]). We will then make an appointment for the interview at a time and date that suits you.

    If you agree, I would like to record the interview and transcribe the spoken texts into anonymized written texts. In this case, I will send you the transcript for corrections afterwards. Only if you agree, the transcripts or parts of it would be part of a publication.

    opened by verenya 0
  • Deprecated warning with Protractor

    Deprecated warning with Protractor

    Bug report

    • Node Version: v14.17.3
    • Protractor Version: ~7.0.0
    • Angular Version: 13.0.1 -Issue: Hello there, Team. We use Protractor in one of my Angular applications, and we recently discovered a deprecated vulnerability issue with the 'Request' npm package. We cross-checked in our application 'Request' package, which is not used in my package. However, we discovered that this Request is present in the package.lock file as part of 'Protractor'. Under 'Protractor,' there is a 'webdriver-manager' package under requires, and under 'webdriver-manager,' there is a 'Request' package in requires section, which is deprecated. As a result, we require some direction in dealing with this situation.
    opened by spraju92 2
  • Getting the ERROR

    Getting the ERROR "This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used." When I try to use restart() or close() method

    Hi there!

    I am trying to execute an extremely simple code. No page object, no method calling from different classes , no customizing configuration file. I am just trying to open a browser, then close it and then open a new browser instance. #My Conf.js file is :

    exports.config = {
      //directConnect: true,
      framework: 'jasmine2',
      seleniumAddress: 'http://localhost:4444/wd/hub',
      specs: ['spec.js']
    }
    

    #My spec file is:

    const { browser, protractor } = require("protractor");
    describe('abcd',  () => {
        it('Restart the browser', () => {
            browser.get('https://material.angular.io/')
            .then(()=>(browser.restart()))
            .then(()=>(browser.get('https://material.angular.io/')));
        });
           it ('2', async  () => {
            await browser.waitForAngularEnabled(false);
            await browser.get('https://www.google.com');
            await element(by.xpath("//input[@name='q']")).sendKeys('asdaf');
            await browser.close();
        });`
    });
    

    I want to close the browser after each It block and open a new instance of a browser in the next It block. I know that we can use restartAfterEachTest in the configuration file to restart browsers, but I am not looking for that, I want to close and open browsers from my Spec file.

    If I use browser.restart() it shows me the is error "This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used." and the IT block is failed.

    If I use browser.close() , the first It block is passing but all subsequent It blocks are getting failed immediately and the error is "Invalid Session ID".

    Looking for a solution, thanks in advance

    opened by Avijoy7 2
  • Git.io deprecation notice

    Git.io deprecation notice

    Hello, I've found that some of your files in this repo is still using https://git.io/, and this service will be discontinued in the future. (ref: Git.io deprecation) Theses files are: lib/config.ts

    This is an automated message from NPMMirror(https://github.com/npmmirror), a bot developed by Nova Kwok(https://github.com/n0vad3v).

    opened by npmmirror 0
  • Feature request - html to pdf

    Feature request - html to pdf

    Requesting a feature request to convert a page to pdf with vector (means ability to copy paste text). mainly like the same output file given by this online tool https://www.sejda.com/html-to-pdf better to have ability to save file with specified name (example: myfilename.pdf).

    • Reasons for adopting new feature There are lots of javascript suggestions available in the internet. They work well for simple websites like example.com and google.com but the do NOT work well for complex angular programs. We cannot get the output given by https://www.sejda.com/html-to-pdf for complex angular programs using current solutions. Currently we can get page source, screenshots. Getting pdf from browser should NOT be that difficult. This will be a great addition to protractor if someone can implement.

    • Is this a breaking change? (How will this affect existing functionality) I don't think this will affect existing functionality . But I'm not an expert.

    opened by godomainz 0
Releases(5.4.3)
☕️ simple, flexible, fun javascript test framework for node.js & the browser

☕️ Simple, flexible, fun JavaScript test framework for Node.js & The Browser ☕️ Links Documentation Release Notes / History / Changes Code of Conduct

Mocha 21.8k Dec 30, 2022
Test runner based on Tape and Browserify

prova Node & Browser Test runner based on Tape and Browserify. Screencasts: node.gif, browser.gif, both.gif, headless browser Slides: slides.com/azer/

Azer Koçulu 335 Oct 28, 2022
tap-producing test harness for node and browsers

tape tap-producing test harness for node and browsers example var test = require('tape'); test('timing test', function (t) { t.plan(2); t.eq

James Halliday 5.7k Dec 18, 2022
Node.js test runner that lets you develop with confidence 🚀

AVA is a test runner for Node.js with a concise API, detailed error output, embrace of new language features and process isolation that lets you devel

AVA 20.2k Jan 1, 2023
Politik Test

Politik Test Netlify Live Installation and Setup Instructions Clone down this repository. You will need node and npm installed globally on your machin

Yavuz Selim Şerifoğlu 6 Jun 13, 2021
Cypress Playback is a plugin and a set of commands that allows Cypress to automatically record responses to network requests made during a test run.

Cypress Playback ?? Automatically record and playback HTTP requests made in Cypress tests. Cypress Playback is a plugin and a set of commands that all

O’Reilly Media, Inc. 5 Dec 16, 2022
The goal of this app is to make user life easier while testing their own apps

Manual testing app The goal of this app is to make user life easier while testing their own apps. It is used to create the testing workflow, record te

null 1 Jan 2, 2023
Simple JavaScript testing framework for browsers and node.js

A JavaScript Testing Framework Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on browsers, DOM, or any Ja

Jasmine 15.5k Jan 2, 2023
🔮 An easy-to-use JavaScript unit testing framework.

QUnit - A JavaScript Unit Testing Framework. QUnit is a powerful, easy-to-use, JavaScript unit testing framework. It's used by the jQuery project to t

QUnit 4k Jan 2, 2023
[unmaintained] DalekJS Base framework

DalekJS is not maintained any longer ?? We recommend TestCafé for your automated browser testing needs. dalekjs DalekJS base framework Resources API D

DalekJS 703 Dec 9, 2022
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

?? Playwright Documentation | API reference Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit w

Microsoft 46.3k Jan 9, 2023
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Demo Selenium JavaScript E2E tests (end-to-end web browser automation tests)

Demo Selenium JavaScript E2E tests (end-to-end web browser automation tests)

Joel Parker Henderson 1 Oct 9, 2021
React.js todo app with authorization, Testing: Cypress(e2e), UI (Chakra UI), Eslint, prettier, git hooks

React TypeScript template with Vite This is a React + TypeScript boilerplate built with Vite. What's inside? ReactJS Vite TypeScript Jest Testing Libr

Vladislav 2 Jan 28, 2022
A demo for E2E build piplelines in Design Systems using monorepo's and automation :zap:.

Design System Pipelines demo What is it? A working demonstration for end-to-end build piplelines in Design Systems using Primer Primitives, Primer CSS

Rez 7 Oct 20, 2022
Next.js website for E2E

Prérequis git (obviously) node >= 14 avec npm Sur MacOS ou Linux, je suggère fortement d'utiliser Node.js Version Manager afin de simplifier l'install

null 2 Feb 15, 2022
A small utility server to exchange data and messages between clients. Comes complete with E2E public key encryption

Zenotta Intercom A small utility server to exchange arbitrary data between clients. Comes complete with E2E public key encryption Official documentati

Zenotta AG 7 Oct 2, 2022
A testing focused Remix Stack, that integrates E2E & Unit testing with Playwright, Vitest, MSW and Testing Library. Driven by Prisma ORM. Deploys to Fly.io

Live Demo · Twitter A testing focused Remix Stack, that integrates E2E & Unit testing with Playwright, Vitest, MSW and Testing Library. Driven by Pris

Remix Stacks 18 Oct 31, 2022