diff --git a/src/main/java/com/uniovi/controllers/GameController.java b/src/main/java/com/uniovi/controllers/GameController.java index 1baa3664..c147ea6e 100644 --- a/src/main/java/com/uniovi/controllers/GameController.java +++ b/src/main/java/com/uniovi/controllers/GameController.java @@ -253,17 +253,6 @@ public String updateGame(Model model, HttpSession session, Principal principal) return "game/fragments/gameFrame"; } - @GetMapping("/game/finished/{points}") - public String finishGame(@PathVariable int points, Model model, HttpSession session) { - GameSession gameSession = (GameSession) session.getAttribute(GAMESESSION_STR); - if (gameSession != null) { - gameSessionService.endGame(gameSession); - session.removeAttribute(GAMESESSION_STR); - } - model.addAttribute("score", points); - return "game/gameFinished"; - } - @GetMapping("/game/points") @ResponseBody public String getPoints(HttpSession session) { diff --git a/src/test/java/com/uniovi/steps/GameStep.java b/src/test/java/com/uniovi/steps/GameStep.java index 59fdb022..166722c8 100644 --- a/src/test/java/com/uniovi/steps/GameStep.java +++ b/src/test/java/com/uniovi/steps/GameStep.java @@ -73,6 +73,7 @@ public void iPressPlayWithFriends() throws IOException, InterruptedException { public void iCreateACode() { List elems = SeleniumUtils.waitLoadElementsBy(driver, "id", "createBtn", 5); elems.get(0).click(); + SeleniumUtils.waitSeconds(driver, 5); } @And("I press start") @@ -94,6 +95,7 @@ public void iFillInTheSavedCode() { elems.get(0).sendKeys(code); elems = SeleniumUtils.waitLoadElementsBy(driver, "id", "joinBtn", 5); elems.get(0).click(); + SeleniumUtils.waitSeconds(driver, 5); } @And("I see the multiplayer results") @@ -101,5 +103,11 @@ public void iSeeTheMultiplayerResults() { List elems = SeleniumUtils.waitLoadElementsBy(driver, "id", "createBtn", 5); Assertions.assertEquals(1, elems.size()); elems.get(0).click(); + SeleniumUtils.waitSeconds(driver, 5); + } + + @And("I reload the page") + public void iReloadThePage() { + driver.navigate().refresh(); } } diff --git a/src/test/resources/features/Game.feature b/src/test/resources/features/Game.feature index 5b6b0837..7b56cabf 100644 --- a/src/test/resources/features/Game.feature +++ b/src/test/resources/features/Game.feature @@ -6,4 +6,5 @@ Feature: I try to play a normal game And I press the register button And I go to the home page When I press Play + And I reload the page Then I should start playing until I see message "game.finish" \ No newline at end of file diff --git a/src/test/resources/features/MultiplayerGame.feature b/src/test/resources/features/MultiplayerGame.feature index c7e93ef1..714268d1 100644 --- a/src/test/resources/features/MultiplayerGame.feature +++ b/src/test/resources/features/MultiplayerGame.feature @@ -9,6 +9,7 @@ Feature: I play a multiplayer game And I create a code And I press start Then I should start playing until I see message "multi.finished" + And I see the multiplayer results Scenario: I start a multiplayer game Given I am not registered or logged in @@ -28,5 +29,6 @@ Feature: I play a multiplayer game And I press Play With Friends And I fill in the saved code And I press start + And I reload the page Then I should start playing until I see message "multi.finished" And I see the multiplayer results \ No newline at end of file