🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

nemo-objects

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nemo-objects

Easily implement and use the Page Object pattern in your nemo based tests

0.1.0
latest
npm
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

Nemo Objects

Easily implement and use the Page Object pattern in your nemo based tests, by using a simple api, mostly inspired by the ember-cli-page-object ember addon, widely used in the ember ecosystem for functional and integration testing.

Installation

  npm install --save nemo-objects

Usage

Configuring the nemo plugin

In your nemo configuration, with an absolute path specify where your page objects are.

  {
    "plugins": {
      "nemo-objects": {
        "module": "nemo-objects",
        "arguments": [
          {
            "pagesLocation": "/path/to/page-objects"
          }
        ]
      }
    }   
  }

Creating a page object

At the specified location, for any given file found a page object will be created at the nemo.objects namespace. For example, if a file named countryCenter.js is found, then a page object is created as nemo.object.countryCenter.

At the countryCenter.js file, a page-object can be declared as follows:

  'use strict';

  module.exports = function countryCenterPage(pageObject, nemo) {
    const { visitable, collection, text } = pageObject;

    return {
      visit: visitable(`${nemo.data.url}/country-center`),
      countries: collection({
        scope: '.country-list',
        itemScope: 'ul li',
        item: {
          countryName: text('span')
        }
      })
    };
  };

Which later can be used at your functional tests as:

  // all the setup code for your nemo environment
  // The `nemo` variable is made available here

  describe('At the country center page', () => {
    it('All user countries are shown', async () => {
      const { countryCenter } = nemo.objects;

      await countryCenter.visit();
      const countries = await countryCenter.countries();
      
      expect(countries.length).to.be.equal(4, 'the number of countries matches the user settings');
    });
  });

API

Plugin configuration

  • options
    • pagesLocation - An absolute path indicating where you page objects are

Page objects

Each module located at the specified location should export a function, which receives the following arguments:

  • pageObject - Holds the pageObject helper functions to be used along with your page objects
  • nemo - The nemo instance

Each module is expected to return an object describing the page object.

Keywords

nemo

FAQs

Package last updated on 27 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts