11/* eslint-disable global-require */
22const cucumber = require ( 'cypress-cucumber-preprocessor' ) . default ;
33const browserify = require ( '@cypress/browserify-preprocessor' ) ;
4- // const retriesPlugin = require('cypress-plugin-retries/lib/plugin');
54const { initPlugin } = require ( 'cypress-plugin-snapshots/plugin' ) ;
6- const reporter = require ( 'cucumber-html-reporter' ) ;
7- const puppeteer = require ( 'puppeteer' ) ;
85const { getConfig } = require ( './snapshots' ) ;
9- const appPkgJson = require ( '../../../../package.json' ) ;
106
117
128module . exports = ( on , config ) => {
@@ -16,79 +12,7 @@ module.exports = (on, config) => {
1612
1713 on ( 'file:preprocessor' , cucumber ( options ) ) ;
1814
19- // retriesPlugin(on);
20- //
21- // on('before:browser:launch', (browser = {}, launchOptions) => {
22- // // `args` is an array of all the arguments that will
23- // // be passed to browsers when it launches
24- // console.log(launchOptions.args); // print all current args
25- //
26- // if (browser.family === 'chrome' && browser.name !== 'electron') {
27- // // auto open devtools
28- // launchOptions.args.push([
29- // '--disable-dev-shm-usage',
30- // '--disable-site-isolation-trials',
31- // `--remote-debugging-port=${config.port}`,
32- // ]
33- // );
34- //
35- // // whatever you return here becomes the launchOptions
36- // return launchOptions;
37- // }
38- //
39- // if (browser.family === 'firefox') {
40- // // auto open devtools
41- // launchOptions.args.push('-devtools');
42- //
43- // return launchOptions;
44- // }
45- // });
46-
47- on ( 'task' , {
48- connectPuppeteer : args => async ( ) => {
49- debugger ;
50- const browser = await puppeteer . connect ( {
51- browserURL : `http://localhost:${ config . port } ` ,
52- } ) ;
53- const page = await browser . newPage ( ) ;
54-
55- await page . goto ( config . baseUrl ) ;
56-
57- console . log ( '-----------------------connectPuppeteer-----------------------------' ) ;
58- console . log ( page ) ;
59- return null ;
60- } ,
61- reporter ( args = null ) {
62- const options = {
63- theme : 'bootstrap' ,
64- ignoreBadJsonFile : true ,
65- jsonDir : 'cypress/cucumber-json' ,
66- output : `${ config . screenshotsFolder } /cucumber_report.html` ,
67- reportSuiteAsScenarios : true ,
68- scenarioTimestamp : true ,
69- launchReport : true ,
70- metadata : {
71- 'App Version' : appPkgJson . version ,
72- 'Test Environment' : process . env . STAGE ,
73- baseUrl : config . baseUrl ,
74- Browser : process . env . OS ,
75- Parallel : "Scenarios" ,
76- Executed : "Remote" ,
77- }
78- } ;
79- reporter . generate ( options ) ;
80-
81- return null ;
82- }
83- } ) ;
84-
85- // on('task', {
86- // failed: require('cypress-failed-log/src/failed')(),
87- // });
88-
8915 initPlugin ( on , getConfig ( config ) ) ;
9016
91- console . log ( '-------------------------------------------' ) ;
92- console . log ( config ) ;
9317 return config ;
9418} ;
0 commit comments