Skip to content

UI Tests

Yichao Yu edited this page Jan 25, 2021 · 4 revisions

There are a few aspects of the UI that I'm not sure how to test automatically. Because of this, some tests needs to be done manually by checking the UI in a browser.

Test setup

TODO: more setup will be needed for backend testing.

  • Create test accounts

    The tests/recreate_testuser.js scripts can create the initial accounts that are useful for testing. The make recreate-testuser target can run this script using the correct setting so that the result can be directly loaded by the test server.

    The script creates two account, both with the password abcdef123456 and both will be approved and verified. One account will use the dummy email address [email protected] and will be an administrator account. The second is a normal account using the email address [email protected]. The database entry for the two users will be printed by the script.

  • Start the server

    Run make test-server which should start the test server. The front page is accessible at http://localhost:8000 .

Tests

  • Sidebar test

    1. The left sidebar should be shown by default without overlap with the main content on a wide screen. On a narrow screen it should be hiden by default and when expanded it should be over the main content with a overlay about the normal content. Clicking the overlay should hide the sidebar.

    2. Navigate to a page, e.g. register or forgot password (when not logged in). When the left sidebar is shown in the narrow screen mode with the overlay, clicking the icon at the top of the sidebar should bring back the front page. The overlay about the main content should still exist and clicking it should hide the sidebar.

  • Login/register/reset password pages

    1. Without logging in, the front page should show the login screen. Remember me should be selected by default.

    2. Clicking the lost password link should switch to the password reset page. Control-click, middle click or other ways to open the link in a new tab/page should also work. For a simple click, if the email field is not empty, it's content should be forwarded to the password reset page. Cancel on the password reset page should go back to the login page (path should be changed to /login) and the email address that was on the password reset page should be forwarded back to the login page.

    3. Clicking the register link should switch to the password reset page. Control-click, middle click or other ways to open the link in a new tab/page should also work. For a simple click, if the email or the password field is not empty, their contents should be forwarded to the password reset page in the email and the choose password fields, the repeat password field should be empty. Cancel on the register page should go back to the login page (path should be changed to /login) and the email address and choose password fields should be forwarded back to the login page, the content of the reset password field should be discarded.

    4. The top right should show an "anonymous" icon. Clicking on the icon should show a menu with login and register options. Clicking on them should go to the corresponding pages (note that these do not have the auto fill like the link on the login/register/reset password directly).

  • Login with normal user

    • Try to login using the email [email protected] and a wrong password.

      The error should NOT say if the email is correct. The message should be exactly the same as the one when a wrong email address is used. This is a security feature to not leak valid account email addresses.

    • Login using the email [email protected] and the correct password.

      The avatar at the top right corner should change and the clicking it should bring up a menu with the user info, a profile and a logout button. Clicking on the big avatar should go to the gravatar page. The profile button page should go to the profile page (open in new tab/page should work) showing the email address (gray out), a change password link and that the account is approved.

    • Changing the password by clicking on the change password button.

      The error cases to be tested are listed below. If more than one error condition happens, it is OK as long as one error is being reported.

      1. Wrong old password
      2. Empty new password
      3. New password too short
      4. New and repeat password mismatch

      Changing the password correctly should lead to a redirection back to the profile page in 5 seconds. The link on the redirection page should work both for normal clicking and for opening in new tab/window.

    • Trying to access the /login, /register and /lost-password path should lead to a redirection page showing currently logged in email address and back to the home page in 5 seconds. The link on the redirection page should work both for normal clicking and for opening in new tab/window.

    • Opening the page in a different browser tab should show logging in as the correct user.

    • Clicking the logout button in the top right drop down menu should log the user out from the current browser session (and other sessions on refresh) and go back to the home page with the login screen.

Clone this wiki locally