I'm writing integration tests for my Next.JS application, and it is persistently failing on this test case meant to check the button pressing with no inputs. I anticipated it may be down to the DOM not loading in, or the action not being assigned to the button, but manual testing, and the insertion of the wait()
call have no effect on the result.
describe('login', () => {
it('has clickable login button', () => {
cy.visit(domain + "/login")
cy.wait(10000)
cy.get("#loginsubmit").click()
})
})
Here's the output in the Cypress client of the test.
This is the page on which the error keeps happening.
"use client";
import ...
export default function Login() {
const [state, action, pending] = useActionState(login, undefined);
return (
<section className="...">
<div className="text-center">
<span className={title()}>Login</span>
</div>
<Form
action={action}
className="..."
>
...
<Button id="loginsubmit" disabled={pending} type="submit">
Log In
</Button>
{state?.errors?.password && <p>{state.errors.password}</p>}
</Form>
</section>
);
}
Any help would be appreciated.