feat(bazel): Initial commit of protractor_web_test_suite (#24787)

Co-authored-by: Andrew Z Allen <me@andrewzallen.com>

PR Close #24787
This commit is contained in:
mrmeku
2018-04-09 00:53:31 -06:00
committed by Matias Niemelä
parent 0399c6972a
commit 71e0df039c
10 changed files with 224 additions and 0 deletions

View File

@ -0,0 +1,14 @@
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "ts_spec",
testonly = True,
srcs = ["test.spec.ts"],
)
protractor_web_test_suite(
name = "demo",
conf = "conf.js",
deps = [":ts_spec"],
)

View File

@ -0,0 +1,29 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @fileoverview A demo of what a user's conf.js file might look like.
*/
const http = require('http');
const PORT = 3000;
exports.config = {
baseUrl: `http://localhost:${PORT}`,
onPrepare() {
const app = new http.Server();
app.on('request', (req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Hello World');
res.end('\n');
});
return new Promise(resolve => { app.listen(PORT, () => { resolve(); }); });
}
};

View File

@ -0,0 +1,20 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*
* @fileoverview A small demo of how to run a protractor test.
*/
import {$, browser} from 'protractor';
describe('Basic test', () => {
it('should say hello world', () => {
browser.waitForAngularEnabled(false);
browser.get('/');
expect($('body').getText()).toContain('Hello World');
});
});