Skip to content

Commit 7b9488f

Browse files
authored
Merge pull request #116 from azerothcore/copilot/fix-11efabbd-f5da-49d4-a7c9-5cd3526c2133
🎉 Major Angular Upgrade: v11.2.14 → v20.2.3 (Latest Stable) with Modern E2E Testing
2 parents 2523b42 + 7fcc735 commit 7b9488f

32 files changed

+20607
-13083
lines changed

.github/workflows/e2e.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ jobs:
1111
runs-on: ubuntu-latest
1212
env:
1313
CI: true
14-
NODE_OPTIONS: --openssl-legacy-provider
1514
steps:
1615
- name: Checkout
1716
uses: actions/checkout@v4
1817

1918
- name: Setup Node.js
2019
uses: actions/setup-node@v4
2120
with:
22-
node-version: '18'
21+
node-version: '22'
2322

2423
- name: Show Node/npm versions
2524
run: |
@@ -29,6 +28,12 @@ jobs:
2928
- name: Setup Chrome
3029
uses: browser-actions/setup-chrome@v1
3130

31+
- name: Install Playwright Browsers
32+
run: npx playwright install --with-deps chromium
33+
34+
- name: Set Playwright Chrome executable for CI
35+
run: echo "PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/google-chrome" >> $GITHUB_ENV
36+
3237
- name: Cache npm
3338
uses: actions/cache@v4
3439
with:
@@ -72,5 +77,5 @@ jobs:
7277
- name: Run unit tests (headless)
7378
run: npm run test-ci -- --browsers=ChromeHeadless
7479

75-
- name: Run E2E tests (Protractor, headless)
76-
run: npm run e2e -- --configuration=e2e --webdriver-update=false
80+
- name: Run E2E tests (Playwright)
81+
run: npm run e2e

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ src/**/*.js
3131
!.vscode/extensions.json
3232

3333
# misc
34+
/.angular/cache
3435
/.sass-cache
3536
/connect.lock
3637
/coverage
@@ -44,6 +45,10 @@ testem.log
4445
!/e2e/protractor.conf.js
4546
/e2e/*.map
4647

48+
# Playwright
49+
/test-results
50+
/playwright-report
51+
4752
# System Files
4853
.DS_Store
4954
Thumbs.db

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- '10'
3+
- '20'
44
dist: xenial
55
sudo: required
66
services:

angular.json

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"main": "src/main.ts",
2323
"polyfills": "src/polyfills.ts",
2424
"tsConfig": "tsconfig.app.json",
25-
"aot": true,
2625
"assets": [
2726
"src/favicon.ico",
2827
"src/assets"
@@ -33,9 +32,15 @@
3332
"src/styles.scss"
3433
],
3534
"scripts": [
36-
"node_modules/marked/lib/marked.js",
35+
"node_modules/marked/lib/marked.umd.js",
3736
"node_modules/prismjs/prism.js"
38-
]
37+
],
38+
"vendorChunk": true,
39+
"extractLicenses": false,
40+
"buildOptimizer": false,
41+
"sourceMap": true,
42+
"optimization": false,
43+
"namedChunks": true
3944
},
4045
"configurations": {
4146
"production": {
@@ -74,26 +79,27 @@
7479
}
7580
]
7681
}
77-
}
82+
},
83+
"defaultConfiguration": ""
7884
},
7985
"serve": {
8086
"builder": "@angular-devkit/build-angular:dev-server",
8187
"options": {
82-
"browserTarget": "git-catalogue:build"
88+
"buildTarget": "git-catalogue:build"
8389
},
8490
"configurations": {
8591
"production": {
86-
"browserTarget": "git-catalogue:build:production"
92+
"buildTarget": "git-catalogue:build:production"
8793
},
8894
"e2e": {
89-
"browserTarget": "git-catalogue:build:e2e"
95+
"buildTarget": "git-catalogue:build:e2e"
9096
}
9197
}
9298
},
9399
"extract-i18n": {
94100
"builder": "@angular-devkit/build-angular:extract-i18n",
95101
"options": {
96-
"browserTarget": "git-catalogue:build"
102+
"buildTarget": "git-catalogue:build"
97103
}
98104
},
99105
"test": {
@@ -113,44 +119,41 @@
113119
"src/styles.scss"
114120
],
115121
"scripts": [
116-
"node_modules/marked/lib/marked.js",
122+
"node_modules/marked/lib/marked.umd.js",
117123
"node_modules/prismjs/prism.js"
118124
]
119125
}
120-
},
121-
"lint": {
122-
"builder": "@angular-devkit/build-angular:tslint",
123-
"options": {
124-
"tsConfig": [
125-
"tsconfig.app.json",
126-
"tsconfig.spec.json",
127-
"e2e/tsconfig.json"
128-
],
129-
"exclude": [
130-
"**/node_modules/**"
131-
]
132-
}
133-
},
134-
"e2e": {
135-
"builder": "@angular-devkit/build-angular:protractor",
136-
"options": {
137-
"protractorConfig": "e2e/protractor.conf.js",
138-
"devServerTarget": "git-catalogue:serve"
139-
},
140-
"configurations": {
141-
"production": {
142-
"devServerTarget": "git-catalogue:serve:production"
143-
},
144-
"e2e": {
145-
"devServerTarget": "git-catalogue:serve:e2e"
146-
}
147-
}
148126
}
149127
}
150128
}
151129
},
152-
"defaultProject": "git-catalogue",
153130
"cli": {
154131
"analytics": false
132+
},
133+
"schematics": {
134+
"@schematics/angular:component": {
135+
"type": "component"
136+
},
137+
"@schematics/angular:directive": {
138+
"type": "directive"
139+
},
140+
"@schematics/angular:service": {
141+
"type": "service"
142+
},
143+
"@schematics/angular:guard": {
144+
"typeSeparator": "."
145+
},
146+
"@schematics/angular:interceptor": {
147+
"typeSeparator": "."
148+
},
149+
"@schematics/angular:module": {
150+
"typeSeparator": "."
151+
},
152+
"@schematics/angular:pipe": {
153+
"typeSeparator": "."
154+
},
155+
"@schematics/angular:resolver": {
156+
"typeSeparator": "."
157+
}
155158
}
156159
}

e2e/app.spec.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test.describe('Git Catalogue App', () => {
4+
5+
test('should load the application', async ({ page }) => {
6+
// Navigate to the application
7+
await page.goto('/');
8+
9+
// Wait for the page to load
10+
await page.waitForLoadState('networkidle');
11+
12+
// Check that the page loaded successfully by looking for Angular content
13+
// The app should have loaded without critical errors
14+
await expect(page).toHaveTitle('GitCatalogue');
15+
16+
// Check that the main app component is present
17+
await expect(page.locator('app-root')).toBeVisible();
18+
});
19+
20+
test('should not have console errors', async ({ page }) => {
21+
const errors: string[] = [];
22+
23+
// Listen for console errors
24+
page.on('console', (msg) => {
25+
if (msg.type() === 'error') {
26+
const text = msg.text();
27+
// Filter out network-related errors that are expected in CI environments
28+
const isNetworkError = text.includes('net::ERR_NAME_NOT_RESOLVED') ||
29+
text.includes('Failed to load resource') ||
30+
text.includes('fonts.googleapis.com') ||
31+
text.includes('fonts.gstatic.com') ||
32+
text.includes('HttpErrorResponse');
33+
34+
if (!isNetworkError) {
35+
errors.push(text);
36+
}
37+
}
38+
});
39+
40+
// Navigate to the application
41+
await page.goto('/');
42+
43+
// Wait for the page to fully load
44+
await page.waitForLoadState('networkidle');
45+
46+
// Assert that there are no critical console errors
47+
expect(errors).toEqual([]);
48+
});
49+
});

e2e/protractor.conf.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

e2e/src/app.e2e-spec.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

e2e/src/app.po.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

e2e/tsconfig.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

karma.conf.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,26 @@ module.exports = function (config) {
99
require('karma-jasmine'),
1010
require('karma-chrome-launcher'),
1111
require('karma-jasmine-html-reporter'),
12-
require('karma-coverage-istanbul-reporter'),
12+
require('karma-coverage'),
1313
require('@angular-devkit/build-angular/plugins/karma')
1414
],
1515
client: {
1616
clearContext: false // leave Jasmine Spec Runner output visible in browser
1717
},
18-
coverageIstanbulReporter: {
18+
coverageReporter: {
1919
dir: require('path').join(__dirname, './coverage/git-catalogue'),
20-
reports: ['html', 'lcovonly', 'text-summary'],
21-
fixWebpackSourcePaths: true
20+
subdir: '.',
21+
reporters: [
22+
{ type: 'html' },
23+
{ type: 'text-summary' }
24+
]
2225
},
23-
reporters: ['progress', 'kjhtml'],
26+
reporters: ['progress', 'kjhtml', 'coverage'],
2427
port: 9876,
2528
colors: true,
2629
logLevel: config.LOG_INFO,
2730
autoWatch: true,
28-
browsers: ['Chrome'],
31+
browsers: ['ChromeHeadless'],
2932
singleRun: false,
3033
restartOnFileChange: true
3134
});

0 commit comments

Comments
 (0)