-
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.
- Loading branch information
1 parent
a79c079
commit 8390cc3
Showing
5 changed files
with
91 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Our first test: a test of tests, screenshotting playwright.dev | ||
|
||
sudo apt-get install libxslt1.1\ | ||
sudo apt-get install libwoff1\ | ||
sudo apt-get install libvpx9\ | ||
sudo apt-get install libevent-2.1-7t64\ | ||
sudo apt-get install libopus0\ | ||
sudo apt-get install libgstreamer-plugins-base1.0-0\ | ||
sudo apt-get install libgstreamer-gl1.0-0\ | ||
sudo apt-get install libgstreamer-plugins-bad1.0-0\ | ||
sudo apt-get install libwebpdemux2\ | ||
sudo apt-get install libharfbuzz-icu0\ | ||
sudo apt-get install libenchant-2-2\ | ||
sudo apt-get install libsecret-1-0\ | ||
sudo apt-get install libhyphen0\ | ||
sudo apt-get install libmanette-0.2-0\ | ||
sudo apt-get install libflite1\ | ||
sudo apt-get install libgles2\ | ||
sudo apt-get install gstreamer1.0-libav |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
</head> | ||
|
||
<body> | ||
<h1>XP Voting</h1> | ||
</body> | ||
|
||
</html> |
53 changes: 53 additions & 0 deletions
53
src/test/java/com/nickhumberstone/xpvoting/PlaywrightDefaultIT.java
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,53 @@ | ||
package com.nickhumberstone.xpvoting; | ||
|
||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | ||
import org.springframework.boot.test.web.server.LocalServerPort; | ||
|
||
import com.microsoft.playwright.Browser; | ||
import com.microsoft.playwright.Page; | ||
import com.microsoft.playwright.Playwright; | ||
import static com.microsoft.playwright.assertions.PlaywrightAssertions.*; | ||
import com.microsoft.playwright.options.AriaRole; | ||
|
||
import java.nio.file.Paths; | ||
|
||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||
|
||
public class PlaywrightDefaultIT { | ||
|
||
@LocalServerPort | ||
private Integer port; | ||
|
||
private static Page page; | ||
private static Playwright playwright; | ||
|
||
@BeforeAll | ||
static void launchInstance() { | ||
playwright = Playwright.create(); | ||
Browser browser = playwright.webkit().launch(); | ||
page = browser.newPage(); | ||
} | ||
|
||
@AfterAll | ||
static void closeBrowser() { | ||
playwright.close(); | ||
} | ||
|
||
@Test | ||
void shouldScreenshot() { | ||
page.navigate("http://localhost:" + port); | ||
page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("example.png"))); | ||
} | ||
|
||
@Test | ||
void shouldHaveHeading() { | ||
assertThat(page | ||
.getByRole(AriaRole.HEADING, | ||
new Page.GetByRoleOptions().setName("XP Voting"))) | ||
.isVisible(); | ||
} | ||
} |