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:
14
packages/bazel/test/protractor/BUILD.bazel
Normal file
14
packages/bazel/test/protractor/BUILD.bazel
Normal 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"],
|
||||
)
|
29
packages/bazel/test/protractor/conf.js
Normal file
29
packages/bazel/test/protractor/conf.js
Normal 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(); }); });
|
||||
}
|
||||
};
|
20
packages/bazel/test/protractor/test.spec.ts
Normal file
20
packages/bazel/test/protractor/test.spec.ts
Normal 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');
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user