Skip to content

Instantly share code, notes, and snippets.

@xiongemi
Created February 13, 2024 22:55
Show Gist options
  • Save xiongemi/a2625d4e4b5c2220032d3401a18b4594 to your computer and use it in GitHub Desktop.
Save xiongemi/a2625d4e4b5c2220032d3401a18b4594 to your computer and use it in GitHub Desktop.
cats expo cypress tests
// apps/cats-cypress/cypress/e2e/app.cy.ts
import { getGreeting } from '../support/app.po';
describe('Should display a cat fact', () => {
beforeEach(() => {
cy.intercept('https://catfact.ninja/fact', {
fixture: 'cat-fact-response.json',
}).as('getCatsFact');
cy.visit('/');
cy.wait(['@getCatsFact']);
});
it('should display title', () => {
// Function helper example, see `../support/app.po.ts` file
getGreeting().contains(/Cat Facts/);
});
it('should display a cat fact', () => {
cy.get('[data-testid="carousel-card-content"]').contains(
'A cat\u2019s heart beats nearly twice as fast as a human heart, at 110 to 140 beats a minute.'
);
});
});
{
"fact": "A cat\u2019s heart beats nearly twice as fast as a human heart, at 110 to 140 beats a minute.",
"length": 88
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment