mirror of
https://github.com/Mastermindzh/react-starter-kit.git
synced 2025-08-03 16:13:39 +02:00
Added a nestJS based contract api
- Added an example with trucks and basic fetch in useEffect on page load - Added simply test to see whether any data is displayed (and shows the interceptor) Introduced "CypressStrictMode" which wraps React.StrictMode and checks whether Cypress is involved, if so disable StrictMode.
This commit is contained in:
27
cypress/e2e/trucks.cy.ts
Normal file
27
cypress/e2e/trucks.cy.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
describe("Application trucks", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit(Cypress.env("appBaseUrl"));
|
||||
});
|
||||
|
||||
it("Should render the navigation links", () => {
|
||||
cy.get("[data-testid='nav']");
|
||||
});
|
||||
|
||||
it("Should navigate to trucks and display a result when clicking on trucks", () => {
|
||||
cy.get('[data-testid="nav.trucks"]').click();
|
||||
cy.contains("trucks (contract api) page");
|
||||
});
|
||||
|
||||
it("Should eventually (after the http call) display the results on screen", () => {
|
||||
cy.intercept({
|
||||
method: "GET",
|
||||
url: "http://localhost:9600/fake/trucks",
|
||||
}).as("getTrucks");
|
||||
cy.get('[data-testid="nav.trucks"]').click();
|
||||
cy.contains("trucks (contract api) page");
|
||||
cy.wait("@getTrucks").its("response.statusCode").should("be.oneOf", [200, 304]);
|
||||
cy.get('[data-testid="trucksResult"]').should("not.be.empty");
|
||||
});
|
||||
});
|
@@ -34,4 +34,4 @@
|
||||
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
@@ -14,7 +14,7 @@
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
import "./commands";
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
// require('./commands')
|
||||
|
Reference in New Issue
Block a user