Coder Social home page Coder Social logo

surendravidiyala / protractor-jasmine-testing Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 35.52 MB

End-to-End Testing Angular App with protractor

HTML 74.24% JavaScript 23.55% CSS 2.20%
angularjs end-to-end-testing protractor-e2e-test protractor-tests jasmine-tests selenium-tests webdrivermanager

protractor-jasmine-testing's Introduction

protractor-jasmine-testing

  • end-to-end (e2e) testing in your Angular applications. You will learn about Protractor and learn how to use them to carry out e2e testing. At the end of this exercise, you should be able to:
    • Configure a protractor configuration file
    • Set up e2e tests using Jasmine and carry out the e2e test automatically
  • Note: You should have completed the previous exercise on unit testing before proceeding with this exercise. Some of the set up is common for both unit tests and e2e tests. These were already done in the previous exercise.

Setting up the E2E Test Environment

  • Set up the protractor tool globally for use in e2e testing:
     npm install protractor -g

Remember to use sudo if you are in OSX or Linux environments. The above also installs webdriver-manager. Then, update your web drivers by typing:

    webdriver-manager update
  • Remember to use sudo if you are in OSX or Linux environments.
  • Make sure that you are running the json-server to serve up the REST API for accessing the JSON data by your Angular application.
  • Next, you need to start a server to serve up the Angular application. Fortunately, Gulp is already set up to do that. Make sure you are in the conFusion folder. At the command prompt, type:
   gulp watch
  • This will start the server and serve the page at http://localhost:3001/. Make sure about the port number (3001) where your server is serving up the web page. #Configuring Protractor

  • Next, move to the test folder and create a file named protractor.conf.js and add the following configuration code to it:

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    'e2e/*.js'
  ],
  capabilities: {
    'browserName': 'chrome'
  },

  baseUrl: 'http://localhost:3001/',

  framework: 'jasmine',
    directConnect: true,

  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
  }
};
  • Here we are using the directConnect option to directly connect to the browser to conduct the tests, rather than through the Selenium web server.
  • Next, create a folder named e2e in the test folder, and move to the e2e folder.
  • Create a file named scenarios.js. This fill will contain all the e2e tests that we will execute on the application.

protractor-jasmine-testing's People

Contributors

surendravidiyala avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.