Mercurial > gemma
view client/tests/e2e/custom-assertions/elementCount.js @ 1578:ca9bd1ce26e5
Fix backend Dockerfile
ca-certificates is needed to fetch go dependencies via https.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 13 Dec 2018 14:57:39 +0100 |
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); };