Skip to content

Commit 790a1a9

Browse files
committed
WIP: fixed?
1 parent 14f233b commit 790a1a9

File tree

4 files changed

+41
-184
lines changed

4 files changed

+41
-184
lines changed

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@
185185
"postcss-loader": "7.0.0",
186186
"postcss-preset-env": "7.6.0",
187187
"prettier": "^2.0.0",
188-
"protractor": "~7.0.0",
189-
"puppeteer": "14.1.1",
190188
"quicktype-core": "6.0.69",
191189
"regenerator-runtime": "0.13.9",
192190
"resolve-url-loader": "5.0.0",

tests/legacy-cli/e2e/utils/process.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export async function launchTestProcess(entry: string, ...args: any[]) {
369369
}
370370

371371
// Add the project node modules bin to the front of the path
372-
paths.push(join(process.cwd(), 'node_modules', '.bin'));
372+
paths.unshift(join(process.cwd(), 'node_modules', '.bin'));
373373

374374
env.PATH = paths.join(delimiter);
375375

tests/legacy-cli/e2e/utils/project.ts

+25-21
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { packages } from '../../../../lib/packages';
55
import { getGlobalVariable } from './env';
66
import { prependToFile, readFile, replaceInFile, writeFile } from './fs';
77
import { gitCommit } from './git';
8-
import { installWorkspacePackages } from './packages';
8+
import { installPackage, installWorkspacePackages } from './packages';
99
import { exec, execAndWaitForOutputToMatch, git, ng } from './process';
1010

1111
export function updateJsonFile(filePath: string, fn: (json: any) => any | void) {
@@ -39,26 +39,28 @@ export async function prepareProjectForE2e(name) {
3939

4040
console.log(`Project ${name} created... Installing packages.`);
4141
await installWorkspacePackages();
42+
await installPackage('puppeteer');
4243

4344
await ng('generate', 'e2e', '--related-app-name', name);
4445

45-
// Initialize protractor webdriver. Often fails the first time so attempt twice if necessary.
46-
// const webdriverCommand = exec.bind(
47-
// null,
48-
// 'webdriver-manager',
49-
// 'update',
50-
// '--standalone',
51-
// 'false',
52-
// '--gecko',
53-
// 'false',
54-
// '--versions.chrome',
55-
// '101.0.4951.41',
56-
// );
57-
// try {
58-
// await webdriverCommand();
59-
// } catch (e) {
60-
// await webdriverCommand();
61-
// }
46+
// Initialize welenium webdrivers.
47+
// Often fails the first time so attempt twice if necessary.
48+
const webdriverCommand = exec.bind(
49+
null,
50+
'node_modules/protractor/bin/webdriver-manager',
51+
'update',
52+
'--standalone',
53+
'false',
54+
'--gecko',
55+
'false',
56+
'--versions.chrome',
57+
'101.0.4951.41',
58+
);
59+
try {
60+
await webdriverCommand();
61+
} catch (e) {
62+
await webdriverCommand();
63+
}
6264

6365
await useCIChrome('e2e');
6466
await useCIChrome('');
@@ -209,7 +211,6 @@ export async function useCIChrome(projectDir: string = ''): Promise<void> {
209211
const protractorConf = path.join(projectDir, 'protractor.conf.js');
210212
const karmaConf = path.join(projectDir, 'karma.conf.js');
211213

212-
const chromePath = require('puppeteer').executablePath();
213214
const protractorPath = require.resolve('protractor');
214215
const webdriverUpdatePath = require.resolve('webdriver-manager/selenium/update-config.json', {
215216
paths: [protractorPath],
@@ -227,7 +228,7 @@ export async function useCIChrome(projectDir: string = ''): Promise<void> {
227228
`browserName: 'chrome',
228229
chromeOptions: {
229230
args: ['--headless'],
230-
binary: String.raw\`${chromePath}\`,
231+
binary: require('puppeteer').executablePath(),
231232
}`,
232233
);
233234
await replaceInFile(
@@ -239,7 +240,10 @@ export async function useCIChrome(projectDir: string = ''): Promise<void> {
239240

240241
// Use Puppeteer in karma if a config is found on the project.
241242
if (fs.existsSync(karmaConf)) {
242-
await prependToFile(karmaConf, `process.env.CHROME_BIN = String.raw\`${chromePath}\`;`);
243+
await prependToFile(
244+
karmaConf,
245+
`process.env.CHROME_BIN = require('puppeteer').executablePath();`,
246+
);
243247
await replaceInFile(karmaConf, `browsers: ['Chrome']`, `browsers: ['ChromeHeadless']`);
244248
}
245249
}

0 commit comments

Comments
 (0)