0
私はウェブアプリケーションのテストにCypressを使用しています。サイプレスで新しいルートへのリダイレクトをテストする
このスニペットは、現在動作し、新しいもの提出する:コメントが示すように
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?
})
})
を、私は新しいルート作品にするか否かのリダイレクトをテストする方法がわからないです。ブラウザのシミュレーションで、リダイレクトが動作することがわかりました。テストを追加したいだけです。
ありがとうございました!
だから... ...私のWebアプリは(10秒以上のように)対応するloooong時間がかかることがありますしPOST'ingされ、このサーバー... I CypressError:タイムアウトして再試行しました: '/ newthing /:id'と等しい '/ create'を期待しました...サイプレスが何かを試し続けるかを変更できますか?また、ヘルプのthxは、本当にそれを感謝! – SeanPlusPlus
はい。これらのタイムド・リトライがどのように機能するかについては、[here](https://on.cypress.io/introduction-to-cypress#Applying-Timeouts)を参照してください。 サイプレスは、アサーション( '/ newthing /:id')またはタイムアウトするまで、場所のパスを継続的にチェックします。デフォルトのタイムアウトは4000msです。 'cy.location( 'pathname'、{timeout:10000})。( 'eq'、 '/ newthing /:id'のように' cy.location() 'にタイムアウトオプションを渡すことで、 ) ' –
ビンゴ!タイムアウトは機能します。 Thx soooo much !!! – SeanPlusPlus