Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/javascript/selenium-webdriver/lib/test/index.js
4500 views
1
// Licensed to the Software Freedom Conservancy (SFC) under one
2
// or more contributor license agreements. See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership. The SFC licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License. You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied. See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
'use strict'
19
20
//const build = require('./build')
21
const fileserver = require('./fileserver')
22
const testing = require('selenium-webdriver/testing')
23
24
//const NO_BUILD = /^1|true$/i.test(process.env['SELENIUM_NO_BUILD'])
25
26
/**
27
* @param {function(!testing.Environment)} fn The top level suite function.
28
* @param {testing.SuiteOptions=} options Suite specific options.
29
*/
30
function suite(fn, options = undefined) {
31
testing.suite(function (env) {
32
/*
33
before(function () {
34
if (false && !NO_BUILD) {
35
return build
36
.of(
37
'//javascript/atoms/fragments:is-displayed',
38
'//javascript/webdriver/atoms:get-attribute'
39
)
40
.onlyOnce()
41
.go()
42
}
43
})
44
*/
45
fn(env)
46
}, options)
47
}
48
49
// GLOBAL TEST SETUP
50
51
process.on('unhandledRejection', (reason) => {
52
console.error('Unhandled promise rejection:', reason)
53
})
54
55
testing.init()
56
57
before(function () {
58
// Do not pass register fileserver.start directly with testing.before,
59
// as start takes an optional port, which before assumes is an async
60
// callback.
61
return fileserver.start()
62
})
63
64
after(function () {
65
return fileserver.stop()
66
})
67
68
// PUBLIC API
69
70
exports.suite = suite
71
exports.ignore = testing.ignore
72
exports.Pages = fileserver.Pages
73
exports.whereIs = fileserver.whereIs
74
75