I am trying to test a react component that has a properties that changes when the user logs in. I can't change the login prop from the testcafe suite itself because the user can only login clicking on a magic link that she receives on her email.
Given the example component below, how can I test the Logout button?
Test cafe will always see the isLoggedIn prop as false and it doesn't allow to set components props to some custom value while testing.
const Header = ({ isLoggedIn }) => (
<div>
{isLoggedIn ? (
<button onClick={login}>Login</button>
) : (
<button onClick={logout}>Logout</button>
)}
</div>
);
Aucun commentaire:
Enregistrer un commentaire