1.3.2 • Published 7 years ago

protractor_not_ng v1.3.2

Weekly downloads
93
License
-
Repository
github
Last release
7 years ago

Toolset for testing non angular app with protractor

Here you'll find some tools to use protractor with a non angular app. I try to hide all traps into internal mechanic, so the final user should don't care about them.

I try to keep this npm package as simple as possible.

Element - the basic item!

Everything is an element.

This class is extended by Input && Select, how are the two main nodetypes I use - if this isn't select nor input, then this is a simple Element -.

Constructor

var el = new Element(_aLocator_: ProtractorBy);

You can use every locator offered by the original webdriver. See documentation here

When an Element is constructed, basical informations about it are loaded. Basical informations are :

  1. Display state (is the element visible?)
  2. Disable state (is the element disabled?)
  3. Readonly state (is the element marked as readonly?).

isEnabled(): Promise<boolean>

This method return a promise resolved by a boolean that indicate if the element is enabled.

isReadonly(): Promise<boolean>

This method return a promise resolved by a boolean that indicate if the element is considered as readonly.

An element is considered as readonly if he has a "readonly" or a "disabled" attribute.

click(): Promise<any>

This method return a promise how is gonna be resolved by when click action is done.

getAttribute(attrName: string): promise.Promise<string>

Return a promise resolved with the requested attribute.

Select

When a Select is constructed, all basic informations are loaded using inheritance, but also every available options.

This allow us to easyly manipulate the item, and to know with more efficiency if an option is contained or not (and to simplify every action related to them).

selectRandomValue: Promise<any>

Select randomly a value in every available value. Can be usefull if you need to select something but you don't care about what!

A promise is returned and resolved when an option has been selected.

selectOption(searchedOptionText: string): Promise<any>

Select the option how match the provided searchedOptionText, and return a promise resolved when the option has been selected.

getSelectedOption(): Promise<WebElement>

Return a promise how will be resolved by the webelement corresponding to the currently selected option.

If no option is currently selected, returned promise will be rejected.

containOption(searchedOptionText: string): Promise<boolean>

Return a promise reolved by a truthy boolean if the searched option is found.

getAvailableOptions: Promise<string[]>

Return a promise resolved with an array of every option label.

Input

setValue(value: string): Promise<boolean>

Return a promise resolved when value has been updated.

If the input is marked as readonly or disabled, returned promise will be rejected.

Logger - My best friend

By design, this package does not print anything on output, wich can be a little harsh to debug.

To be able to understand what is done and when, a Logger is used internally. You can register as many callback as you want, and print onto console, write to a file, call WS, whatever.

OnLog((i: any): void)

Register the callback.

1.3.2

7 years ago

1.3.1

7 years ago

1.2.22

7 years ago

1.2.21

7 years ago

1.2.2

7 years ago

1.2.12

7 years ago

1.2.11

7 years ago

1.2.1

7 years ago

1.1.24

7 years ago

1.1.23

7 years ago

1.1.22

7 years ago

1.1.21

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.41

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago