首页 > 解决方案 > 在量角器中找不到带有黄瓜和打字稿的规范

问题描述

我正在使用 Cucumber 和 Typescript 开发 Protractor 我正在尝试运行简单的登录测试,但我得到 No spec found 这是我的配置文件

import { browser, Config } from "protractor";
const path = require('path')
var downloadsPath = path.resolve(__dirname, '../downloads');
exports.config = { 
directConnect:true,
frameworl:'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
baseUrl: 'https://www.facebook.com/',

specs: ['./Feature/login.feature'],

capabilities: {
  browserName: "chrome",
  chromeOptions: {
    args: ['allow-file-access-from-files'],
    prefs: {
      download: {
        'prompt_for_download': false,
        'directory_upgrade': true,
        'default_directory': downloadsPath
      },
    }
}
},

cucumberOpts:{
    require:["./StepDefinitions/LoginSteps.js"],
    compiler: "ts:ts-node/register",
    format: "json:./reports/json/cucumber_report.json",
    tags: ["@Smoke"],
    strict: true,
    
}, 
}

标签: typescriptprotractorcucumber

解决方案


问题已解决,问题在于路径规范:['./Feature/login.feature'],正确的路径是规范:['../Feature/login.feature'],请检查文件的路径如果您遇到类似的问题


推荐阅读