Skip to content

Commit

Permalink
fix: cypress.config
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisSmuda committed Oct 24, 2023
1 parent 4fbc35d commit 0bd4729
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
14 changes: 9 additions & 5 deletions app/entry.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ function hydrate() {
});
}

if (window.requestIdleCallback) {
window.requestIdleCallback(hydrate);
if (process.env.NODE_ENV === "test") {
require("react-dom").hydrate(<RemixBrowser />, document);
} else {
// Safari doesn't support requestIdleCallback
// https://caniuse.com/requestidlecallback
window.setTimeout(hydrate, 1);
if (window.requestIdleCallback) {
window.requestIdleCallback(hydrate);
} else {
// Safari doesn't support requestIdleCallback
// https://caniuse.com/requestidlecallback
window.setTimeout(hydrate, 1);
}
}
13 changes: 7 additions & 6 deletions cypress/e2e/login-route.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ describe("Login Route", () => {
cy.findByRole("status").should("contain", "You are logged in");
});


it("needs both fields to be able submit", () => {
cy.get("input[name=username]").type(faker.name.firstName());
cy.get("input[name=password]").type(`{enter}`);
cy.findByRole("status").should("contain", "error");
});

it("shows a server error on wrong credentials", () => {
cy.get("input[name=username]").type(
faker.name.firstName() + faker.name.lastName()
Expand All @@ -24,10 +31,4 @@ describe("Login Route", () => {
);
cy.findByRole("alert").should("contain", "combination is incorrect");
});

it("needs both fields to be able submit", () => {
cy.get("input[name=username]").type(faker.name.firstName());
cy.get("input[name=password]").type(`{enter}`);
cy.findByRole("status").should("contain", "error");
});
});

0 comments on commit 0bd4729

Please sign in to comment.