Skip to content

Commit a391f04

Browse files
committed
test: execute 'protractor' binary directly in 'browsers' E2E test
The 'browsers' E2E test now executes the 'protractor' binary directly from 'node_modules' instead of using the 'protractor' Angular CLI builder. This further reduces the test's dependency on legacy CLI infrastructure and removes the need to manually configure an 'e2e' architect target in 'angular.json'.
1 parent 826a994 commit a391f04

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

tests/e2e/tests/misc/browsers.ts

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import express from 'express';
22
import * as path from 'node:path';
33
import { copyProjectAsset } from '../../utils/assets';
44
import { appendToFile, createDir, replaceInFile, writeFile } from '../../utils/fs';
5-
import { ng } from '../../utils/process';
5+
import { exec, ng } from '../../utils/process';
66
import { installPackage } from '../../utils/packages';
7-
import { updateJsonFile } from '../../utils/project';
87

98
/**
109
* The list of development dependencies used by the E2E protractor-based builder.
@@ -26,17 +25,6 @@ export default async function () {
2625
await installPackage(e2eDep);
2726
}
2827

29-
// Setup `protractor` builder.
30-
await updateJsonFile('angular.json', (config) => {
31-
config.projects['test-project'].architect['e2e'] = {
32-
builder: '@angular-devkit/build-angular:protractor',
33-
options: {
34-
devServerTarget: '',
35-
protractorConfig: 'e2e/protractor-saucelabs.conf.js',
36-
},
37-
};
38-
});
39-
4028
await appendToFile(
4129
'src/app/app.config.ts',
4230
"import { provideProtractorTestingSupport } from '@angular/platform-browser';\n",
@@ -97,13 +85,8 @@ describe('workspace-project App', () => {
9785

9886
try {
9987
// Execute application's E2E tests with SauceLabs
100-
await ng(
101-
'e2e',
102-
'test-project',
103-
'--no-webdriver-update',
104-
'--protractor-config=e2e/protractor-saucelabs.conf.js',
105-
'--dev-server-target=',
106-
);
88+
const binPath = path.join('node_modules', '.bin', 'protractor');
89+
await exec(binPath, 'e2e/protractor-saucelabs.conf.js');
10790
} finally {
10891
server.close();
10992
}

0 commit comments

Comments
 (0)