最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Google Cloud 上的 Codeceptjs 函数 goto of undefined

网站源码admin25浏览0评论

Google Cloud 上的 Codeceptjs 函数 goto of undefined

Google Cloud 上的 Codeceptjs 函数 goto of undefined

我正在尝试使用在 Google Cloud Function 中运行的 CodeceptJS(带有 Puppeteer)来自动化网络活动。 我的 index.js 是:

const Container = require('codeceptjs').container;
const Codecept = require('codeceptjs').codecept;
const event = require('codeceptjs').event;
const path = require('path');

module.exports.basicTest = async (req, res) => {  

  let message = '';

  // helpers config
  let config = { 
    tests: './*_test.js',
    output: './output',
    helpers: { 
      Puppeteer: { 
        url: '', // base url
        show: true,
        disableScreenshots: true, // don't store screenshots on failure
        windowSize: '1200x1000', // set window size dimensions
        waitForAction: 1000, // increase timeout for clicking
        waitForNavigation: [ 'domcontentloaded', 'networkidle0' ], // wait for document to load
        chrome: {
          args: ['--no-sandbox'] // IMPORTANT! Browser can't be run without this!
        }
      } 
    },
    include: {
      I: './steps_file.js'
    },
    bootstrap: null,
    mocha: {},
    name: 'basic_test',

    // Once a tests are finished - send back result via HTTP
    teardown: (done) => {
      res.send(`Finished\n${message}`);
    }
  };

  // pass more verbose output
  let opts = {
    debug: true,
    steps: true
  };

  // a simple reporter, let's collect all passed and failed tests
  event.dispatcher.on(event.test.passed, (test) => {
    message += `- Test "${test.title}" passed 
发布评论

评论列表(0)

  1. 暂无评论