Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit 1fdfae5

Browse files
committed
test: latest angular project
1 parent bd73dd9 commit 1fdfae5

Some content is hidden

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

41 files changed

+4156
-103
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
- uses: actions/setup-node@v3
1919
with:
20-
node-version: '16.x'
20+
node-version: '18.x'
2121
registry-url: 'https://registry.npmjs.org'
2222
scope: '@sand4rt'
2323

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
- uses: actions/setup-node@v3
1919
with:
20-
node-version: '16.x'
20+
node-version: '18.x'
2121

2222
- name: Install dependencies
2323
run: pnpm install --frozen-lockfile
@@ -26,7 +26,7 @@ jobs:
2626
run: pnpm build
2727

2828
- name: Install Playwright Browsers
29-
run: npx playwright install --with-deps
29+
run: pnpm exec playwright install --with-deps
3030

3131
- name: Run Playwright tests
3232
run: pnpm test

ct-angular/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@
1010
"test": "npx playwright test"
1111
},
1212
"dependencies": {
13-
"@angular/animations": "^15.1.0",
14-
"@angular/common": "^15.1.0",
15-
"@angular/compiler": "^15.1.0",
16-
"@angular/core": "^15.1.0",
17-
"@angular/forms": "^15.1.0",
18-
"@angular/platform-browser": "^15.1.0",
19-
"@angular/platform-browser-dynamic": "^15.1.0",
20-
"@angular/router": "^15.1.0",
13+
"@angular/animations": "^17.1.0",
14+
"@angular/common": "^17.1.0",
15+
"@angular/compiler": "^17.1.0",
16+
"@angular/core": "^17.1.0",
17+
"@angular/forms": "^17.1.0",
18+
"@angular/platform-browser": "^17.1.0",
19+
"@angular/platform-browser-dynamic": "^17.1.0",
20+
"@angular/router": "^17.1.0",
2121
"rxjs": "~7.8.0",
2222
"tslib": "^2.3.0",
23-
"zone.js": "~0.12.0"
23+
"zone.js": "~0.14.3"
2424
},
2525
"devDependencies": {
26-
"@angular-devkit/build-angular": "^15.1.0",
27-
"@angular/cli": "~15.1.0",
28-
"@angular/compiler-cli": "^15.1.0",
26+
"@angular-devkit/build-angular": "^17.1.2",
27+
"@angular/cli": "^17.1.2",
28+
"@angular/compiler-cli": "^17.1.0",
2929
"@playwright/test": "1.41.2",
3030
"@sand4rt/experimental-ct-angular": "workspace:*",
31-
"typescript": "~4.9.4"
31+
"typescript": "~5.3.2"
3232
}
3333
}

ct-angular15/.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
.vscode/*
25+
!.vscode/settings.json
26+
!.vscode/tasks.json
27+
!.vscode/launch.json
28+
!.vscode/extensions.json
29+
.history/*
30+
31+
# Miscellaneous
32+
/.angular/cache
33+
.sass-cache/
34+
/connect.lock
35+
/coverage
36+
/libpeerconnection.log
37+
testem.log
38+
/typings
39+
40+
# System files
41+
.DS_Store
42+
Thumbs.db
43+
/test-results/
44+
/playwright-report/
45+
/playwright/.cache/

ct-angular15/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# ct-angular
2+
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.0.0.
4+
5+
## Development server
6+
7+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application 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.
16+
17+
## Further help
18+
19+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.

ct-angular15/angular.json

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"ct-angular": {
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/ct-angular",
17+
"index": "src/index.html",
18+
"main": "src/main.ts",
19+
"polyfills": [
20+
"zone.js"
21+
],
22+
"tsConfig": "tsconfig.app.json",
23+
"assets": [
24+
"src/assets/favicon.ico",
25+
"src/assets"
26+
],
27+
"styles": [
28+
"src/assets/styles.css"
29+
],
30+
"scripts": []
31+
},
32+
"configurations": {
33+
"production": {
34+
"budgets": [
35+
{
36+
"type": "initial",
37+
"maximumWarning": "500kb",
38+
"maximumError": "1mb"
39+
},
40+
{
41+
"type": "anyComponentStyle",
42+
"maximumWarning": "2kb",
43+
"maximumError": "4kb"
44+
}
45+
],
46+
"outputHashing": "all"
47+
},
48+
"development": {
49+
"buildOptimizer": false,
50+
"optimization": false,
51+
"vendorChunk": true,
52+
"extractLicenses": false,
53+
"sourceMap": true,
54+
"namedChunks": true
55+
}
56+
},
57+
"defaultConfiguration": "production"
58+
},
59+
"serve": {
60+
"builder": "@angular-devkit/build-angular:dev-server",
61+
"configurations": {
62+
"production": {
63+
"browserTarget": "ct-angular:build:production"
64+
},
65+
"development": {
66+
"browserTarget": "ct-angular:build:development"
67+
}
68+
},
69+
"defaultConfiguration": "development"
70+
},
71+
"extract-i18n": {
72+
"builder": "@angular-devkit/build-angular:extract-i18n",
73+
"options": {
74+
"browserTarget": "ct-angular:build"
75+
}
76+
}
77+
}
78+
}
79+
}
80+
}

ct-angular15/package.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "ct-angular",
3+
"version": "0.0.0",
4+
"private": true,
5+
"scripts": {
6+
"ng": "ng",
7+
"start": "ng serve",
8+
"build": "ng build",
9+
"watch": "ng build --watch --configuration development",
10+
"test": "npx playwright test"
11+
},
12+
"dependencies": {
13+
"@angular/animations": "^15.1.0",
14+
"@angular/common": "^15.1.0",
15+
"@angular/compiler": "^15.1.0",
16+
"@angular/core": "^15.1.0",
17+
"@angular/forms": "^15.1.0",
18+
"@angular/platform-browser": "^15.1.0",
19+
"@angular/platform-browser-dynamic": "^15.1.0",
20+
"@angular/router": "^15.1.0",
21+
"rxjs": "~7.8.0",
22+
"tslib": "^2.3.0",
23+
"zone.js": "~0.12.0"
24+
},
25+
"devDependencies": {
26+
"@angular-devkit/build-angular": "^15.1.0",
27+
"@angular/cli": "~15.1.0",
28+
"@angular/compiler-cli": "^15.1.0",
29+
"@playwright/test": "1.41.2",
30+
"@sand4rt/experimental-ct-angular": "workspace:*",
31+
"typescript": "~4.9.4"
32+
}
33+
}

ct-angular15/playwright.config.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { defineConfig, devices } from '@sand4rt/experimental-ct-angular';
2+
import { resolve } from 'path';
3+
4+
/**
5+
* See https://playwright.dev/docs/test-configuration.
6+
*/
7+
export default defineConfig({
8+
testDir: 'tests',
9+
forbidOnly: !!process.env['CI'],
10+
retries: process.env['CI'] ? 2 : 0,
11+
reporter: process.env['CI'] ? 'html' : 'line',
12+
use: {
13+
trace: 'on-first-retry',
14+
ctViteConfig: {
15+
resolve: {
16+
alias: {
17+
'@': resolve('./src'),
18+
}
19+
}
20+
}
21+
},
22+
projects: [
23+
{
24+
name: 'chromium',
25+
use: { ...devices['Desktop Chrome'] },
26+
},
27+
{
28+
name: 'firefox',
29+
use: { ...devices['Desktop Firefox'] },
30+
},
31+
{
32+
name: 'webkit',
33+
use: { ...devices['Desktop Safari'] },
34+
},
35+
],
36+
});

ct-angular15/playwright/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Testing Page</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="./index.ts"></script>
11+
</body>
12+
</html>

ct-angular15/playwright/index.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { beforeMount, afterMount } from '@sand4rt/experimental-ct-angular/hooks';
2+
import { provideRouter } from '@angular/router';
3+
import { ButtonComponent } from '@/components/button.component';
4+
import { TOKEN } from '@/components/inject.component';
5+
import { routes } from '@/router';
6+
import '@/assets/styles.css';
7+
8+
export type HooksConfig = {
9+
routing?: boolean;
10+
injectToken?: boolean;
11+
};
12+
13+
beforeMount<HooksConfig>(async ({ hooksConfig, TestBed }) => {
14+
TestBed.configureTestingModule({
15+
imports: [ButtonComponent],
16+
});
17+
18+
if (hooksConfig?.routing)
19+
TestBed.configureTestingModule({
20+
providers: [provideRouter(routes)],
21+
});
22+
23+
if (hooksConfig?.injectToken)
24+
TestBed.configureTestingModule({
25+
providers: [{ provide: TOKEN, useValue: { text: 'has been overwritten' }}]
26+
})
27+
});
28+
29+
afterMount<HooksConfig>(async () => {
30+
console.log('After mount');
31+
});

ct-angular15/src/app.component.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Component } from '@angular/core';
2+
import { RouterModule } from '@angular/router';
3+
4+
@Component({
5+
standalone: true,
6+
imports: [RouterModule],
7+
selector: 'app-root',
8+
template: `
9+
<header>
10+
<img alt="Angular logo" class="logo" src="./assets/logo.svg" width="125" height="125" />
11+
<a routerLink="/">Login</a>
12+
<a routerLink="/dashboard">Dashboard</a>
13+
</header>
14+
<router-outlet></router-outlet>
15+
`
16+
})
17+
export class AppComponent {}

ct-angular15/src/assets/favicon.ico

948 Bytes
Binary file not shown.

ct-angular15/src/assets/logo.svg

Lines changed: 23 additions & 0 deletions
Loading

ct-angular15/src/assets/styles.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
body {
2+
margin: 0;
3+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5+
sans-serif;
6+
-webkit-font-smoothing: antialiased;
7+
-moz-osx-font-smoothing: grayscale;
8+
}
9+
10+
code {
11+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12+
monospace;
13+
}
14+
15+
@media (prefers-color-scheme: light) {
16+
:root {
17+
color: #e3e3e3;
18+
background-color: #1b1b1d;
19+
}
20+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<button (click)="submit.emit('hello')">{{title}}</button>

0 commit comments

Comments
 (0)