Skip to content

Commit bffbc8c

Browse files
committed
Initial commit
0 parents  commit bffbc8c

19 files changed

+15988
-0
lines changed

.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.ts]
12+
quote_type = single
13+
14+
[*.md]
15+
max_line_length = off
16+
trim_trailing_whitespace = false

.gitignore

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# Compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
/bazel-out
8+
9+
# Node
10+
/node_modules
11+
npm-debug.log
12+
yarn-error.log
13+
14+
# IDEs and editors
15+
.idea/
16+
.project
17+
.classpath
18+
.c9/
19+
*.launch
20+
.settings/
21+
*.sublime-workspace
22+
23+
# Visual Studio Code
24+
25+
.vs
26+
.vscode/*
27+
!.vscode/settings.json
28+
!.vscode/tasks.json
29+
!.vscode/launch.json
30+
!.vscode/extensions.json
31+
.history/*
32+
33+
# Miscellaneous
34+
/.angular/cache
35+
.sass-cache/
36+
/connect.lock
37+
/coverage
38+
/libpeerconnection.log
39+
testem.log
40+
/typings
41+
42+
# System files
43+
.DS_Store
44+
Thumbs.db

angular.json

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"angular.io-example": {
7+
"projectType": "application",
8+
"root": "",
9+
"sourceRoot": "src",
10+
"prefix": "app",
11+
"architect": {
12+
"build": {
13+
"builder": "@angular-devkit/build-angular:application",
14+
"options": {
15+
"outputPath": "dist",
16+
"index": "src/index.html",
17+
"browser": "src/main.ts",
18+
"polyfills": ["zone.js"],
19+
"tsConfig": "tsconfig.app.json",
20+
"assets": [
21+
"src/favicon.ico",
22+
"src/assets"
23+
],
24+
"styles": [
25+
"src/styles.css"
26+
],
27+
"scripts": []
28+
},
29+
"configurations": {
30+
"production": {
31+
"budgets": [
32+
{
33+
"type": "initial",
34+
"maximumWarning": "500kb",
35+
"maximumError": "1mb"
36+
},
37+
{
38+
"type": "anyComponentStyle",
39+
"maximumWarning": "2kb",
40+
"maximumError": "4kb"
41+
}
42+
],
43+
"outputHashing": "all"
44+
},
45+
"development": {
46+
"optimization": false,
47+
"extractLicenses": false,
48+
"sourceMap": true
49+
}
50+
},
51+
"defaultConfiguration": "production"
52+
},
53+
"serve": {
54+
"builder": "@angular-devkit/build-angular:dev-server",
55+
"configurations": {
56+
"production": {
57+
"buildTarget": "angular.io-example:build:production"
58+
},
59+
"development": {
60+
"buildTarget": "angular.io-example:build:development"
61+
}
62+
},
63+
"defaultConfiguration": "development"
64+
},
65+
"extract-i18n": {
66+
"builder": "@angular-devkit/build-angular:extract-i18n",
67+
"options": {
68+
"buildTarget": "angular.io-example:build"
69+
}
70+
},
71+
"test": {
72+
"builder": "@angular-devkit/build-angular:karma",
73+
"options": {
74+
"polyfills": ["zone.js", "zone.js/testing"],
75+
"tsConfig": "tsconfig.spec.json",
76+
"assets": [
77+
"src/favicon.ico",
78+
"src/assets"
79+
],
80+
"styles": [
81+
"src/styles.css"
82+
],
83+
"scripts": []
84+
}
85+
},
86+
"e2e": {
87+
"builder": "@angular-devkit/build-angular:protractor",
88+
"options": {
89+
"protractorConfig": "e2e/protractor.conf.js",
90+
"devServerTarget": "angular.io-example:serve"
91+
},
92+
"configurations": {
93+
"production": {
94+
"devServerTarget": "angular.io-example:serve:production"
95+
}
96+
}
97+
}
98+
}
99+
}
100+
}
101+
}

e2e/protractor.conf.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// @ts-check
2+
// Protractor configuration file, see link for more information
3+
// https://github.com/angular/protractor/blob/master/lib/config.ts
4+
5+
const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter');
6+
7+
/**
8+
* @type { import("protractor").Config }
9+
*/
10+
exports.config = {
11+
allScriptsTimeout: 11000,
12+
specs: [
13+
'./src/**/*.e2e-spec.ts'
14+
],
15+
capabilities: {
16+
browserName: 'chrome'
17+
},
18+
directConnect: true,
19+
SELENIUM_PROMISE_MANAGER: false,
20+
baseUrl: 'http://localhost:4200/',
21+
framework: 'jasmine',
22+
jasmineNodeOpts: {
23+
showColors: true,
24+
defaultTimeoutInterval: 30000,
25+
print: function() {}
26+
},
27+
onPrepare() {
28+
require('ts-node').register({
29+
project: require('path').join(__dirname, './tsconfig.json')
30+
});
31+
jasmine.getEnv().addReporter(new SpecReporter({
32+
spec: {
33+
displayStacktrace: StacktraceOption.PRETTY
34+
}
35+
}));
36+
}
37+
};

e2e/src/app.e2e-spec.ts

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { browser, element, by, logging } from 'protractor';
2+
3+
describe('Template-reference-variables-example', () => {
4+
beforeEach(() => browser.get(''));
5+
6+
// helper function used to test what's logged to the console
7+
async function logChecker(contents: string) {
8+
const logs = await browser
9+
.manage()
10+
.logs()
11+
.get(logging.Type.BROWSER);
12+
const messages = logs.filter(({ message }) => message.indexOf(contents) !== -1);
13+
expect(messages.length).toBeGreaterThan(0);
14+
}
15+
16+
it('should display Template reference variables', async () => {
17+
expect(await element(by.css('h1')).getText()).toEqual(
18+
'Template reference variables'
19+
);
20+
});
21+
22+
it('should log a Calling 123 ... message', async () => {
23+
const callButton = element.all(by.css('button')).get(0);
24+
const phoneInput = element.all(by.css('input')).get(0);
25+
await phoneInput.sendKeys('123');
26+
await callButton.click();
27+
const contents = 'Calling 123 ...';
28+
await logChecker(contents);
29+
});
30+
31+
it('should submit form', async () => {
32+
const submitButton = element.all(by.css('button')).get(2);
33+
const nameInput = element.all(by.css('input')).get(1);
34+
await nameInput.sendKeys('123');
35+
await submitButton.click();
36+
expect(await element.all(by.css('div > p')).get(2).getText()).toEqual('Submitted. Form value is {"name":"123"}');
37+
});
38+
39+
});

e2e/src/app.po.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { browser, by, element } from 'protractor';
2+
3+
export class AppPage {
4+
async navigateTo(): Promise<unknown> {
5+
return browser.get(browser.baseUrl);
6+
}
7+
8+
async getTitleText(): Promise<string> {
9+
return element(by.css('app-root h1')).getText();
10+
}
11+
}

e2e/tsconfig.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* To learn more about this file see: https://angular.io/guide/typescript-configuration. */
2+
{
3+
"extends": "../tsconfig.json",
4+
"compilerOptions": {
5+
"outDir": "../out-tsc/e2e",
6+
"module": "commonjs",
7+
"target": "es2018",
8+
"types": [
9+
"jasmine",
10+
"node"
11+
]
12+
}
13+
}

0 commit comments

Comments
 (0)