Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
254 views
in Technique[技术] by (71.8m points)

javascript - 如何在赛普拉斯的Chrome中访问网络通话?(How to access to Network calls on Chrome in Cypress?)

This path is not working ////(此路径不起作用////)

I want to access here(我想在这里访问) 在此处输入图片说明 describe('Second GA Tracking', () => { it('should be called', () => { cy.server(); // cy.fixture('cypress/fixture/fixture.json').as('@getSecondGA'); cy.visit(chps.url); cy.wait('UA-5883199-36').then((img) => { assert.isNotNull(img.response.body.data, 'Second GA Tracking call has data'); }); }); });   ask by Omar Qaddourah translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You're missing the cy.route() call.(您缺少cy.route()调用。)

Try this:(尝试这个:) describe('Second GA Tracking', () => { it('should be called', () => { cy.server(); cy.route('**UA-5883199-36**').as('getRequest'); cy.visit(chps.url); cy.wait('@getRequest').then(request => { assert.isNotNull(request.response.body.data, 'Second GA Tracking call has data'); }); }); }); https://docs.cypress.io/api/commands/route.html(https://docs.cypress.io/api/commands/route.html)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...