# protractor-components

> Simple component builder for protractor

Latest version **1.1.8** (published 2019-08-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install protractor-components
pnpm add protractor-components
yarn add protractor-components
bun add protractor-components
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.8 |
| Published | 2019-08-06 |
| First published | 2019-07-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 112.6 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | vitalics |
| Maintainers | vitalicset |
| Keywords | protractor, components |

## Links

- npm: https://www.npmjs.com/package/protractor-components
- Repository: https://github.com/vitalics/protractor-components
- Homepage: https://github.com/vitalics/protractor-components#readme
- Issues: https://github.com/vitalics/protractor-components/issues
- npm.io page: https://npm.io/package/protractor-components

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.19.0
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13

## Recent versions

- 1.1.8 (latest) — 2019-08-06
- 1.1.7 — 2019-07-24
- 1.1.6 — 2019-07-24
- 1.1.5 — 2019-07-24
- 1.1.4 — 2019-07-24
- 1.1.3 — 2019-07-24
- 1.1.2 — 2019-07-24
- 1.1.1 — 2019-07-24
- 1.1.0 — 2019-07-23
- 1.0.1 — 2019-07-22
- 1.0.0 — 2019-07-22

## README

# protractor-components
Simple component builder for protractor projects

## Installing
`npm i protractor-components`

## API

### `Component`
simple class that can get only the common things like `getText`, `getAttribute`, `getCssValue`, etc.

As protractor, all these common types return `Promise`

`Component.prototype.root` - root element that find when you call constructor(`new` keyword). 

### `Collection`
Collection like `ElementArrayFinder`, but you can use `for await ... of` syntax

## Example

``` ts
// reason.component.ts
import { Component } from 'protractor-components';
import { $ } from 'protractor';

export class Reason extends Component {
    constructor() {
        super($('.row.first .span4'));
    }
    getHeader() {
        return this.$('.text-display-1').getText();
    }

    getBody() {
        return this.$('.text-body').getText();
    }
}


// e2e.ts
import { $ } from 'protractor';
import { Reason } from './reason.component';

describe('...', () =>{
    it('...', async ()=>{
        const reason = new Reason();
        const header = awaitreason.getHeader();
        expect(typeof header).toBe('string';
    })
})
```
`collection` example
``` ts
import { $$ } from 'protractor';
import { Collection } from 'protractor-components';

import { Reason } from './reason.component';

export class ReasonCollection extends Collection<Reason>{
    constructor(){
        super($$('.row.first .span4'), Reason);
    }
}
```


## TODO

- [x] JSDoc from protractor for `Component` and `Collection`
- [x] more comprehensive types
- [x] more common components(`Form`, `Selector`, `MultipleSelector`, `Checkbox`, `RadioButton`, `Input`(color picker, range, date, upload) , `Table`)
- [x] add module `protractor-components/common`
- [] add API for angular(window.ng.probe function) and react(resq library) components

---
_Source: https://npm.io/package/protractor-components · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
