44115

Getting the angular app to run when using protractor

Question:

I must be missing something here ...

I'm trying to use protractor to run e2e tests for my angular application. The configuration file is something along the lines of:

allScriptsTimeout: 11000, specs: [ 'src/**/*.e2e.js' ], capabilities: { browserName: 'firefox' }, baseUrl: 'http://localhost:8000/app/', framework: 'jasmine', jasmineNodeOpts: { showColors: true, isVerbose : true, includeStackTrace : true, defaultTimeoutInterval: 30000 }

The test looks something like this:

describe('example test', function() { beforeEach(function () { browser.get('index.html'); }); it('should test something trivial', function() { expect(2).toEqual(2); }); });

I'm using grunt to run it, with "grunt-protractor-runner". When grunt gets to the protractor task, I see the following (running grunt with --verbose):

Starting selenium standalone server... [launcher] Running 1 instances of WebDriver Selenium standalone server started at http://172.17.113.30:53524/wd/hub

Then the firefox browser window opens, and resolves the URL correctly to: http://localhost:8000/app/index.html

However (and here's the question finally ...), firefox cannot find the page, i.e. I get the following error:

<img alt="firefox error message screen shot" class="b-lazy" data-src="https://i.stack.imgur.com/tHXk1.png" data-original="https://i.stack.imgur.com/tHXk1.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

I tried running it with Chrome as well, but I get the same result.

My question is, what am I missing ? In other words, who's job it is to get the angular app deployed at localhost:8000 ? Is the deployment done by protractor/selenium/grunt, or do I need to deploy it on some webserver myself ?

Given that I can't find any question like mine online, I guess I'm missing something trivial here. Please help.

Answer1:

So, as discussed. Angular App needs to be deployed before executing any tests. Deploy the Angular app first and then start Testing using Protractor.

Recommend

  • Spring Boot Custom Error Controller Returning empty json response
  • How to setup Selenium grid remotely in protractor
  • Protractor - Cannot read property '$$testability' of undefined
  • Is it possible to use Dojo build without modifying JS files?
  • AngularJs unit test - Check if “Init” function was called
  • Invalidate node cache when using Jest
  • Jasmine 2.0 async beforeEach not waiting for async to finish
  • how to use telegram API on c# via Json?
  • Sqlite query, compare datetime field with current date time
  • ruby: unable to use logger with rspec
  • Ruby on Rails Tutorial - Michael Hartl - Test “User when email address is already taken”
  • Accessing the real file name of a symbolic linked file
  • Algorithm for placing nodes on a circle considering their distance to eachother
  • How to make a shared resource thread-safe when using dependency injection?
  • installing an Ocaml hump library on mutualized server
  • Spying on Date constructor with sinon
  • Does Perl currently (5.8 and 5.10) make any promises about the order alternations will be used?
  • how to automatically enter password when using ssh?
  • Capturing STDOUT in RSpec
  • Does SmartGit support git-svn?
  • How can I create a plugin mechanism that calls functions only when the plugin is available?
  • Furthest-point Voronoi diagram in Java
  • Add spaces between words in spaceless string
  • Running jasmine tests for a component with NgZone dependency
  • How do I mock an exported typescript function in a jasmine test?
  • Git describe fails to return most recent annotated tag
  • HTTP/2 streams vs HTTP/1.1 connections
  • Python urlparse: small issue
  • Display issues when we change from one jquery mobile page to another in firefox
  • Deselecting radio buttons while keeping the View Model in synch
  • angularjs unit test when to use $rootScope.$new()
  • JSON with duplicate key names losing information when parsed
  • How to model a transition system with SPIN
  • Jquery - Jquery Wysiwyg return html as a string
  • Running Map reduces the dimensions of the matrices
  • Reading document lines to the user (python)
  • Binding checkboxes to object values in AngularJs
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?