add welcome page

This commit is contained in:
Athou
2023-05-04 21:27:02 +02:00
parent 05453364ff
commit e0f242fe22
36 changed files with 322 additions and 14 deletions

View File

@@ -15,12 +15,12 @@ import io.dropwizard.testing.junit5.DropwizardExtensionsSupport;
@ExtendWith(DropwizardExtensionsSupport.class)
class AuthentificationIT extends PlaywrightTestBase {
private static final DropwizardAppExtension<CommaFeedConfiguration> EXT = new DropwizardAppExtension<CommaFeedConfiguration>(
CommaFeedApplication.class, ResourceHelpers.resourceFilePath("config.test.yml"));
private static final DropwizardAppExtension<CommaFeedConfiguration> EXT = new DropwizardAppExtension<>(CommaFeedApplication.class,
ResourceHelpers.resourceFilePath("config.test.yml"));
@Test
void loginFail() {
page.navigate("http://localhost:" + EXT.getLocalPort());
page.navigate(getLoginPageUrl());
page.locator("[placeholder='User Name or E-mail']").fill("admin");
page.locator("[placeholder='Password']").fill("wrong_password");
page.locator("button:has-text('Log in')").click();
@@ -29,14 +29,14 @@ class AuthentificationIT extends PlaywrightTestBase {
@Test
void loginSuccess() {
page.navigate("http://localhost:" + EXT.getLocalPort());
page.navigate(getLoginPageUrl());
PlaywrightTestUtils.login(page);
PlaywrightAssertions.assertThat(page).hasURL("http://localhost:" + EXT.getLocalPort() + "/#/app/category/all");
}
@Test
void registerFailPasswordTooSimple() {
page.navigate("http://localhost:" + EXT.getLocalPort());
page.navigate(getLoginPageUrl());
page.locator("text=Sign up!").click();
page.locator("[placeholder='User Name']").fill("user");
page.locator("[placeholder='E-mail address']").fill("user@domain.com");
@@ -52,7 +52,7 @@ class AuthentificationIT extends PlaywrightTestBase {
@Test
void registerSuccess() {
page.navigate("http://localhost:" + EXT.getLocalPort());
page.navigate(getLoginPageUrl());
page.locator("text=Sign up!").click();
page.locator("[placeholder='User Name']").fill("user");
page.locator("[placeholder='E-mail address']").fill("user@domain.com");
@@ -60,4 +60,8 @@ class AuthentificationIT extends PlaywrightTestBase {
page.locator("button:has-text('Sign up')").click();
PlaywrightAssertions.assertThat(page).hasURL("http://localhost:" + EXT.getLocalPort() + "/#/app/category/all");
}
private String getLoginPageUrl() {
return "http://localhost:" + EXT.getLocalPort() + "/#/login";
}
}

View File

@@ -43,6 +43,7 @@ class ReadingIT extends PlaywrightTestBase {
void scenario() {
// login
page.navigate("http://localhost:" + EXT.getLocalPort());
page.locator("button:has-text('Log in')").click();
PlaywrightTestUtils.login(page);
PlaywrightAssertions.assertThat(page.locator("text=You don't have any subscriptions yet.")).hasCount(1);