generated from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Test coverage fix * Test coverage fix * Test coverage fix * Test coverage fix * Test coverage fix * Test coverage fix * Test coverage fix * Test coverage fix * Test coverage fix * Fix multiple cucumber scenarios. Persistent webdriver session * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Test run integration tests * Add caching back * Add caching back * Add caching back * Add caching back * Add caching back * Add caching back * Add caching back * Add caching back * Add caching back * Add caching back * Add caching back
- Loading branch information
Showing
13 changed files
with
158 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,11 @@ public void insertSampleQuestions() { | |
return; | ||
} | ||
|
||
generateSampleData(); | ||
} | ||
|
||
@Transactional | ||
public void generateSampleData() { | ||
if (!playerService.getUserByEmail("[email protected]").isPresent()) { | ||
PlayerDto player = new PlayerDto(); | ||
player.setEmail("[email protected]"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.uniovi; | ||
|
||
import io.cucumber.java.After; | ||
import io.cucumber.java.AfterAll; | ||
import io.cucumber.java.Scenario; | ||
|
||
public class CucumberHooks extends Wiq_IntegrationTests { | ||
@After | ||
public void cleanUpAfterScenario(Scenario scenario) { | ||
driver.manage().deleteAllCookies(); | ||
} | ||
|
||
@AfterAll | ||
public static void before_or_after_all() { | ||
driver.quit(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,34 @@ | ||
package com.uniovi; | ||
|
||
import com.uniovi.util.FirefoxWebDriver; | ||
import io.cucumber.java.After; | ||
import io.cucumber.spring.CucumberContextConfiguration; | ||
import org.junit.jupiter.api.*; | ||
import org.openqa.selenium.WebDriver; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.test.annotation.DirtiesContext; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.ContextConfiguration; | ||
|
||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
@SpringBootTest | ||
@Tag("integration") | ||
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS) | ||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class) | ||
@ActiveProfiles("test") | ||
@CucumberContextConfiguration | ||
@ContextConfiguration(classes = CucumberWiqContext.class) | ||
public class Wiq_IntegrationTests { | ||
protected static final String URL = "http://localhost:3000/"; | ||
|
||
@Autowired | ||
protected WebDriver driver; | ||
protected static WebDriver driver; | ||
|
||
public Wiq_IntegrationTests() { | ||
driver = webDriver(); | ||
} | ||
|
||
public WebDriver webDriver() { | ||
if (driver != null) { | ||
return driver; | ||
} | ||
|
||
driver = new FirefoxWebDriver(); | ||
return driver; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,29 @@ | ||
package com.uniovi; | ||
|
||
import org.junit.jupiter.api.MethodOrderer; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestMethodOrder; | ||
import com.uniovi.entities.Player; | ||
import com.uniovi.services.PlayerService; | ||
import org.junit.jupiter.api.*; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.annotation.DirtiesContext; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import java.util.List; | ||
|
||
import java.util.Optional; | ||
|
||
@SpringBootTest | ||
@Tag("unit") | ||
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD) | ||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class) | ||
@ActiveProfiles("test") | ||
class Wiq_UnitTests { | ||
public class Wiq_UnitTests { | ||
@Autowired | ||
private PlayerService playerService; | ||
|
||
@Test | ||
void contextLoads() { | ||
@Order(1) | ||
public void testPlayerService() { | ||
List<Player> players = playerService.getUsersByRole("ROLE_USER"); | ||
Assertions.assertEquals(0, players.size()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters