【发布时间】:2018-04-01 01:26:00
【问题描述】:
我正在使用Cypress 测试我的网络应用程序。
这个sn-p目前有效,会提交一个新东西:
describe('The Create Page', () => {
it('successfully creates a thing', () => {
cy.visit('/create')
cy.get('input[name=description]').type('Hello World')
cy.get('button#submit')
.click()
// After POST'ing this data via AJAX, the web app then
// receives the id of the new thing that was just created
// and redirects the user to /newthing/:id
// How do I test that this redirection worked?
})
})
正如评论所示,我不确定如何测试重定向到新路由是否有效。我可以在浏览器模拟中看到重定向有效,我只是想为它添加一个测试。
谢谢!!!
【问题讨论】:
标签: javascript testing mocha.js cypress