uprm-inso4117-2023-2024-s2 / semester-project-study-pet

semester-project-study-pet created by GitHub Classroom
1 stars 3 forks source link

Expanding the GUI Fuzzing tests #333

Closed diego-velez-upr closed 2 months ago

diego-velez-upr commented 2 months ago

Overview

This PR closes issue #269 by adding GUI Fuzzing tests for the Bath page.

Tests

New GUI Fuzzing tests were added under __tests__/bath.test.js. The tests should cover the navigating to the page, changing difficulty, and playing the game within the Bath page.

The eat and flashcards page tests were fixed and refactored.

The tests for playing the game work by first selecting all the correct answers, then throwing intentionally to ensure that the game displays the correct score for each outcome and difficulty.

NOTE: I discovered that it is impossible to score 8/9 points in the game, since the game has a total of 9 questions and 9 answers, thus, because of the way the tests work, it'll choose the first 8 correct answers, then forcing the last answer to be correct.

Running

To run the tests, you need to have Firefox installed, the expo server running in the background (npx expo start), and run the tests by executing npm run test-jest.

Flaky tests

The tests are flaky, meaning some tests sometime fail. I'm not sure the reason why, as I believe the code should be working properly.

diego-velez-upr commented 2 months ago

Consistently, the test for "play game hard difficulty with score of 8/9" fails, mainly because of the reason you put in the description. I suggest you remove this tester as, if it's impossible for the score to be acheived, then there's no reason to test it

And you are also correct on the fact that some tests fail for no apparent reason. I believe MAYBE its clicking elements too quickly and consequently not receiving some inputs (a fix could maybe be adding interrupts between "clicks"). Although I can count these tests as passed since on both tries, the failed ones succeeded on the opposite try.

I increased the timeout between clicks, I usually always use 1000 ms but now increased it 10x to 10000 ms, and still same outcome, although it was a little bit worse before.

The 8/9 test was removed.

gabrielpadilla7 commented 2 months ago

Consistently, the test for "play game hard difficulty with score of 8/9" fails, mainly because of the reason you put in the description. I suggest you remove this tester as, if it's impossible for the score to be acheived, then there's no reason to test it And you are also correct on the fact that some tests fail for no apparent reason. I believe MAYBE its clicking elements too quickly and consequently not receiving some inputs (a fix could maybe be adding interrupts between "clicks"). Although I can count these tests as passed since on both tries, the failed ones succeeded on the opposite try.

I increased the timeout between clicks, I usually always use 1000 ms but now increased it 10x to 10000 ms, and still same outcome, although it was a little bit worse before.

The 8/9 test was removed.

I'll re run the tests and let you know how the outcome was, give me a few minutes