【问题标题】:How to make Cypress visit work headless on remote server?如何使 Cypress 访问在远程服务器上无头工作?
【发布时间】:2018-01-28 15:33:40
【问题描述】:

我有一个网址,我希望通过 Cypress 发送到 visit。 当我在 localhost、headless 或 Cypress GUI 上运行时 - 它可以工作。 当我在我的远程服务器上运行时,GUI 可以工作,但 headless 不能。

这是测试:

describe('bootstrap', () => {
  it('should redirect to login', () => {
    cy.visit('localhost:8000').then((response) => {
      expect(response.location.pathname).to.eq('/login');
    })
  });
});

创建的屏幕截图没有提供新信息,当我添加cy.wait(20000) 时,我认为它没有等待。

我错过了什么,我怎样才能让这个测试在远程服务器上运行?

感谢您的帮助:)

【问题讨论】:

    标签: cypress


    【解决方案1】:

    我们改为:(感谢Erik Zaadi!)

    describe('bootstrap', () => {
      it('should redirect to login', () => {
        cy.visit('/');
        cy.location('pathname').should('eq', '/login')       +         
      });
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-18
      • 1970-01-01
      • 1970-01-01
      • 2023-03-27
      • 1970-01-01
      • 2017-10-05
      相关资源
      最近更新 更多