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 | /** |
19 | * @fileoverview Defines a library that simplifies writing assertions against |
20 | * promised values. |
21 | * |
22 | * > <hr> |
23 | * > __NOTE:__ This module is considered experimental and is subject to |
24 | * > change, or removal, at any time! |
25 | * > <hr> |
26 | * |
27 | * Sample usage: |
28 | * |
29 | * var driver = new webdriver.Builder().build(); |
30 | * driver.get('http://www.google.com'); |
31 | * |
32 | * assert(driver.getTitle()).equalTo('Google'); |
33 | */ |
34 | |
35 | var base = require('../_base'), |
36 | assert = base.require('webdriver.testing.assert'); |
37 | |
38 | |
39 | // PUBLIC API |
40 | |
41 | |
42 | /** |
43 | * Creates a new assertion. |
44 | * @param {*} value The value to perform an assertion on. |
45 | * @return {!webdriver.testing.Assertion} The new assertion. |
46 | */ |
47 | module.exports = function(value) { |
48 | return assert(value); |
49 | }; |
50 | |
51 | |
52 | /** |
53 | * Registers a new assertion to expose from the |
54 | * {@link webdriver.testing.Assertion} prototype. |
55 | * @param {string} name The assertion name. |
56 | * @param {(function(new: goog.labs.testing.Matcher, *)| |
57 | * {matches: function(*): boolean, |
58 | * describe: function(): string})} matcherTemplate Either the |
59 | * matcher constructor to use, or an object literal defining a matcher. |
60 | */ |
61 | module.exports.register = assert.register; |