Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update intercept.mdx #5485

Merged
merged 4 commits into from
Oct 11, 2023
Merged

Update intercept.mdx #5485

merged 4 commits into from
Oct 11, 2023

Conversation

RobinsonRojas
Copy link
Contributor

Fix url variable cy.intercept

Fix url variable cy.intercept
@netlify
Copy link

netlify bot commented Sep 18, 2023

👷 Deploy request for cypress-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 63f89ee

@netlify
Copy link

netlify bot commented Sep 18, 2023

Deploy Preview for benevolent-cat-040f48 ready!

Name Link
🔨 Latest commit 63f89ee
🔍 Latest deploy log https://app.netlify.com/sites/benevolent-cat-040f48/deploys/6526c6ae2870d900086cfba6
😎 Deploy Preview https://deploy-preview-5485--benevolent-cat-040f48.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@CLAassistant
Copy link

CLAassistant commented Sep 18, 2023

CLA assistant check
All committers have signed the CLA.

@cypress-app-bot
Copy link
Collaborator

@jaffrepaul
Copy link
Contributor

@RobinsonRojas the original example should still work and using the options object as you propose should also do the trick as well, but with a full HTTP request URL. Do you have a reproducible example of the original API not working?

@RobinsonRojas
Copy link
Contributor Author

@jaffrepaul yes this is

/// <reference types="cypress" />

context('Waiting', () => {
	beforeEach(() => {
		cy.visit('https://example.cypress.io/commands/waiting')
	})

	it('cy.wait() - wait for a specific route', () => {
		// Listen to GET to comments/1

		// CypressError
		cy.intercept('https://jsonplaceholder.cypress.io/comments/1', { times: 1 }).as('getComment') 

		// No CypressError
		// cy.intercept({ url:'https://jsonplaceholder.cypress.io/comments/1',  times: 1 }).as('getComment') 

		cy.get('.network-btn').click()

		// wait for GET comments/1
		cy.wait('@getComment')
			.its('response.statusCode')
			.should('be.oneOf', [200, 304])
	})
})

CypressError:
image

No CypressError:
image

@jennifer-shehane
Copy link
Member

@RobinsonRojas Can you run lint on the PR?

@RobinsonRojas
Copy link
Contributor Author

@jennifer-shehane Yes but I didn't find the format error.

@mschile mschile assigned mschile and unassigned jaffrepaul Oct 11, 2023
@mschile mschile merged commit 444075e into cypress-io:main Oct 11, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants