diff --git a/src/main/java/com/uniovi/services/InsertSampleDataService.java b/src/main/java/com/uniovi/services/InsertSampleDataService.java index f7596821..40b12549 100644 --- a/src/main/java/com/uniovi/services/InsertSampleDataService.java +++ b/src/main/java/com/uniovi/services/InsertSampleDataService.java @@ -61,15 +61,19 @@ public void insertSampleQuestions() throws InterruptedException { if (Arrays.stream(environment.getActiveProfiles()).anyMatch(env -> (env.equalsIgnoreCase("test")))) { log.info("Test profile active, skipping sample data insertion"); - questionRepository.deleteAll(); - List questionsTest = questionService.testQuestions(4); - questionsTest.forEach(questionService::addNewQuestion); return; } generateSampleData(); } + @Transactional + public void generateTestQuestions() { + questionRepository.deleteAll(); + List questionsTest = questionService.testQuestions(4); + questionsTest.forEach(questionService::addNewQuestion); + } + @Transactional public void generateSampleData() throws InterruptedException { diff --git a/src/test/java/com/uniovi/steps/GameStep.java b/src/test/java/com/uniovi/steps/GameStep.java index a46cb0b5..15d7bff0 100644 --- a/src/test/java/com/uniovi/steps/GameStep.java +++ b/src/test/java/com/uniovi/steps/GameStep.java @@ -19,6 +19,7 @@ public class GameStep extends Wiq_IntegrationTests { @When("I press Play") public void iPressPlay() { + dataService.generateTestQuestions(); List elems = SeleniumUtils.waitLoadElementsBy(driver, "free", "//*[@href=\"/game\"]", 5); elems.get(0).click(); }