Skip to content

Implement real stubbing of API responses #30

@github-actions

Description

@github-actions

cy.visit(/room/${roomName});

});

cy.request(

http://localhost:8081/connect?url=http://localhost:3000/room/${roomName}&message=freedom1&message=freedom2&waitAfterSendingMessage=true,

{

failOnStatusCode: false,

}

)

).to.throw();

cy.get('#medalDismiss').click();

https://api.github.com/BrycensRanch/AuthIsForMe/blob/1111033ba86baacb8e52f33bca6579a243eedb31/frontend/cypress/e2e/Main.cy.ts#L1

// TODO: Implement real stubbing of API responses

describe('Static pages', () => {
	it('should take screenshot of the homepage', () => {
		cy.visit('/');
		// Wait until the page is displayed
		cy.findByTestId('index-h1');

		cy.percySnapshot('Homepage');
	});
	it('should take screenshot of the thanks/libraries page', () => {
		cy.intercept('GET', 'https://api.github.com/*', {
			statusCode: 404,
			body: {
				name: 'Peter Pan',
			},
		});
		cy.intercept('GET', 'https://registry.npmjs.org*', {
			statusCode: 404,
			body: {
				name: 'Peter Pan',
			},
		});
		// spying and response stubbing
		cy.visit('/thanks');
		// Wait until the page is displayed
		cy.findByTestId('thanks-h1');

		cy.get('#licenses-loading', { timeout: 20_000 }).should('not.exist');
		cy.scrollTo('bottom');

		cy.percySnapshot('Thanks page');
	});
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions