Skip to content

Commit 5cde83b

Browse files
committed
test(angular): add ng19 test app
1 parent f6188c4 commit 5cde83b

File tree

249 files changed

+21777
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

249 files changed

+21777
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
# You can see what browsers were selected by your queries by running:
6+
# npx browserslist
7+
8+
> 0.5%
9+
last 2 versions
10+
Firefox ESR
11+
not dead
12+
not IE 9-11 # For IE 9-11 support, remove 'not'.
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
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": [
4+
"projects/**/*"
5+
],
6+
"overrides": [
7+
{
8+
"files": [
9+
"*.ts"
10+
],
11+
"parserOptions": {
12+
"project": [
13+
"tsconfig.json",
14+
"e2e/tsconfig.json"
15+
],
16+
"createDefaultProgram": true
17+
},
18+
"extends": [
19+
"plugin:@angular-eslint/recommended",
20+
"plugin:@angular-eslint/template/process-inline-templates"
21+
],
22+
"rules": {
23+
"@angular-eslint/component-selector": [
24+
"error",
25+
{
26+
"prefix": "app",
27+
"style": "kebab-case",
28+
"type": "element"
29+
}
30+
],
31+
"@angular-eslint/directive-selector": [
32+
"error",
33+
{
34+
"prefix": "app",
35+
"style": "camelCase",
36+
"type": "attribute"
37+
}
38+
]
39+
}
40+
},
41+
{
42+
"files": [
43+
"*.html"
44+
],
45+
"extends": [
46+
"plugin:@angular-eslint/template/recommended"
47+
],
48+
"rules": {}
49+
}
50+
]
51+
}
Lines changed: 44 additions & 0 deletions
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+
8+
# dependencies
9+
/node_modules
10+
11+
# profiling files
12+
chrome-profiler-events.json
13+
speed-measure-plugin.json
14+
15+
# IDEs and editors
16+
/.idea
17+
.project
18+
.classpath
19+
.c9/
20+
*.launch
21+
.settings/
22+
*.sublime-workspace
23+
24+
# IDE - VSCode
25+
.vscode/*
26+
!.vscode/settings.json
27+
!.vscode/tasks.json
28+
!.vscode/launch.json
29+
!.vscode/extensions.json
30+
31+
# misc
32+
/.angular/cache
33+
/.sass-cache
34+
/connect.lock
35+
/coverage
36+
/libpeerconnection.log
37+
npm-debug.log
38+
yarn-error.log
39+
testem.log
40+
/typings
41+
42+
# System Files
43+
.DS_Store
44+
Thumbs.db
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"test-app": {
7+
"root": "",
8+
"sourceRoot": "src",
9+
"projectType": "application",
10+
"prefix": "app",
11+
"schematics": {},
12+
"architect": {
13+
"build": {
14+
"builder": "@angular/build:application",
15+
"options": {
16+
"outputPath": {
17+
"base": "dist/test-app"
18+
},
19+
"index": "src/index.html",
20+
"tsConfig": "tsconfig.app.json",
21+
"assets": [
22+
"src/favicon.ico",
23+
{
24+
"glob": "**/*",
25+
"input": "src/assets",
26+
"output": "assets"
27+
},
28+
{
29+
"glob": "**/*.svg",
30+
"input": "node_modules/ionicons/dist/ionicons/svg",
31+
"output": "./svg"
32+
}
33+
],
34+
"styles": [
35+
"src/styles.css"
36+
],
37+
"scripts": [],
38+
"browser": "src/main.ts",
39+
"server": "src/main.server.ts",
40+
"prerender": true,
41+
"ssr": {
42+
"entry": "src/server.ts"
43+
}
44+
},
45+
"configurations": {
46+
"production": {
47+
"fileReplacements": [
48+
{
49+
"replace": "src/environments/environment.ts",
50+
"with": "src/environments/environment.prod.ts"
51+
}
52+
],
53+
"optimization": true,
54+
"outputHashing": "all",
55+
"sourceMap": false,
56+
"namedChunks": false,
57+
"aot": true,
58+
"progress": false,
59+
"extractLicenses": true,
60+
"budgets": [
61+
{
62+
"type": "initial",
63+
"maximumWarning": "2mb",
64+
"maximumError": "5mb"
65+
},
66+
{
67+
"type": "anyComponentStyle",
68+
"maximumWarning": "6kb"
69+
}
70+
]
71+
},
72+
"development": {
73+
"optimization": false,
74+
"extractLicenses": false,
75+
"sourceMap": true,
76+
"namedChunks": true
77+
}
78+
},
79+
"defaultConfiguration": "production"
80+
},
81+
"serve": {
82+
"builder": "@angular/build:dev-server",
83+
"options": {
84+
"buildTarget": "test-app:build"
85+
},
86+
"configurations": {
87+
"production": {
88+
"buildTarget": "test-app:build:production"
89+
},
90+
"development": {
91+
"buildTarget": "test-app:build:development"
92+
}
93+
},
94+
"defaultConfiguration": "development"
95+
},
96+
"extract-i18n": {
97+
"builder": "@angular/build:extract-i18n",
98+
"options": {
99+
"buildTarget": "test-app:build"
100+
}
101+
},
102+
"lint": {
103+
"builder": "@angular-eslint/builder:lint",
104+
"options": {
105+
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
106+
}
107+
}
108+
}
109+
}
110+
},
111+
"cli": {
112+
"schematicCollections": ["@angular-eslint/schematics"],
113+
"cache": {
114+
"enabled": false
115+
},
116+
"analytics": false
117+
}
118+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { defineConfig } from 'cypress'
2+
3+
export default defineConfig({
4+
video: false,
5+
screenshotOnRunFailure: false,
6+
e2e: {
7+
// We've imported your old cypress plugins here.
8+
// You may want to clean this up later by importing these.
9+
setupNodeEvents(on, config) {
10+
return require('./cypress/plugins/index.js')(on, config)
11+
},
12+
specPattern: './e2e/**/*.spec.ts',
13+
baseUrl: 'http://localhost:4200/',
14+
excludeSpecPattern: '**/examples/*',
15+
},
16+
})
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// <reference types="cypress" />
2+
// ***********************************************************
3+
// This example plugins/index.js can be used to load plugins
4+
//
5+
// You can change the location of this file or turn off loading
6+
// the plugins file with the 'pluginsFile' configuration option.
7+
//
8+
// You can read more here:
9+
// https://on.cypress.io/plugins-guide
10+
// ***********************************************************
11+
12+
// This function is called when a project is opened or re-opened (e.g. due to
13+
// the project's config changing)
14+
15+
/**
16+
* @type {Cypress.PluginConfig}
17+
*/
18+
// eslint-disable-next-line no-unused-vars
19+
module.exports = (on, config) => {
20+
// `on` is used to hook into various events Cypress emits
21+
// `config` is the resolved Cypress config
22+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
10+
//
11+
//
12+
// -- This is a parent command --
13+
// Cypress.Commands.add('login', (email, password) => { ... })
14+
//
15+
//
16+
// -- This is a child command --
17+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
18+
//
19+
//
20+
// -- This is a dual command --
21+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
22+
//
23+
//
24+
// -- This will overwrite an existing command --
25+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
26+
27+
Cypress.Commands.add('ionSwipeToGoBack', (complete = false, selector = 'ion-router-outlet') => {
28+
const increment = complete ? 60 : 25;
29+
cy.get(selector)
30+
.first()
31+
.trigger('mousedown', 0, 275, { which: 1, force: true })
32+
.trigger('mousemove', increment * 1, 275, { which: 1, force: true })
33+
.wait(50)
34+
.trigger('mousemove', increment * 2, 275, { which: 1, force: true })
35+
.wait(50)
36+
.trigger('mousemove', increment * 3, 275, { which: 1, force: true })
37+
.wait(50)
38+
.trigger('mousemove', increment * 4, 275, { which: 1, force: true })
39+
.wait(50)
40+
.trigger('mouseup', increment * 4, 275, { which: 1, force: true });
41+
cy.wait(150);
42+
});
43+
44+
/**
45+
* getStack is a query because it has automatic
46+
* retries built in which will let us account for
47+
* async routing without having to use
48+
* arbitrary cy.wait calls.
49+
*/
50+
Cypress.Commands.addQuery('getStack', (selector) => {
51+
return () => {
52+
const el = cy.$$(selector);
53+
return Array.from(el.children()).map((el) => el.tagName.toLowerCase());
54+
}
55+
});
56+
57+
Cypress.Commands.add('testStack', (selector, expected) => {
58+
cy.getStack(selector).should('deep.equal', expected);
59+
});
60+
61+
Cypress.Commands.add('testLifeCycle', (selector, expected) => {
62+
cy.get(`${selector} #ngOnInit`).invoke('text').should('equal', '1');
63+
cy.get(`${selector} #ionViewWillEnter`).invoke('text').should('equal', expected.ionViewWillEnter.toString());
64+
cy.get(`${selector} #ionViewDidEnter`).invoke('text').should('equal', expected.ionViewDidEnter.toString());
65+
cy.get(`${selector} #ionViewWillLeave`).invoke('text').should('equal', expected.ionViewWillLeave.toString());
66+
cy.get(`${selector} #ionViewDidLeave`).invoke('text').should('equal', expected.ionViewDidLeave.toString());
67+
});
68+
69+
Cypress.Commands.add('ionPageVisible', (selector) => {
70+
cy.get(selector)
71+
.should('have.class', 'ion-page')
72+
.should('not.have.class', 'ion-page-hidden')
73+
.should('not.have.class', 'ion-page-invisible')
74+
.should('have.length', 1);
75+
});
76+
77+
Cypress.Commands.add('ionPageHidden', (selector) => {
78+
cy.get(selector).should('have.class', 'ion-page').should('have.class', 'ion-page-hidden').should('have.length', 1);
79+
});
80+
81+
Cypress.Commands.add('ionPageDoesNotExist', (selector) => {
82+
cy.get(selector).should('not.exist');
83+
});
84+
85+
Cypress.Commands.add('ionTabClick', (tabText) => {
86+
// TODO FW-2790: Figure out how to get rid of wait. It's a workaround for flakiness in CI.
87+
cy.wait(250);
88+
cy.contains('ion-tab-button', tabText).click({ force: true });
89+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/index.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')

0 commit comments

Comments
 (0)