Path: blob/trunk/javascript/selenium-webdriver/lib/test/index.js
4500 views
// Licensed to the Software Freedom Conservancy (SFC) under one1// or more contributor license agreements. See the NOTICE file2// distributed with this work for additional information3// regarding copyright ownership. The SFC licenses this file4// to you under the Apache License, Version 2.0 (the5// "License"); you may not use this file except in compliance6// with the License. You may obtain a copy of the License at7//8// http://www.apache.org/licenses/LICENSE-2.09//10// Unless required by applicable law or agreed to in writing,11// software distributed under the License is distributed on an12// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY13// KIND, either express or implied. See the License for the14// specific language governing permissions and limitations15// under the License.1617'use strict'1819//const build = require('./build')20const fileserver = require('./fileserver')21const testing = require('selenium-webdriver/testing')2223//const NO_BUILD = /^1|true$/i.test(process.env['SELENIUM_NO_BUILD'])2425/**26* @param {function(!testing.Environment)} fn The top level suite function.27* @param {testing.SuiteOptions=} options Suite specific options.28*/29function suite(fn, options = undefined) {30testing.suite(function (env) {31/*32before(function () {33if (false && !NO_BUILD) {34return build35.of(36'//javascript/atoms/fragments:is-displayed',37'//javascript/webdriver/atoms:get-attribute'38)39.onlyOnce()40.go()41}42})43*/44fn(env)45}, options)46}4748// GLOBAL TEST SETUP4950process.on('unhandledRejection', (reason) => {51console.error('Unhandled promise rejection:', reason)52})5354testing.init()5556before(function () {57// Do not pass register fileserver.start directly with testing.before,58// as start takes an optional port, which before assumes is an async59// callback.60return fileserver.start()61})6263after(function () {64return fileserver.stop()65})6667// PUBLIC API6869exports.suite = suite70exports.ignore = testing.ignore71exports.Pages = fileserver.Pages72exports.whereIs = fileserver.whereIs737475