【问题标题】:Cypress.config().baseUrl point to localhost instead baseURL from cypress.jsonCypress.config().baseUrl 指向 localhost 而不是来自 cypress.json 的 baseURL
【发布时间】:2023-03-22 21:42:01
【问题描述】:

在赛普拉斯,我有这个测试代码:

describe('In Viewport LARGE 1366', function() {
    it('Google', function() {
        //cy.visit('/');
        cy.log(Cypress.config().baseUrl);
    });
});

赛普拉斯配置为:

{
  "baseUrl": "https://www.google.com",
  "viewportWidth": 1300,
  "viewportHeight": 660
}

Cypress.json

赛普拉斯版本:3.6

当我运行测试时,Cypress.config().baseUrl 是 localhost:1313 而不是我在 cypress.json 中提到的谷歌站点

Running code

有什么问题?

PS: with cy.visit('/');我有同样的问题 - 它指向http://localhost:1313

【问题讨论】:

    标签: cypress


    【解决方案1】:

    问题出在 cypress/support/index.js

    Cypress.config('baseUrl', 'http://localhost:1313/');

    这个被覆盖的 cypress.json 设置

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-13
      • 1970-01-01
      • 2015-07-24
      • 2019-08-10
      • 1970-01-01
      • 1970-01-01
      • 2013-02-06
      • 1970-01-01
      相关资源
      最近更新 更多