appmodel v1.0.3-rc.2
Welcome to AppModel
appmodeljs provides application modeling support specific modeling your application components (including pages) for UI testing.
appmodel
Installation
npm install --save-dev appmodel
Basics
Create an application model with JSON format files
TBD
Leverage appmodel in your existing Protractor (Selenium-WebDriverJS) tests.
Selenium WebDriverJS, Protractor
appmodeljs provides support to Protractor - to generate By objects.
Constructor() and loading model files (JSON).
var AppModelMgr = require('appmodel');
/* Specify that we are using Protractor.
* This will ensure that By.* objects are Protractor compliant.
*/
var mgr = AppModelMgr('Elvis App', true);
// Load a series of our models (e.g. page objects) defined in JSON format files.
mgr.add('/mydata/login.json');
mgr.add('/mydata/main_nav.json');
mgr.add('/mydata/sidenav.json');
var protractor_locator = **mgr.locator('page(Login).get(userid)')**;
element(protractor_locator).sendKeys('Elvis');
..
..
highlight(locator)
it('should highlight', (done) => {
let appModel = AppModelMgr.createMgr("Test");
appModel.load(dut);
appModel.highlight('page(login).get(locale)', 'Red').then( (rc) => {
expect(rc).toBe(true);
done();
})
})
load
Load a modeling file (JSON) which includes generating their respective page objects.
```
const dut = process.cwd() + '/test/data/page.json';
let appModel = AppModelMgr.createMgr("Test");
appModel.load(dut);
```
selectBy - will be deprecated - use select()
describe('AppModel - selection', () => {
const dut = process.cwd() + '/test/data/page.json';
it('should switch to polski', (done) => {
let appModel = AppModelMgr.createMgr("Test");
appModel.load(dut);
appModel.selectBy('page(login).get(locale)',
{ by: 'value',
description: '#selectLang>option[value="ja"]',
from: '#selectLang>option[value="ja"]',
value: 'ja'}).
then( (rc) => {
expect(rc).toBe(true);
done();
});
})
...
select
Selection from a select (or Dropdown) component by providing a locator, of the select/dropdown element, and the target select item.
Select by text (String)
it('should select using text', (done) => { let appModel = AppModelMgr.createMgr("Test"); appModel.load(dut); appModel.select('page(login).get(locale)', 'Korean'). then( (rc) => { expect(rc).toBe(true); return rc; }).then(() => { setTimeout(function() { console.log("SLEEP"); done(); }, 5000); }); })
Select by Value
it('should select with value', (done) => { let appModel = AppModelMgr.createMgr("Test"); appModel.load(dut); appModel.select('page(login).get(locale)', { by: 'value', value: 'VI' }). then( (rc) => { expect(rc).toBe(true); return rc; }).then(() => { setTimeout(function() { done(); }, 5000); }); })
Select by Index
it('should select with index', (done) => { let appModel = AppModelMgr.createMgr("Test"); appModel.load(dut); appModel.select('page(login).get(locale)', { by: 'index', index: 10 }). then( (rc) => { expect(rc).toBe(true); return rc; }).then(() => { setTimeout(function() { console.log("SLEEP"); done(); }, 5000); }); })
For more details see GitHub Flavored Markdown.
Jekyll Themes
Your Pages site will use the layout and styles from the Jekyll theme you have selected in your repository settings. The name of this theme is saved in the Jekyll _config.yml
configuration file.
Support or Contact for markup
Having trouble with Pages? Check out our documentation or contact support and we’ll help you sort it out.
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago