Skip to content

Instantly share code, notes, and snippets.

@gregblake
Created April 5, 2022 19:12
Show Gist options
  • Save gregblake/5426188a04af1934c779441948d212c3 to your computer and use it in GitHub Desktop.
Save gregblake/5426188a04af1934c779441948d212c3 to your computer and use it in GitHub Desktop.
Browse Rooms Test Scenarios

Browse Rooms Cypress Test Scenarios

What we want to validate on this page (the first two are the most important):

  1. Can the current user see every room that should be visible to them?
  2. Can the current user see any rooms that should not be visible to them?
  3. Are other elements accurate? For example, the room roster count, the room names, and the public/private icon.

To answer those questions, here's how we should set these tests up:

Scenario 1:

When there are the following rooms:

  • A public room where the current user is a member.
  • A public room where the current user is not a member.
  • A private room where the current user is a member.
  • A private room where the current user is not a member.

Setup: Cypress should create the following rooms (someone other than the current user should create each room).

  • A public room named "Public room 1". Add the current user to this room.
  • A public room named "Public room @". Don't add any additional users to this room.
  • A private room named "The current user is a member of this private room". The current user should be a room member.
  • A private room named "A private room that the current user doesn't have access to". The current user should not be a room member.

Expectations:

  • The current user should see the "Browse Rooms" title and the text "Rooms:".
  • The text "Public Room 1" should be visible. The public room icon should be present on this row. The text "2
  • On another row: The text "Public Room 2" should be visible. The public room icon should be present on this row. The text "1 member" should be visible on this row.
  • The text "The current user is a member of this private room" should be visible. The private room icon should be present on this row. The text "2 members" should be visible on this row.
  • No other rooms should be visible.

Scenario 2:

When there are no rooms.

Setup: nothing.

Expectation: the current user should see the "Browse Rooms" title, the text "Rooms:" and no rooms should be visible.

Before each of these steps, Cypress should delete every room. This way, data from one test won't interfere with data from another test, and the tests can run in random order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment