Skip to content

Commit

Permalink
setup playwright java
Browse files Browse the repository at this point in the history
  • Loading branch information
thielpa committed Jan 20, 2025
1 parent b36762c commit b967213
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
@Log4j2
public class GitHubRepositorySyncService {

@Value("${monitoring.repositories:[]}")
private String[] repositoriesToMonitor;
@Value("${monitoring.repositories:}")
private String[] repositoriesToMonitor = new String[0];

private final GitHub github;
private final GitRepoRepository gitRepoRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ spring:
jpa:
repositories:
bootstrap-mode: deferred
jpa:
database: POSTGRESQL
show-sql: false
hibernate:
ddl-auto: update
security:
oauth2:
resourceserver:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package de.tum.cit.aet.helios;

import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;

import de.tum.cit.aet.helios.e2e.HeliosPlaywrightTest;
import org.junit.jupiter.api.Test;

public class ListRepositoryPageTest extends HeliosPlaywrightTest {
@Test
public void testPageIsRendering() {
page.navigate(this.baseUrl);
assertThat(page).hasURL(this.baseUrl + "/repo/list");
assertThat(page.getByText("Connected Repositories")).isVisible();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package de.tum.cit.aet.helios.e2e;

import com.microsoft.playwright.Browser;
import com.microsoft.playwright.BrowserContext;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright;
import io.zonky.test.db.AutoConfigureEmbeddedDatabase;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest()
@Tag("playwright")
@AutoConfigureEmbeddedDatabase
public abstract class HeliosPlaywrightTest {

protected final String baseUrl = "http://localhost:4200";

private static Playwright playwright;
private static Browser browser;

protected BrowserContext context;
protected Page page;

@BeforeAll
static void launchBrowser() {
playwright = Playwright.create();
browser = playwright.chromium().launch();
}

@AfterAll
static void closeBrowser() {
playwright.close();
}

@BeforeEach
void createContextAndPage() {
context = browser.newContext();
page = context.newPage();
}

@AfterEach
void closeContext() {
context.close();
}
}

0 comments on commit b967213

Please sign in to comment.