Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

protractor

Package Overview
Dependencies
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protractor

Webdriver E2E test wrapper for Angular.

  • 6.0.0-beta
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
837K
increased by7.06%
Maintainers
2
Weekly downloads
 
Created

What is protractor?

Protractor is an end-to-end test framework for Angular and AngularJS applications. It runs tests against your application running in a real browser, interacting with it as a user would.

What are protractor's main functionalities?

End-to-End Testing

Protractor allows you to write end-to-end tests for your Angular applications. The code sample demonstrates navigating to an AngularJS website, selecting elements, and making assertions about their state.

const { browser, element, by } = require('protractor');

browser.get('http://www.angularjs.org');

const todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(2);
expect(todoList.get(1).getText()).toEqual('build an AngularJS app');

Automatic Waiting

Protractor automatically waits for Angular to finish rendering and for any outstanding $http calls to be completed before performing the next action. This reduces the need for explicit waits in your tests.

const { browser, element, by } = require('protractor');

browser.get('http://www.angularjs.org');

const addButton = element(by.css('[value="add"]'));
addButton.click();

const todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(3);

Integration with Jasmine

Protractor integrates seamlessly with the Jasmine testing framework, allowing you to write tests in a behavior-driven development (BDD) style. The code sample shows a Jasmine test suite that adds a new todo item and verifies its presence.

describe('angularjs homepage todo list', function() {
  it('should add a todo', function() {
    browser.get('http://www.angularjs.org');

    element(by.model('todoList.todoText')).sendKeys('write a protractor test');
    element(by.css('[value="add"]')).click();

    const todoList = element.all(by.repeater('todo in todoList.todos'));
    expect(todoList.count()).toEqual(3);
    expect(todoList.get(2).getText()).toEqual('write a protractor test');
  });
});

Other packages similar to protractor

Keywords

FAQs

Package last updated on 25 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc