Is the LoginTest intended to fail?

While writing the UI test in module 1 of the intermediate course, ā€œtestStandardUserCanLoginā€ I noticed that the test fails, however the failure is actually correctly capturing the mismatch between the assertion and the code as the standard user is not able to access the Projects page. While the test is intended to login through front end as a regular, non-admin user, it appears as this is intentionally not possible as the code in the ā€œcheckSessionā€ method of the AuthDB class only returns an expiry date if the user is listed as an admin. Otherwise, the verification fails and they are not able to log in.

I understand that in the course activity that follows we are supposed to investigate the tests we have written and the ways the might fail, but Iā€™m confused if the above is actually intentional, as the module does not explain what the outcome of our investigation should be and how we should approach this finding. In real life scenario, I guess this would occur from misunderstanding the requirements or an issues with the code so either the test would not be valid or the code should be amended. I could rewrite the test to use admin user instead or change the verification code but in the absence of more detailed debugging section (such as the one in the foundation course) Iā€™m not sure if this is expected or if I made a mistake at some point.

Could someone please confirm if this is an issue with the course material or an intentional ā€˜issueā€™ we were meant to catch and investigate during the course? Or perhaps I missed something at earlier or later point in the course and what I observed during the testing is a result of mistake on my side?

1 Like

Hi Kris,

Iā€™m sorry but Iā€™m not sure I follow what your asking. Could you tell me what lesson this is in relation to and what test? That might help be to better understand what the your concerns are.

1 Like

Hi Mark,

Iā€™m referring to the test ā€œtestStandardUserCanLoginā€ in class ā€œLogin Testā€ first outlined in lesson 1.4.2 ā€œImplementing State Managementā€ and further fleshed out in the subsequent lessons. Link

Hi Kris,

Gotcha, I think this is an error in the lesson. Youā€™re indeed correct that itā€™s a false negative because Users canā€™t see projects. To get your test passing I would simply update the parameter to admin like so:

dataBuilder.getUserCredentials("admin");

Iā€™ll get the lesson updated once TestBash is over.

1 Like