Project Challenge: Create Tests

Now, write tests for different features of the task management application using what we have learned in this chapter.

We'll cover the following

Problem statement

The final challenge of this course is to create tests for the task management application.

You have to create the following tests in the coding environment provided below:

  • you_need_to_be_logged_in(string $path): Test if an unauthenticated user is redirected to the /login page.
  • after_logging_in_you_have_access_to_the_list_of_tasks(): Assert that after logging in, you are redirected to the /list-tasks page. You can utilize the helper functions provided for your convenience. We have set up two accounts for you already.
  • you_can_create_a_task(): Login, create a task, and assert if the task has been created.
  • you_can_edit_a_task(): Login, create a task, click the edit button, and assert if the obtained task is equal to the expected task. Then, edit the task and assert if the task has been edited.
  • you_can_not_provide_an_empty_string_as_a_task(): Login, create an empty task, and assert if the right error message shows up.
  • you_can_not_see_other_tasks_of_other_users(): Login as matthias and create a task. Then, log in as tomas and assert that you can not see the task created by matthias.
  • you_can_not_edit_the_task_of_another_user(): Login as matthias and create a task. Now, log in as tomas and access the task created by matthias through the URL by appending the task ID. Assert if the right error message is generated.
  • you_can_mark_a_task_as_done_and_it_disappears_from_the_list(): Login as matthias, create a task, click Done, and assert if the user has no task.
  • you_can_not_mark_the_task_of_another_user_as_done(): Login as matthias and create a task. Now, log in as tomas, and try marking the task created by mattias as done. Assert if the right error message shows up. Login as matthias again and assert that the task is still there.

Get hands-on with 1200+ tech skills courses.