Mercurial > gemma
view client/tests/e2e/custom-assertions/elementCount.js @ 4751:dbf07d0c364e
SR import: If the point density is greater than 0.2 values per meter² the interpolating step is omitted.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 18 Oct 2019 17:07:24 +0200 |
parents | 0c5cbbafbd94 |
children |
line wrap: on
line source
/* This is Free Software under GNU Affero General Public License v >= 3.0 * without warranty, see README.md and license for details. * * SPDX-License-Identifier: AGPL-3.0-or-later * License-Filename: LICENSES/AGPL-3.0.txt * * Copyright (C) 2018 by via donau * – Österreichische Wasserstraßen-Gesellschaft mbH * Software engineering by Intevation GmbH * * Author(s): * Thomas Junk <thomas.junk@intevation.de> */ // A custom Nightwatch assertion. // The assertion name is the filename. // Example usage: // // browser.assert.elementCount(selector, count) // // For more information on custom assertions see: // http://nightwatchjs.org/guide#writing-custom-assertions exports.assertion = function elementCount(selector, count) { this.message = `Testing if element <${selector}> has count: ${count}`; this.expected = count; this.pass = val => val === count; this.value = res => res.value; function evaluator(_selector) { return document.querySelectorAll(_selector).length; } this.command = cb => this.api.execute(evaluator, [selector], cb); };