Skip to content

Commit fea6549

Browse files
committed
test: remove global Protractor/E2E setup from E2E utilities
Since most E2E tests have been migrated away from Protractor, this change removes the automatic generation of the 'private-e2e' schematic and its associated configuration from the global 'prepareProjectForE2e' and 'useCIChrome' utilities. The setup is now explicitly handled within the 'browsers' test which still requires it, resulting in cleaner and faster initialization for the majority of the E2E suite.
1 parent 34c8583 commit fea6549

File tree

2 files changed

+3
-27
lines changed

2 files changed

+3
-27
lines changed

tests/e2e/tests/misc/browsers.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export default async function () {
1010
throw new Error('SauceLabs is not configured.');
1111
}
1212

13+
await ng('generate', 'private-e2e', '--related-app-name', 'test-project');
14+
1315
// Workaround for https://github.com/angular/angular/issues/32192
1416
await replaceInFile('src/app/app.html', /class="material-icons"/g, '');
1517

@@ -43,6 +45,7 @@ export default async function () {
4345
await ng(
4446
'e2e',
4547
'test-project',
48+
'--no-webdriver-update',
4649
'--protractor-config=e2e/protractor-saucelabs.conf.js',
4750
'--dev-server-target=',
4851
);

tests/e2e/utils/project.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ export async function prepareProjectForE2e(name: string) {
5252

5353
console.log(`Project ${name} created... Installing packages.`);
5454
await installWorkspacePackages();
55-
await ng('generate', 'private-e2e', '--related-app-name', name);
5655

57-
await useCIChrome(name, 'e2e');
5856
await useCIChrome(name, '');
5957
await useCIDefaults(name);
6058

@@ -137,12 +135,6 @@ export function useCIDefaults(projectName = 'test-project'): Promise<void> {
137135
const appTargets = project.targets || project.architect;
138136
appTargets.build.options.progress = false;
139137
appTargets.test.options.progress = false;
140-
if (appTargets.e2e) {
141-
// Disable auto-updating webdriver in e2e.
142-
appTargets.e2e.options.webdriverUpdate = false;
143-
// Use a random port in e2e.
144-
appTargets.e2e.options.port = 0;
145-
}
146138

147139
if (appTargets.serve) {
148140
// Use a random port in serve.
@@ -153,25 +145,6 @@ export function useCIDefaults(projectName = 'test-project'): Promise<void> {
153145
}
154146

155147
export async function useCIChrome(projectName: string, projectDir = ''): Promise<void> {
156-
const protractorConf = path.join(projectDir, 'protractor.conf.js');
157-
if (fs.existsSync(protractorConf)) {
158-
// Ensure the headless sandboxed chrome is configured in the protractor config
159-
await replaceInFile(
160-
protractorConf,
161-
`browserName: 'chrome'`,
162-
`browserName: 'chrome',
163-
chromeOptions: {
164-
args: ['--headless', '--no-sandbox', '--disable-gpu', '--disable-dev-shm-usage'],
165-
binary: String.raw\`${process.env.CHROME_BIN}\`,
166-
}`,
167-
);
168-
await replaceInFile(
169-
protractorConf,
170-
'directConnect: true,',
171-
`directConnect: true, chromeDriver: String.raw\`${process.env.CHROMEDRIVER_BIN}\`,`,
172-
);
173-
}
174-
175148
const karmaConf = path.join(projectDir, 'karma.conf.js');
176149
if (fs.existsSync(karmaConf)) {
177150
// Ensure the headless sandboxed chrome is configured in the karma config

0 commit comments

Comments
 (0)