Cypress.config.js 文件无效[关闭]

问题描述 投票:0回答:0

我有使用 cypress 进行自动化的详细测试用例。当我运行命令 npx cypress open 时,我可以看到错误消息,提示您的配置文件无效。我已经重新尝试运行 npm init -y 命令并重新安装了 Puppeeteer API,但仍然显示相同的错误。

ThirdPartyLogin.js

const puppeteer = require("puppeteer");

const verifyLoginWithFacebookFunctionality = (args)=>{ 

    return new Promise(async (resolve,reject)=>{
      try{
        const browser = await puppeteer.launch({ headless: false  })
        const page = await browser.newPage()
        await page.goto(args.host, {waitUntil: 'networkidle0'})
        await page.setViewport({
          width: 1200,
          height: 800,
          deviceScaleFactor: 0.75,
        });

cypress.config.js

const { defineConfig } = require("cypress");
const { verifyLoginWithFacebookFunctionality, 
verifyLoginWithGoogleFunctionality, 
verifyLoginWithFacebookFunctionalityWithMobile, 
verifyLoginWithGoogleMobileFunctionality } = require('./cypress/pages/ThirdPartyLogin');

module.exports = defineConfig({

  "chromeWebSecurity": false, 

  projectId: "zksawb",
  e2e: {
    retries: { "runMode": 2, "openMode": 2 },
    numTestsKeptInMemory: 0,
  "defaultCommandTimeout": 40000,
  "pageLoadTimeout": 50000,
  "requestTimeout":20000,
  "responseTimeout": 20000,
    setupNodeEvents(on, config) {
      // implement node event listeners here
      on('task', {
          FacebookLogin: verifyLoginWithFacebookFunctionality,
          Googlelogin: verifyLoginWithGoogleFunctionality,
          FacebookLoginMobile: verifyLoginWithFacebookFunctionalityWithMobile,
          GoogleloginMobile: verifyLoginWithGoogleMobileFunctionality   
      })       
    },
  
javascript cypress puppeteer
© www.soinside.com 2019 - 2024. All rights reserved.