Permalink
Browse files

fix(protractor): References to 'protractor/globals' changed to 'protr…

…actor'

Protractor 4.0.9 changes the public api of it's typescript interface, exposing any global objects

via the 'protractor' package rather than the 'protractor/globals' like it used to

Fixes jan-molak/serenity-js-getting-started#2
  • Loading branch information...
jan-molak committed Nov 11, 2016
1 parent ffd290b commit 58b11253de37e3b7b8e733e56a534b01bd67c848
@@ -2,7 +2,7 @@ import { BrowseTheWeb, Open, WebElement } from '../../../src/serenity-protractor
import { Actor } from '../../../src/serenity/screenplay';
import { DemoApp } from './ui/demo_app';
import { protractor } from 'protractor/globals';
import { protractor } from 'protractor';
import test = require('selenium-webdriver/testing');
@@ -1,4 +1,4 @@
import { protractor } from 'protractor/globals';
import { protractor } from 'protractor';
import {
BrowseTheWeb,
@@ -1,4 +1,4 @@
import { protractor } from 'protractor/globals';
import { protractor } from 'protractor';
import {
BrowseTheWeb,
@@ -10,7 +10,7 @@ import { DemoApp } from './ui/demo_app';
import test = require('selenium-webdriver/testing');
import { protractor } from 'protractor/globals';
import { protractor } from 'protractor';
import expect = require('../../expect');
@@ -1,6 +1,6 @@
import { Target } from '../../../../src/serenity-protractor/screenplay';
import { by } from 'protractor/globals';
import { by } from 'protractor';
export class DemoApp {
static Header = Target.the('header').located(by.css('header>h1'));
@@ -360,7 +360,7 @@ Let's update the Cucumber step definitions to include our new code:
import { Actor } from 'serenity-js/lib/screenplay';
import { BrowseTheWeb } from 'serenity-js/lib/screenplay-protractor';
import { protractor } from 'protractor/globals';
import { protractor } from 'protractor';
// ...
@@ -434,7 +434,7 @@ we can use another built-in Interaction - `Enter`:
import { PerformsTasks, Task } from 'serenity-js/lib/screenplay';
import { Enter } from 'serenity-js/lib/screenplay-protractor';
import { protractor } from 'protractor/globals';
import { protractor } from 'protractor';
import { TodoList } from '../ui/todo_list';
@@ -463,7 +463,7 @@ There's one thing missing though: we haven't defined what `TodoList.What_Needs_T
// src/screenplay/ui/todo_list.ts
import { Target } from 'serenity-js/lib/screenplay-protractor';
import { by } from 'protractor/globals';
import { by } from 'protractor';
export class TodoList {
static What_Needs_To_Be_Done = Target.the('"What needs to be done?" input box')
@@ -558,7 +558,7 @@ And the Target:
// src/screenplay/ui/todo_list.ts
import { Target } from 'serenity-js/lib/screenplay-protractor';
import { by } from 'protractor/globals';
import { by } from 'protractor';
export class TodoList {
static What_Needs_To_Be_Done = Target.the('"What needs to be done?" input box')
@@ -592,7 +592,7 @@ To do this, call the Serenity/JS WebDriver Synchroniser in your `cucumber_hooks.
```typescript
// features/cucumber_hooks.ts
import { protractor } from 'protractor/globals';
import { protractor } from 'protractor';
import * as serenity from 'serenity-js/lib/serenity-cucumber';
export = function () {
@@ -43,7 +43,7 @@ to low-level Protractor/WebDriver APIs:
One common approach would be to implement each step as a "test script" that makes a series of calls to low-level Protractor/WebDriver APIs:
```typescript
import { browser, by, element, protractor } from 'protractor/globals';
import { browser, by, element, protractor } from 'protractor';
export = function todoUserSteps() {
@@ -102,7 +102,7 @@ that the page contained. The implementation below uses that refined version, as
Let's refactor the code from the previous example using the Page Objects pattern:
```typescript
import { browser, by, element, protractor } from 'protractor/globals';
import { browser, by, element, protractor } from 'protractor';
class TodoList {
What_Needs_To_Be_Done = element(by.id('new-todo'));
@@ -33,7 +33,7 @@ To do this, let's register the Serenity/JS Notifier in the `features/cucumber.ho
```typescript
// features/cucumber.hooks.ts
import { protractor } from 'protractor/globals';
import { protractor } from 'protractor';
import * as serenity from 'serenity-js/lib/serenity-cucumber';
export = function () {
@@ -337,7 +337,7 @@ Now, repeat the process with the `AddATodoItem` task:
import { PerformsTasks, Task } from 'serenity-js/lib/screenplay';
import { Enter, step } from 'serenity-js/lib/screenplay-protractor'; // imports the @step
import { protractor } from 'protractor/globals';
import { protractor } from 'protractor';
import { TodoList } from '../ui/todo_list';
@@ -412,7 +412,7 @@ so let's make the following changes to the `todo_user.steps.ts`:
import { Serenity } from 'serenity-js';
import { Actor, BrowseTheWeb } from 'serenity-js/lib/screenplay-protractor';
import { protractor } from 'protractor/globals';
import { protractor } from 'protractor';
import { Start } from '../../src/screenplay/tasks/start';
import { AddATodoItem } from '../../src/screenplay/tasks/add_a_todo_item';
@@ -1,4 +1,4 @@
import { by } from 'protractor/globals';
import { by } from 'protractor';
import { Target } from 'serenity-js/lib/screenplay-protractor';
export class TodoList {
Oops, something went wrong.

0 comments on commit 58b1125

Please sign in to comment.