Mercurial > gemma
view client/tests/e2e/custom-assertions/elementCount.js @ 3635:6d6577a87963
Do not show missing date as Unix epoch
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 11 Jun 2019 20:28:38 +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); };