Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add e2e tests #185

Open
npaton opened this issue Nov 25, 2022 · 0 comments
Open

Add e2e tests #185

npaton opened this issue Nov 25, 2022 · 0 comments

Comments

@npaton
Copy link
Contributor

npaton commented Nov 25, 2022

This is a list of some behaviors we want to have covered in e2e tests. This list is not exhaustive. Each item does not describe a scenario but rather a known or expected behavior or combination of behaviors, for which 1+ scenarios should be devised. Ideally, each behavior is tested independently for clearer tests, but realistically, for convenience, we can combine multiple behaviors into a test scenario. In that case, in particular, logs and comments should abound to explain what is being tested.

multiplayer

We want to see if all the mechanics of a multiplayer game are working.

Does the data sync correctly? If player A changes a value, does player B see
it promptly? Testing with 10 players. I guess we could test with 2
players or with 100 players. With 2, we don't have that much syncing going on,
and with 100, we might high some problems with memory and the number of tabs open.
So 10 seems like a reasonable number. I don't know what a reasonable sync delay might
look like in a local test. 10ms or 500ms? Let's test and see what numbers come up; double
what we observe (if we generally sync across all players happens with 80ms, for
example), then double that number (160ms) and add that as the timeout for testing
the sync. This should catch blatant performance regressions. Hopefully, without making
tests too flaky. (the latency timeout is not high priority if we notice too much inconsistency;
in that case, just set a multi-second timeout waiting for sync)

assignment

Players are assigned to games in batches following a set of rules. Are all those
rules working as expected? First, here is a rundown of all the rules. This would like to be a
nearly exhaustive list, but it probably is not, and we need to understand the edges
of these rules with this e2e testing.

  • batches contain a certain number of games, depending on the batch
    configuration (we will only look at the simple or complete strategies, we can
    ignore custom for now).

We will first look at the single-batch case:

  • when a batch is created, all the games defined by the batch are immediately
    created. Test: are all the games created following the batch configuration?
    Look at the game creation logic to understand the differences between simple
    and complete.
  • when the batch starts, the players can "log in". Test: check the players can
    log in when the batch starts.
  • if the batch is canceled, the players can no longer log in. Tests:
    • check log-in closes when batch canceled
    • check if player that has already started the intro steps are kicked out if the batch
      canceled
    • if the players are already in a game and the batch is canceled, the players are kicked out
    • determine where the players are kicked out to when cancelation happens (should
      be the exit steps)

If there is only one game in the batch:

  • all the incoming players are assigned to one game. There can be more
    players assigned to the game than the playerCount number. E.g., Game with 2
    players, 10 players can be assigned to the Game. Test: all players logging in
    are assigned to a game, even if number > playerCount.
    NOTE: we call this "overbooking".
  • which players enter the game is determined by who finishes the intro steps
    first. In the previous example, with 10 players trying to enter a 2-player
    game, when the first 2 players finish the intro steps, the other 8 players
    should be kicked out, and the 2 players should go into the game.

If there is more than 1 game in the batch:

  • players get assigned randomly to games. I do not recal if it is pure
    randomness or if we try to fill out games that a not full first. E.g. 2
    games, playerCount == 2 for both games, 4 players show up, will there be 2
    players assigned to each game, or could 1 game have 3, and the other 1. I
    think we try to assign to games that still have room randomly, then, when they
    are all full, then we overbook. Maybe this is not the case. Maybe we do the
    3/1 assignment example above. TBD. Either way, test: how are players assigned
    to the games?
  • when 1 game is ready to start because playerCount players have finished the
    intro steps, the game starts. The overbooked players are then reassigned to
    the other games in the batch, ONLY to other games that have the exact same
    treatment
    . Players that do not have another game with the same treatment to
    go to, are kicked out. Test: are players reassigned to other games with
    the same treatment? Are players kicked out if no other unstarted game exists
    with the same treatment?
    Note: we call the reassignment "overflowing players"

If there is more than 1 started batch.

  • all players get assigned to the first started batch (by started time, not
    creation time). No assignments are made to other batches. Test: assignment
    only happens to the first started batch. Other started batches, even if created
    before, are not getting assigned.
  • when we overflow players (see above), if there are no unstarted games with the
    same treatment in the batch, overflow into games of the next batch (batches
    still sorted by start time). Test cross-batch overflow works as expected.

A few (maybe) obvious things, but might still need to test:

  • we only assign to unstarted games in open batches
  • ...

game progression

  • when all players click submit, the game goes to the next stage
  • when a stage timer runs out, go to the next stage
  • when going from 1 round to the next, is the current round info synced
    correctly
  • we can kick out a player with player.end("reason here"). Does that kick them
    out correctly. If all players leave, does the game end? If 1+ players have
    ended, if all other players click submit on a stage, do we go to the next
    stage as expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant