Skip to content

Commit 112a6cd

Browse files
thePunderWomanAndrewKushnir
authored andcommitted
test(animations): Add bundling size regression test for animations package (angular#44826)
This adds a size regression test for the animations package to the test suite. PR Close angular#44826
1 parent e46ac81 commit 112a6cd

32 files changed

+8658
-1
lines changed

goldens/size-tracking/integration-payloads.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@
5757
}
5858
}
5959
},
60+
"animations": {
61+
"master": {
62+
"uncompressed": {
63+
"runtime": 1073,
64+
"main": 179008,
65+
"polyfills": 37242
66+
}
67+
}
68+
},
6069
"hello_world__closure": {
6170
"master": {
6271
"uncompressed": {
@@ -68,4 +77,4 @@
6877
}
6978
}
7079
}
71-
}
80+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
8+
# You can see what browsers were selected by your queries by running:
9+
# npx browserslist
10+
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
16+
Firefox ESR
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

integration/animations/.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
# Only exists if Bazel was run
8+
/bazel-out
9+
10+
# dependencies
11+
/node_modules
12+
13+
# profiling files
14+
chrome-profiler-events*.json
15+
speed-measure-plugin*.json
16+
17+
# IDEs and editors
18+
/.idea
19+
.project
20+
.classpath
21+
.c9/
22+
*.launch
23+
.settings/
24+
*.sublime-workspace
25+
26+
# IDE - VSCode
27+
.vscode/*
28+
!.vscode/settings.json
29+
!.vscode/tasks.json
30+
!.vscode/launch.json
31+
!.vscode/extensions.json
32+
.history/*
33+
34+
# misc
35+
/.sass-cache
36+
/connect.lock
37+
/coverage
38+
/libpeerconnection.log
39+
npm-debug.log
40+
yarn-error.log
41+
testem.log
42+
/typings
43+
44+
# System Files
45+
.DS_Store
46+
Thumbs.db

integration/animations/BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
load("//integration:index.bzl", "ng_integration_test")
2+
3+
ng_integration_test(
4+
name = "test",
5+
setup_chromium = True,
6+
track_payload_size = "animations",
7+
)

integration/animations/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Animations test app
2+
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli).
4+
5+
## Development server
6+
7+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
8+
9+
## Code scaffolding
10+
11+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12+
13+
## Build
14+
15+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
16+
17+
## Running unit tests
18+
19+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20+
21+
## Running end-to-end tests
22+
23+
Run `ng e2e` to execute the end-to-end tests via [Protractor](https://www.protractortest.org/).
24+
25+
## Further help
26+
27+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"animations": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:browser",
15+
"options": {
16+
"outputPath": "dist",
17+
"index": "src/index.html",
18+
"main": "src/main.ts",
19+
"polyfills": "src/polyfills.ts",
20+
"tsConfig": "tsconfig.app.json",
21+
"aot": true,
22+
"assets": [
23+
"src/favicon.ico",
24+
"src/assets"
25+
],
26+
"styles": [
27+
"src/styles.css"
28+
],
29+
"scripts": [],
30+
"progress": false
31+
},
32+
"configurations": {
33+
"production": {
34+
"fileReplacements": [
35+
{
36+
"replace": "src/environments/environment.ts",
37+
"with": "src/environments/environment.prod.ts"
38+
}
39+
],
40+
"optimization": true,
41+
"outputHashing": "all",
42+
"sourceMap": false,
43+
"namedChunks": false,
44+
"extractLicenses": true,
45+
"vendorChunk": false,
46+
"buildOptimizer": true,
47+
"budgets": [
48+
{
49+
"type": "initial",
50+
"maximumWarning": "2mb",
51+
"maximumError": "5mb"
52+
},
53+
{
54+
"type": "anyComponentStyle",
55+
"maximumWarning": "6kb",
56+
"maximumError": "10kb"
57+
}
58+
]
59+
}
60+
}
61+
},
62+
"serve": {
63+
"builder": "@angular-devkit/build-angular:dev-server",
64+
"options": {
65+
"browserTarget": "animations:build"
66+
},
67+
"configurations": {
68+
"dev": {
69+
"browserTarget": "animations:build:dev"
70+
},
71+
"production": {
72+
"browserTarget": "animations:build:production"
73+
},
74+
"ci": {},
75+
"ci-production": {
76+
"browserTarget": "animations:build:production"
77+
}
78+
}
79+
},
80+
"extract-i18n": {
81+
"builder": "@angular-devkit/build-angular:extract-i18n",
82+
"options": {
83+
"browserTarget": "animations:build"
84+
}
85+
},
86+
"test": {
87+
"builder": "@angular-devkit/build-angular:karma",
88+
"options": {
89+
"main": "src/test.ts",
90+
"polyfills": "src/polyfills.ts",
91+
"tsConfig": "tsconfig.spec.json",
92+
"karmaConfig": "karma.conf.js",
93+
"assets": [
94+
"src/favicon.ico",
95+
"src/assets"
96+
],
97+
"styles": [
98+
"src/styles.css"
99+
],
100+
"scripts": [],
101+
"progress": false,
102+
"watch": false
103+
}
104+
},
105+
"lint": {
106+
"builder": "@angular-devkit/build-angular:tslint",
107+
"options": {
108+
"tsConfig": [
109+
"tsconfig.app.json",
110+
"tsconfig.spec.json",
111+
"e2e/tsconfig.json"
112+
],
113+
"exclude": [
114+
"**/node_modules/**"
115+
]
116+
}
117+
},
118+
"e2e": {
119+
"builder": "@angular-devkit/build-angular:protractor",
120+
"options": {
121+
"protractorConfig": "e2e/protractor.conf.js",
122+
"devServerTarget": "animations:serve",
123+
"webdriverUpdate": false
124+
},
125+
"configurations": {
126+
"production": {
127+
"devServerTarget": "animations:serve:production"
128+
},
129+
"ci": {
130+
"devServerTarget": "animations:serve:ci"
131+
},
132+
"ci-production": {
133+
"devServerTarget": "animations:serve:ci-production"
134+
}
135+
}
136+
}
137+
}
138+
}
139+
},
140+
"defaultProject": "animations"
141+
}
Lines changed: 37 additions & 0 deletions
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+
const { SpecReporter } = require('jasmine-spec-reporter');
5+
6+
/**
7+
* @type { import("protractor").Config }
8+
*/
9+
exports.config = {
10+
allScriptsTimeout: 11000,
11+
specs: [
12+
'./src/**/*.e2e-spec.ts'
13+
],
14+
chromeDriver: process.env.CHROMEDRIVER_BIN,
15+
capabilities: {
16+
browserName: 'chrome',
17+
chromeOptions: {
18+
binary: process.env.CHROME_BIN,
19+
// See /integration/README.md#browser-tests for more info on these args
20+
args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio']
21+
},
22+
},
23+
directConnect: true,
24+
baseUrl: 'http://localhost:4200/',
25+
framework: 'jasmine',
26+
jasmineNodeOpts: {
27+
showColors: true,
28+
defaultTimeoutInterval: 30000,
29+
print: function() {}
30+
},
31+
onPrepare() {
32+
require('ts-node').register({
33+
project: require('path').join(__dirname, './tsconfig.json')
34+
});
35+
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
36+
}
37+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {browser, logging} from 'protractor';
2+
3+
import {AppPage} from './app.po';
4+
5+
describe('animations app', () => {
6+
let page: AppPage;
7+
8+
beforeEach(() => {
9+
page = new AppPage();
10+
});
11+
12+
it('should display title', () => {
13+
page.navigateTo();
14+
expect(page.getTitleText()).toEqual('Animations app');
15+
});
16+
17+
afterEach(async () => {
18+
// Assert that there are no errors emitted from the browser
19+
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
20+
expect(logs).not.toContain(jasmine.objectContaining({
21+
level: logging.Level.SEVERE,
22+
} as logging.Entry));
23+
});
24+
});
Lines changed: 11 additions & 0 deletions
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+
navigateTo() {
5+
return browser.get(browser.baseUrl) as Promise<any>;
6+
}
7+
8+
getTitleText() {
9+
return element(by.css('app-root h1')).getText() as Promise<string>;
10+
}
11+
}

0 commit comments

Comments
 (0)