title: How to wait for requests and validate responses using playwright?
body: <p>This is my first time using playwright and I can't figure out how to wait for requests and validate responses.
  I've been using cypress for a quite a long time, and it was pretty easy to manage network requests.
  For example, I need to validate response after clicking a button and this is how I would do it with cypress:</p>
  <pre><code>        cy.server()
          cy.route('POST', '/api/contacts').as('newContact')
  
          cy.get('.btn').click()
  
          cy.wait('@newContact').then((response) =&gt; {
              expect(response.status).to.eq(400)
              expect(response.responseBody.data.name).to.eq('abcde')
          })
  </code></pre>
  <p>And this is how I'm trying to do the same thing with playwright, but it validates <code>GET</code> request that was sent long before it even clicked save button. I can't figure out how to manage this request properly and that's a show stopper for my test suite:</p>
  <pre><code>        await contacts.clickSaveBtn()
  
          await page.waitForResponse((resp) =&gt; {
              resp.url().includes('/api/contacts')
              expect(resp.status()).toBe(400)
          })
  </code></pre>
  <p>Any help or advice would be really appreciated</p>