Nightmarish Pawnshop Mystic
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

protractor-html-validate

1.3.0 • Public • Published

Protractor html-validate plugin

Validates HTML using html-validate before, during and after tests. It automatically fetches the active source markup from the browser and validates, failing the test if any validation errors is encountered. Manual checks can be added as needed.

Note: currently only jasmine is supported.

  • Each browser.get(..) triggers a validation.
  • Each test triggers a validation after running (afterEach).
  • Manual validations via browser.htmlvalidate().

Usage

In protractor.conf.js:

{
    plugins: [
        /* load plugin */
        {package: 'protractor-html-validate'}
    ],
    
    onPrepare: () => {
        /* load jasmine helper */
        require('protractor-html-validate/jasmine');
    }
}

In specs:

Each browser.get(..) and afterEach will trigger a validation.

To manually verify use expect(browser.htmlvalidate()).toBeValid(), e.g.:

it('should be valid', () => {
    myPage.clickButton(); /* shows something */
    expect(browser.htmlvalidate()).toBeValid();
    myPage.clickAnotherButton(); /* hides something */
});

Configuration

html-validate configuration can be passed in protractor.conf.js:

{
    plugins: [
        {package: 'protractor-html-validate', config: {
            plugins: [
                'my-fancy-plugin',
            ],
            rules: {
                'foo': 'error',
            },
        }}
    ],
}

install

npm i protractor-html-validate

Downloadsweekly downloads

17

version

1.3.0

license

MIT

repository

Gitgit

last publish

collaborators

  • avatar
Report a vulnerability