How to use the puppeteer.executablePath function in puppeteer

To help you get started, we’ve selected a few puppeteer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NationalBankBelgium / stark / packages / stark-testing / karma.conf.ci.js View on Github external
// Helpers
const helpers = require("./helpers");
const IstanbulInstrumenter = require("./istanbul-instrumenter");

// Puppeteer: https://github.com/GoogleChrome/puppeteer/
// takes care of download Chrome and making it available (can do much more :p)
process.env.CHROME_BIN = require("puppeteer").executablePath();

const rawKarmaConfig = {
	// base path that will be used to resolve all patterns (e.g. files, exclude)
	basePath: "",

	// frameworks to use
	// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
	frameworks: ["jasmine", "karma-typescript"],

	// list of files / patterns to load in the browser
	files: [
		{ pattern: helpers.root(helpers.getAngularCliAppConfig().architect.test.options.main) },
		{ pattern: helpers.root("src/**/*.ts") },
		{ pattern: helpers.root("src/**/*.html") }
	],
github cornerstonejs / cornerstoneWADOImageLoader / config / karma / karma-base.js View on Github external
const path = require('path');
const webpackConfig = require('../webpack');

/* eslint no-process-env:0 */
process.env.CHROME_BIN = require('puppeteer').executablePath();

// Deleting output.library to avoid "Uncaught SyntaxError: Unexpected token /" error
// when running testes (var test/foo_test.js = ...)
delete webpackConfig.output.library;

// Karma will build the dependecy tree by itself
delete webpackConfig.entry;

// Code coverage
webpackConfig.module.rules.push({
  test: /\.js$/,
  include: path.resolve('./src/'),
  loader: 'istanbul-instrumenter-loader',
  query: {
    esModules: true
  }
github adobe / aem-project-archetype / src / main / archetype / ui.frontend.angular / src / karma.conf.js View on Github external
process.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = config => {
  config.set({
    plugins: [
      require('@angular-devkit/build-angular/plugins/karma'),
      require('karma-chrome-launcher'),
      require('karma-coverage-istanbul-reporter'),
      require('karma-jasmine-html-reporter'),
      require('karma-jasmine'),
      require('karma-sinon')
    ],
    frameworks: ['jasmine', '@angular-devkit/build-angular', 'sinon'],
    browsers: ['ChromeHeadless'],
    singleRun: true,
    client: {
      clearContext: false // leave Jasmine Spec Runner output visible in browser
github hello-efficiency-inc / ridereceipts / src / renderer / services / puppeteer.js View on Github external
// Selectors Needed
  const EMAIL_SELECTOR = '#useridInput'
  const PASSWORD_SELECTOR = '#password'
  const SMS_SELECTOR = '#verificationCode'
  const NEXT_BUTTON = '#app-body > div > div:nth-child(1) > form > button'
  const VERIFY_BUTTON = '#app-body > div > div > form > button'
  const FILTER_TRIPS = '#slide-menu-content > div > div.flexbox__item.flexbox__item--expand > div > div > div.flexbox__item.four-fifths.page-content > div.hidden--palm > div > div > div.flexbox__item.one-third.text--left > a'
  const NEXT_PAGINATION = '#trips-pagination > div:nth-child(2) > a'
  const NEXT_PAGINATION_INACTIVE_BUTTON = '#trips-pagination > div:nth-child(2) > div.btn--inactive'
  const INACTIVE_PREVIOUS_BUTTON = '.btn--inactive.pagination__previous'
  const INACTIVE_NEXT_BUTTON = '.btn--inactive.pagination__next'
  const DOWNLOAD_INVOICE_TRIP = '#data-invoice-btn-download'
  const documentDir = jetpack.cwd(store.get('invoicePath'))
  let exec
  if (process.env.NODE_ENV !== 'development') {
    exec = puppeteer.executablePath().replace('app.asar', 'app.asar.unpacked')
  } else {
    exec = puppeteer.executablePath()
  }

  // If executable path not found then throw error
  if (!jetpack.exists(exec)) {
    ipcRenderer.send('form', CHROME_NOT_FOUND)
    return
  }

  const browser = await launch(puppeteer, exec)
  store.set('processPID', browser.process().pid) // Store process ID to kill when app quits

  const page = await browser.newPage()

  await page.setViewport({
github NG-ZORRO / ng-zorro-antd / components / karma.conf.js View on Github external
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

const tags = process.env && process.env['NG_TEST_TAGS'];
const processENV = require('process');
processENV.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = function(config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular', 'viewport'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-spec-reporter'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('karma-junit-reporter'),
      require('@angular-devkit/build-angular/plugins/karma'),
      require('karma-viewport')
    ],
    client: {
github SchweizerischeBundesbahnen / scion-workbench / projects / scion / workbench-application.angular / karma.conf.js View on Github external
/*
 * Copyright (c) 2018-2019 Swiss Federal Railways
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 *  SPDX-License-Identifier: EPL-2.0
 */

// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
process.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular-devkit/build-angular/plugins/karma'),
    ],
    client: {
      clearContext: false, // leave Jasmine Spec Runner output visible in browser
    },
    coverageIstanbulReporter: {
github msn0 / fake-fetch / karma.conf.js View on Github external
process.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = function(config) {
    config.set({
        basePath: '',
        frameworks: ['browserify', 'jasmine'],
        files: [
            'node_modules/whatwg-fetch/fetch.js',
            'index.js',
            'test.js'
        ],
        exclude: [],
        preprocessors: {
            'index.js': [ 'browserify' ],
            'test.js': [ 'browserify' ]
        },
        coverageReporter: {},
github fengyuanchen / vue-feather / karma.conf.js View on Github external
const puppeteer = require('puppeteer');
const webpackConfig = require('./webpack.config');

process.env.CHROME_BIN = puppeteer.executablePath();
process.env.NODE_ENV = 'test';

module.exports = (config) => {
  config.set({
    autoWatch: false,
    browsers: ['ChromeHeadless'],
    files: [
      'test/index.js',
    ],
    frameworks: ['mocha', 'chai'],
    preprocessors: {
      'test/index.js': ['webpack'],
    },
    reporters: ['mocha'],
    singleRun: true,
    webpack: {
github fengyuanchen / cropper / karma.conf.js View on Github external
const babel = require('rollup-plugin-babel');
const commonjs = require('rollup-plugin-commonjs');
const nodeResolve = require('rollup-plugin-node-resolve');
const puppeteer = require('puppeteer');

process.env.CHROME_BIN = puppeteer.executablePath();
process.env.NODE_ENV = 'test';

module.exports = (config) => {
  config.set({
    autoWatch: false,
    browsers: ['ChromeHeadless'],
    coverageIstanbulReporter: {
      reports: ['html', 'lcovonly', 'text-summary'],
    },
    files: [
      'dist/cropper.css',
      'test/index.js',
      {
        pattern: 'docs/images/*',
        included: false,
      },
github RobotlegsJS / RobotlegsJS-Pixi / karma.conf.js View on Github external
const puppeteer = require("puppeteer");

process.env.TEST = true;
process.env.NODE_ENV = "test";
process.env.CHROME_BIN = puppeteer.executablePath();

const webpackConfig = require("./webpack.config.js")({ production: false, karma: true });

delete webpackConfig.entry;

module.exports = config => {
  "use strict";

  var configuration = {
    client: {
      mocha: {
        timeout: 5000
      }
    },
    basePath: "",
    frameworks: ["mocha", "sinon-chai", "es6-shim"],