# appmodel-protractor

[appmodel-protractor](https://github.com/h20dragon/appmodel-protractor) provides application modeling support for Selenium based test frameworks.  This will benefit in smaller pageObjects with more scalability.

# Benefits
1. Reduce footprint of pageObjects.
1. Promote scalability of pageObjects across different test frameworks (e.g. programming languages).
1. Separate data from functions.
1. Easily add requirements while defining pageObjects vs. managing (coding) assertions at the test-script level.
1. No impacts to existing test frameworks - an alternative/optional/hybrid test library for Selenium/WebDriverJs based frameworks.
1. Minimize the time to delivery by using simple, yet powerful, commands vs. having to learn the inner details of protractor.

# Development

## Install
npm install

## Build
npm run build

## Unit Tests
npm test


# Commands

## Type into Element
1. type()
  Returns true/false.
1. asyncType()
  Returns the value of the element after the sendKeys().
1. Working with Alerts
   ```
               describe('Verify Alert', () => {

                 let expectedAlert;

                 beforeAll(() => {
                   expectedAlert = cmdMgr.getAlert();
                 });

                 it('should display alert', () => {
                   expect(expectedAlert.exists()).to.be.true;
                 })

                 it('should ',  (done) => {

                     expectedAlert.getText().then((s) => {
                         console.log("Alert text: " + s);
                         done();
                     })
                 });

               })
   ```

# How to use appmodel-protractor in your existing Protractor tests.
1.  npm install --save-dev  appmodel-protractor
1.  Create model files (using JSON format).
1.  Test (or spec) file
a. Add dependency:
```
let AppModelMgr = require('appmodel-protractor');
```
a. Create an instance of AppModelMgr and load your model files.
```
let appMgr = AppModelMgr.createMgr("My Auto Tests");
appMgr.load('./myModelFiles/login.page.json');
appMgr.load('/project/Elvis/graceland.json');
```

# Modeling

## visible_when



