Skip to content

Commit

Permalink
feat(protractor): 'serenity-js/protractor' gives easy access to 'sere…
Browse files Browse the repository at this point in the history
…nity-js/lib/screenplay-protractor'

affects: serenity-js

`import { Task, Enter, Click, ... } from 'serenity-js/lib/screenplay-protractor'` can be replaced with
`import { Task, Enter, Click, ... } from 'serenity-js/protractor'`
This is one of the first steps towards extracting protractor support into its own module.
It will also save you some key strokes.
  • Loading branch information
jan-molak committed Nov 7, 2017
1 parent dd2dd06 commit 029e5f4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ Let's update the Cucumber step definitions to include our new code:
// features/step_definitions/todo_user.steps.ts

import { Actor } from 'serenity-js/lib/screenplay';
import { BrowseTheWeb } from 'serenity-js/lib/screenplay-protractor';
import { BrowseTheWeb } from 'serenity-js/protractor';

import { protractor } from 'protractor';

Expand Down Expand Up @@ -389,7 +389,7 @@ to the application could be a good start:
```typescript
// ...

import { Open } from 'serenity-js/lib/screenplay-protractor';
import { Open } from 'serenity-js/protractor';

export class Start implements Task {

Expand Down Expand Up @@ -432,7 +432,7 @@ we can use another built-in Interaction - `Enter`:
// src/screenplay/tasks/add_a_todo_item.ts

import { PerformsTasks, Task } from 'serenity-js/lib/screenplay';
import { Enter } from 'serenity-js/lib/screenplay-protractor';
import { Enter } from 'serenity-js/protractor';

import { protractor } from 'protractor';

Expand Down Expand Up @@ -462,7 +462,7 @@ There's one thing missing though: we haven't defined what `TodoList.What_Needs_T
```typescript
// src/screenplay/ui/todo_list.ts

import { Target } from 'serenity-js/lib/screenplay-protractor';
import { Target } from 'serenity-js/protractor';
import { by } from 'protractor';

export class TodoList {
Expand Down Expand Up @@ -543,7 +543,7 @@ identified by a `Target`:
```typescript
// src/screenplay/questions/todo_list_items.ts

import { Text } from 'serenity-js/lib/screenplay-protractor';
import { Text } from 'serenity-js/protractor';

import { TodoList } from '../ui/todo_list';

Expand All @@ -557,7 +557,7 @@ And the Target:
```typescript
// src/screenplay/ui/todo_list.ts

import { Target } from 'serenity-js/lib/screenplay-protractor';
import { Target } from 'serenity-js/protractor';
import { by } from 'protractor';

export class TodoList {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ giving the Task a more descriptive name:
// src/screenplay/tasks/start.ts

import { PerformsTasks, Task } from 'serenity-js/lib/screenplay';
import { Open, step } from 'serenity-js/lib/screenplay-protractor'; // imports the @step
import { Open, step } from 'serenity-js/protractor'; // imports the @step

import { AddATodoItem } from './add_a_todo_item';

Expand Down Expand Up @@ -335,7 +335,7 @@ Now, repeat the process with the `AddATodoItem` task:
// src/screenplay/tasks/add_a_todo_item.ts

import { PerformsTasks, Task } from 'serenity-js/lib/screenplay';
import { Enter, step } from 'serenity-js/lib/screenplay-protractor'; // imports the @step
import { Enter, step } from 'serenity-js/protractor'; // imports the @step

import { protractor } from 'protractor';

Expand Down Expand Up @@ -411,7 +411,7 @@ so let's make the following changes to the `todo_user.steps.ts`:
# features/step_definitions/todo_user.steps.ts

import { Serenity } from 'serenity-js';
import { Actor, BrowseTheWeb } from 'serenity-js/lib/screenplay-protractor';
import { Actor, BrowseTheWeb } from 'serenity-js/protractor';
import { protractor } from 'protractor';

import { Start } from '../../src/screenplay/tasks/start';
Expand Down
1 change: 1 addition & 0 deletions packages/serenity-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"docs",
"examples/**",
"lib",
"**/protractor.d.ts",
"spec",
"staging",
"node_modules"
Expand Down
1 change: 1 addition & 0 deletions packages/serenity-js/protractor.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/screenplay-protractor';
1 change: 1 addition & 0 deletions packages/serenity-js/protractor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./lib/screenplay-protractor');

0 comments on commit 029e5f4

Please sign in to comment.