javascript - Cypress - mocking window property - Stack Overflow

I have a code that uses window.foo.abc as a condition to display something.I want to test this functio

I have a code that uses window.foo.abc as a condition to display something.

I want to test this functionality with cypress and I want to mock this value to be false and true.

How can I do that?

I've tried

 before(function() {
      Cypress.on('window:before:load', win => {
        win.foo.abc = true;
      });

and

  cy.window().then(win => {
    window.foo.abc = true;
  });

with no success.

How can I mock this value?

thanks

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745211702a4616881.html

相关推荐

  • javascript - Cypress - mocking window property - Stack Overflow

    I have a code that uses window.foo.abc as a condition to display something.I want to test this functio

    5小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信