Skip to content

Commit

Permalink
Heroes App
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrotomassini committed Feb 23, 2022
1 parent 77ee995 commit d73cb9a
Show file tree
Hide file tree
Showing 50 changed files with 21,357 additions and 9,775 deletions.
1 change: 1 addition & 0 deletions workspace/05-heroesApp/.browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
24 changes: 14 additions & 10 deletions workspace/05-heroesApp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# Node
# dependencies
/node_modules
npm-debug.log
yarn-error.log

# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json

# IDEs and editors
.idea/
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System files
# System Files
.DS_Store
Thumbs.db
4 changes: 0 additions & 4 deletions workspace/05-heroesApp/.vscode/extensions.json

This file was deleted.

20 changes: 0 additions & 20 deletions workspace/05-heroesApp/.vscode/launch.json

This file was deleted.

42 changes: 0 additions & 42 deletions workspace/05-heroesApp/.vscode/tasks.json

This file was deleted.

6 changes: 3 additions & 3 deletions workspace/05-heroesApp/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# HeroesApp

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.4.
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.0.2.

## Development server

Expand All @@ -12,15 +12,15 @@ Run `ng generate component component-name` to generate a new component. You can

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
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.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).

## Further help

Expand Down
70 changes: 46 additions & 24 deletions workspace/05-heroesApp/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/heroes-app",
"outputPath": "dist/heroesApp",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
Expand All @@ -34,6 +35,19 @@
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
Expand All @@ -45,37 +59,20 @@
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
]
}
},
"defaultConfiguration": "production"
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "heroesApp:build"
},
"configurations": {
"production": {
"browserTarget": "heroesApp:build:production"
},
"development": {
"browserTarget": "heroesApp:build:development"
}
},
"defaultConfiguration": "development"
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
Expand All @@ -100,6 +97,31 @@
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "heroesApp:serve"
},
"configurations": {
"production": {
"devServerTarget": "heroesApp:serve:production"
}
}
}
}
}
Expand Down
37 changes: 37 additions & 0 deletions workspace/05-heroesApp/e2e/protractor.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter');

/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
browserName: 'chrome'
},
directConnect: true,
SELENIUM_PROMISE_MANAGER: false,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({
spec: {
displayStacktrace: StacktraceOption.PRETTY
}
}));
}
};
23 changes: 23 additions & 0 deletions workspace/05-heroesApp/e2e/src/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';

describe('workspace-project App', () => {
let page: AppPage;

beforeEach(() => {
page = new AppPage();
});

it('should display welcome message', async () => {
await page.navigateTo();
expect(await page.getTitleText()).toEqual('heroesApp app is running!');
});

afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});
11 changes: 11 additions & 0 deletions workspace/05-heroesApp/e2e/src/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { browser, by, element } from 'protractor';

export class AppPage {
async navigateTo(): Promise<unknown> {
return browser.get(browser.baseUrl);
}

async getTitleText(): Promise<string> {
return element(by.css('app-root .content span')).getText();
}
}
13 changes: 13 additions & 0 deletions workspace/05-heroesApp/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es2018",
"types": [
"jasmine",
"node"
]
}
}
8 changes: 1 addition & 7 deletions workspace/05-heroesApp/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,13 @@ module.exports = function (config) {
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/heroes-app'),
dir: require('path').join(__dirname, './coverage/heroesApp'),
subdir: '.',
reporters: [
{ type: 'html' },
Expand Down
Loading

0 comments on commit d73cb9a

Please sign in to comment.