Не удается переключить Windows с помощью заглушки и шпиона с помощью Cypress - PullRequest
0 голосов
/ 10 октября 2019

У меня проблема с переключением окон в моем веб-приложении CRM с использованием методов-заглушек. Получение ниже сообщения об ошибке

Timed out retrying: { [Function: open]
  callBaseMethod: 
   { [Function]
     callBaseMethod: [Circular],
     getBaseMethod: 
      { [Function]
        callBaseMethod: [Circular],
        getBaseMethod: [Circular],
 resolveInheritance: [Circular],
        registerEnum: [Circular] },
     registerEnum: [Circular] } } is not a spy or a call to a spy!
Because this error occurred during a 'before each' hook we are skipping the remaining tests in the current suite: 'window open'

Ниже мой код.

describe('window open', function () {
    beforeEach(function () {
      cy.visit('https://abc.in', {
        onBeforeLoad(win) {
          cy.stub(win, 'open').as('windowOpen')
        }  
      })
      cy.xpath('//span[@class="largeTextNoWrap indentNonCollapsible"]').eq(0).click();

    cy.get('#userNameInput',{timeout : 7000}).type("****").debug()

    cy.get('#passwordInput').type('***').screenshot();
    cy.get('#submitButton').click();
    cy.wait(20000);
    cy.xpath('//span[@id="advancedFindImage"]').click();
    cy.wait(20000);
    cy.window().its('open').should('be.called')
    })

    it('see window open being called with url', function () {

        cy.wait(5000);
        cy.xpath('/a[@id="Mscrm.AdvancedFind.Groups.Show.Results-Large"]').click().debug();
        cy.contains('Results').click(); 
      cy.get('@windowOpen').should('be.calledWith', '?appid=&pagetype=advancedfind#761326506').debug();
    })
  })

Может кто-нибудь подсказать, что я пропустил в этом, что делает выполнение не удалось

...