Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
260 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 Reply

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)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...