Javascript 量角器黄瓜配置文件为我的场景抛出未定义的警告,即使这些场景存在

Javascript 量角器黄瓜配置文件为我的场景抛出未定义的警告,即使这些场景存在,javascript,node.js,protractor,cucumberjs,Javascript,Node.js,Protractor,Cucumberjs,我的配置文件无法找到spec文件,即使它存在于我在cucumberOpts中提供的路径中。我尝试了所有解决方案,但没有一个有效 配置文件 规格文件 执行日志 我尝试添加cucumber依赖项,将我所做的一切从相对路径更新到绝对路径。。但是没有一个问题得到解决。。以前它工作正常,但正在将其更新到公共框架文件中。。我将路径从绝对路径更新为相对路径。就是这样,我失去了我的整个框架,它继续说未定义的场景 **因为我在cucumber选项中传递了错误的spec文件名,确保我运行了脚本,但仍然没有定义,这证

我的配置文件无法找到spec文件,即使它存在于我在cucumberOpts中提供的路径中。我尝试了所有解决方案,但没有一个有效

配置文件 规格文件 执行日志 我尝试添加cucumber依赖项,将我所做的一切从相对路径更新到绝对路径。。但是没有一个问题得到解决。。以前它工作正常,但正在将其更新到公共框架文件中。。我将路径从绝对路径更新为相对路径。就是这样,我失去了我的整个框架,它继续说未定义的场景

**因为我在cucumber选项中传递了错误的spec文件名,确保我运行了脚本,但仍然没有定义,这证实了我甚至没有考虑我传递的spec文件


简单的安装使我的框架工作正常

npm安装cucumber@1.3.3--保存开发文件

const log4js = require('log4js');
var fs=require('fs');
global.screenshots = require('protractor-take-screenshots-on-demand');
global.browser2;
var propertiesReader=require('properties-reader');
var env=require("../../env.js");
const {Given, Then, When, Before} = require('cucumber');

exports.config = {

//seleniumAddress: 'http://localhost:4444/wd/hub',
directConnect:true,

framework: 'custom',
// path relative to the current config file
frameworkPath: require.resolve('protractor-cucumber-framework'),
capabilities: {
    'browserName': 'chrome',
    metadata: {
        browser: {
            name: 'chrome',
            version: '79'
        },
        device: 'MacBook Pro 15',
        platform: {
            name: 'OSX',
            version: '10.12.6'
        },
       disableLog:true,
       durationInMS:true,
       openReportInBrowser:true
    }
},
ignoreUncaughtExceptions:false,
// Spec patterns are relative to this directory.
specs: [
    '../../Test_modules/features/'
],

beforeLaunch:function(){
    if (fs.existsSync('./logs/ExecutionLog.log')) {
        fs.unlink('./logs/ExecutionLog.log')
    }
    log4js.configure({
        appenders: {
            out: { type: 'console' }, 
            info:{ type: 'dateFile', filename: "../Reports/logs/info", "pattern":"-dd.log",alwaysIncludePattern:false},
            "console" : {
                "type": "console",
                "category": "console"
            },
            "file" : {
                "category": "test-file-appender",
                "type": "file",
                "filename": "../../Reports/logs/log_file.log",
                "maxLogSize": 10240,
               // "backups": 3,
              //  "pattern": "%d{dd/MM hh:mm} %-5p %m"
            }
          },
         categories: {
               "info" :{"appenders": ["console"], "level": "info"},
               "default" :{"appenders": ["console", "file"], "level": "DEBUG"},
              //"file" : {"appenders": ["file"], "level": "DEBUG"}
        }
    });
},
cucumberOpts: {
    require:['../../Test_modules/utilities/timeOutConfig.js','../../Test_modules/stepDefinition/spec.js'],
    tags: false,
    profile: false,
    format:'json:../../Reports/jsonResult/results.json',
    'no-source': true
},
 onPrepare: function () {
     const logDefault = log4js.getLogger('default');
     const logInfo=log4js.getLogger('info');
     screenshots.browserNameJoiner = ' - '; //this is the default
     //folder of screenshot
     screenshots.screenShotDirectory = '../../Screenshots';
     global.openNewBrowser=require('../../Test_modules/utilities/newBrowserinstance.js');
     global.testData=require('../../TestData/testData.json');
     browser.logger = log4js.getLogger('protractorLog4js');
     global.firstBrowser=browser;
     global.properties=propertiesReader('../../TestData/propertyConfig.properties');
     browser.waitForAngularEnabled(false);
     browser.manage().window().maximize();
     global.facebook=require('../../Test_modules/pages/fbPageObjects.js');
     global.utility=require('../../Test_modules/utilities/testFile.js');
  },
  plugins: [{
      package: 'H:/workspace/Proc-UI/node_modules/protractor-multiple-cucumber-html-reporter-plugin',
      options:{
          // read the options part for more options
          automaticallyGenerateReport: true,
          removeExistingJsonReportFile: true,
          reportPath:'../../Reports/HtmlReports',
          reportName:"test.html"
      },
      customData: {
            title: 'Run info',
            data: [
                {label: 'Project', value: 'Framework Setup'},
                {label: 'Release', value: '1.2.3'},
                {label: 'Cycle', value: 'Test Cycle'}
            ]
        },
  }]
};



var utilityInit,page2;//browser2;
page1=new facebook(firstBrowser);
module.exports=function(){
    this.Given(/^Open the browser and Load the URL$/,async function(){
        await firstBrowser.get(properties.get("url1"));
        browser.logger.info("Title of the window is :"+await browser.getTitle());
        //screenshots.takesScreenshot("filename");
    });
    
    this.When(/^User entered the text in the search box$/,async function(){
        firstBrowser.sleep(3000);
        await page1.email().sendKeys(testData.Login.CM[0].Username);
        browser.sleep(3000);
        await page1.password().sendKeys(testData.Login.CM[0].Password);
    });
    
    this.Then(/^click on login button$/,async function(){
        browser.sleep(3000);
        await facebook.submit().click();
    });
    
    this.Then(/^User tried to open in new browser instance$/,async function(){
        browser2=await openNewBrowser.newBrowserInit(firstBrowser);
        utilityInit=new utility(browser2);
        utilityInit.ignoreSync(properties.get("url2"));
        browser2.manage().window().maximize();
        console.log(await utilityInit.title()+" title");
        browser2.sleep(5000);
    });
    
    this.When(/^User entered the text in the email field$/,async function(){
        page2=new facebook(browser2);
        console.log(await page2.title()+" browser2");
        await page2.search().sendKeys("testing");
        browser2.sleep(3000);
        page1=new facebook(firstBrowser);
        console.log(await page1.title()+" browser1");
        await page1.email().sendKeys(testData.Login.CM[0].Username);
        screenshots.takeScreenshot("newScreenshot");
        firstBrowser.sleep(5000);
    });
};

1) Scenario: Title of your scenario # ..\features\test.feature:24
   ? Given Open the browser and Load the URL
       Undefined. Implement with the following snippet:

         Given('Open the browser and Load the URL', function () {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   ? Then User tried to open in new browser instance
       Undefined. Implement with the following snippet:

         Then('User tried to open in new browser instance', function () {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   ? And User entered the text in the email field
       Undefined. Implement with the following snippet:

         Then('User entered the text in the email field', function () {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

   √ After # ..\..\node_modules\protractor-cucumber-framework\lib\resultsCapturer.js:27

1 scenario (1 undefined)
3 steps (3 undefined)
0m00.004s