Skip to content

Commit fe91f02

Browse files
CopilotYehonal
andcommitted
Complete e2e migration from Protractor to Playwright with working tests
Co-authored-by: Yehonal <[email protected]>
1 parent ddd3f20 commit fe91f02

File tree

12 files changed

+779
-387
lines changed

12 files changed

+779
-387
lines changed

.github/workflows/e2e.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ jobs:
2828
- name: Setup Chrome
2929
uses: browser-actions/setup-chrome@v1
3030

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+
3137
- name: Cache npm
3238
uses: actions/cache@v4
3339
with:
@@ -71,5 +77,5 @@ jobs:
7177
- name: Run unit tests (headless)
7278
run: npm run test-ci -- --browsers=ChromeHeadless
7379

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

angular.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,6 @@
123123
"node_modules/prismjs/prism.js"
124124
]
125125
}
126-
},
127-
"e2e": {
128-
"builder": "@angular-devkit/build-angular:protractor",
129-
"options": {
130-
"protractorConfig": "e2e/protractor.conf.js",
131-
"devServerTarget": "git-catalogue:serve"
132-
},
133-
"configurations": {
134-
"production": {
135-
"devServerTarget": "git-catalogue:serve:production"
136-
},
137-
"e2e": {
138-
"devServerTarget": "git-catalogue:serve:e2e"
139-
}
140-
}
141126
}
142127
}
143128
}

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.

0 commit comments

Comments
 (0)