normalize line endings

This commit is contained in:
Athou
2025-03-10 08:38:21 +01:00
parent ec4554c76e
commit fb7f041454
223 changed files with 18091 additions and 18093 deletions

View File

@@ -1,80 +1,80 @@
package com.commafeed.e2e;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import com.microsoft.playwright.Browser;
import com.microsoft.playwright.Locator;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright;
import com.microsoft.playwright.assertions.PlaywrightAssertions;
import com.microsoft.playwright.options.AriaRole;
import io.quarkus.test.junit.QuarkusTest;
@QuarkusTest
class AuthentificationIT {
private final Playwright playwright = Playwright.create();
private final Browser browser = playwright.chromium().launch();
private Page page;
@BeforeEach
void init() {
page = browser.newContext().newPage();
}
@AfterEach
void cleanup() {
playwright.close();
}
@Test
void loginFail() {
page.navigate(getLoginPageUrl());
page.getByPlaceholder("User Name or E-mail").fill("admin");
page.getByPlaceholder("Password").fill("wrong_password");
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Log in")).click();
PlaywrightAssertions.assertThat(page.getByRole(AriaRole.ALERT)).containsText("wrong username or password");
}
@Test
void loginSuccess() {
page.navigate(getLoginPageUrl());
PlaywrightTestUtils.login(page);
PlaywrightAssertions.assertThat(page).hasURL("http://localhost:8085/#/app/category/all");
}
@Test
void registerFailPasswordTooSimple() {
page.navigate(getLoginPageUrl());
page.getByText("Sign up!").click();
page.getByPlaceholder("User Name").fill("user");
page.getByPlaceholder("E-mail address").fill("user@domain.com");
page.getByPlaceholder("Password").fill("pass");
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Sign up")).click();
Locator alert = page.getByRole(AriaRole.ALERT);
PlaywrightAssertions.assertThat(alert).containsText("Password must be 8 or more characters in length.");
PlaywrightAssertions.assertThat(alert).containsText("Password must contain 1 or more uppercase characters.");
PlaywrightAssertions.assertThat(alert).containsText("Password must contain 1 or more digit characters.");
PlaywrightAssertions.assertThat(alert).containsText("Password must contain 1 or more special characters.");
}
@Test
void registerSuccess() {
page.navigate(getLoginPageUrl());
page.getByText("Sign up!").click();
page.getByPlaceholder("User Name").fill("user");
page.getByPlaceholder("E-mail address").fill("user@domain.com");
page.getByPlaceholder("Password").fill("MyPassword1!");
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Sign up")).click();
PlaywrightAssertions.assertThat(page).hasURL("http://localhost:8085/#/app/category/all");
}
private String getLoginPageUrl() {
return "http://localhost:8085/#/login";
}
}
package com.commafeed.e2e;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import com.microsoft.playwright.Browser;
import com.microsoft.playwright.Locator;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright;
import com.microsoft.playwright.assertions.PlaywrightAssertions;
import com.microsoft.playwright.options.AriaRole;
import io.quarkus.test.junit.QuarkusTest;
@QuarkusTest
class AuthentificationIT {
private final Playwright playwright = Playwright.create();
private final Browser browser = playwright.chromium().launch();
private Page page;
@BeforeEach
void init() {
page = browser.newContext().newPage();
}
@AfterEach
void cleanup() {
playwright.close();
}
@Test
void loginFail() {
page.navigate(getLoginPageUrl());
page.getByPlaceholder("User Name or E-mail").fill("admin");
page.getByPlaceholder("Password").fill("wrong_password");
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Log in")).click();
PlaywrightAssertions.assertThat(page.getByRole(AriaRole.ALERT)).containsText("wrong username or password");
}
@Test
void loginSuccess() {
page.navigate(getLoginPageUrl());
PlaywrightTestUtils.login(page);
PlaywrightAssertions.assertThat(page).hasURL("http://localhost:8085/#/app/category/all");
}
@Test
void registerFailPasswordTooSimple() {
page.navigate(getLoginPageUrl());
page.getByText("Sign up!").click();
page.getByPlaceholder("User Name").fill("user");
page.getByPlaceholder("E-mail address").fill("user@domain.com");
page.getByPlaceholder("Password").fill("pass");
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Sign up")).click();
Locator alert = page.getByRole(AriaRole.ALERT);
PlaywrightAssertions.assertThat(alert).containsText("Password must be 8 or more characters in length.");
PlaywrightAssertions.assertThat(alert).containsText("Password must contain 1 or more uppercase characters.");
PlaywrightAssertions.assertThat(alert).containsText("Password must contain 1 or more digit characters.");
PlaywrightAssertions.assertThat(alert).containsText("Password must contain 1 or more special characters.");
}
@Test
void registerSuccess() {
page.navigate(getLoginPageUrl());
page.getByText("Sign up!").click();
page.getByPlaceholder("User Name").fill("user");
page.getByPlaceholder("E-mail address").fill("user@domain.com");
page.getByPlaceholder("Password").fill("MyPassword1!");
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Sign up")).click();
PlaywrightAssertions.assertThat(page).hasURL("http://localhost:8085/#/app/category/all");
}
private String getLoginPageUrl() {
return "http://localhost:8085/#/login";
}
}

View File

@@ -1,38 +1,38 @@
package com.commafeed.e2e;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import com.microsoft.playwright.Browser;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright;
import com.microsoft.playwright.assertions.PlaywrightAssertions;
import io.quarkus.test.junit.QuarkusTest;
@QuarkusTest
class DocumentationIT {
private final Playwright playwright = Playwright.create();
private final Browser browser = playwright.chromium().launch();
private Page page;
@BeforeEach
void init() {
page = browser.newContext().newPage();
}
@AfterEach
void cleanup() {
playwright.close();
}
@Test
void documentationAvailable() {
page.navigate("http://localhost:8085/#/api");
PlaywrightAssertions.assertThat(page.getByText("Download OpenAPI specification:")).isVisible();
}
}
package com.commafeed.e2e;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import com.microsoft.playwright.Browser;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright;
import com.microsoft.playwright.assertions.PlaywrightAssertions;
import io.quarkus.test.junit.QuarkusTest;
@QuarkusTest
class DocumentationIT {
private final Playwright playwright = Playwright.create();
private final Browser browser = playwright.chromium().launch();
private Page page;
@BeforeEach
void init() {
page = browser.newContext().newPage();
}
@AfterEach
void cleanup() {
playwright.close();
}
@Test
void documentationAvailable() {
page.navigate("http://localhost:8085/#/api");
PlaywrightAssertions.assertThat(page.getByText("Download OpenAPI specification:")).isVisible();
}
}

View File

@@ -1,18 +1,18 @@
package com.commafeed.e2e;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Page.GetByRoleOptions;
import com.microsoft.playwright.options.AriaRole;
import lombok.experimental.UtilityClass;
@UtilityClass
public class PlaywrightTestUtils {
public static void login(Page page) {
page.getByPlaceholder("User Name or E-mail").fill("admin");
page.getByPlaceholder("Password").fill("admin");
page.getByRole(AriaRole.BUTTON, new GetByRoleOptions().setName("Log in")).click();
}
}
package com.commafeed.e2e;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Page.GetByRoleOptions;
import com.microsoft.playwright.options.AriaRole;
import lombok.experimental.UtilityClass;
@UtilityClass
public class PlaywrightTestUtils {
public static void login(Page page) {
page.getByPlaceholder("User Name or E-mail").fill("admin");
page.getByPlaceholder("Password").fill("admin");
page.getByRole(AriaRole.BUTTON, new GetByRoleOptions().setName("Log in")).click();
}
}

View File

@@ -1,110 +1,110 @@
package com.commafeed.e2e;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import org.apache.commons.io.IOUtils;
import org.apache.hc.core5.http.HttpStatus;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockserver.client.MockServerClient;
import org.mockserver.integration.ClientAndServer;
import org.mockserver.model.HttpRequest;
import org.mockserver.model.HttpResponse;
import com.commafeed.frontend.model.Entries;
import com.microsoft.playwright.Browser;
import com.microsoft.playwright.Locator;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright;
import com.microsoft.playwright.assertions.PlaywrightAssertions;
import com.microsoft.playwright.options.AriaRole;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
@QuarkusTest
class ReadingIT {
private final Playwright playwright = Playwright.create();
private final Browser browser = playwright.chromium().launch();
private Page page;
private MockServerClient mockServerClient;
@BeforeEach
void init() throws IOException {
this.page = browser.newContext().newPage();
this.mockServerClient = ClientAndServer.startClientAndServer(0);
this.mockServerClient.when(HttpRequest.request().withMethod("GET"))
.respond(HttpResponse.response()
.withBody(IOUtils.toString(getClass().getResource("/feed/rss.xml"), StandardCharsets.UTF_8))
.withDelay(TimeUnit.MILLISECONDS, 100));
RestAssured.authentication = RestAssured.preemptive().basic("admin", "admin");
}
@AfterEach
void cleanup() {
playwright.close();
RestAssured.reset();
}
@Test
void scenario() {
// login
page.navigate("http://localhost:8085");
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Log in")).click();
PlaywrightTestUtils.login(page);
Locator header = page.getByRole(AriaRole.BANNER);
Locator sidebar = page.getByRole(AriaRole.NAVIGATION);
Locator main = page.getByRole(AriaRole.MAIN);
PlaywrightAssertions.assertThat(main.getByText("You don't have any subscriptions yet.")).hasCount(1);
// subscribe
header.getByRole(AriaRole.BUTTON, new Locator.GetByRoleOptions().setName("Subscribe")).click();
main.getByText("Feed URL *").fill("http://localhost:" + this.mockServerClient.getPort());
main.getByRole(AriaRole.BUTTON, new Locator.GetByRoleOptions().setName("Next")).click();
main.getByRole(AriaRole.BUTTON, new Locator.GetByRoleOptions().setName("Subscribe").setExact(true)).click();
// click on subscription
sidebar.getByText(Pattern.compile("CommaFeed test feed\\d+")).click();
// we have two unread entries
PlaywrightAssertions.assertThat(main.getByRole(AriaRole.ARTICLE)).hasCount(2);
// click on first entry
main.getByText("Item 1").click();
PlaywrightAssertions.assertThat(main.getByText("Item 1 description")).hasCount(1);
PlaywrightAssertions.assertThat(main.getByText("Item 2 description")).hasCount(0);
// wait for the entry to be marked as read since the UI is updated immediately while the entry is marked as read in the background
Awaitility.await()
.atMost(15, TimeUnit.SECONDS)
.until(() -> RestAssured.given()
.get("rest/category/entries?id=all&readType=unread")
.then()
.statusCode(HttpStatus.SC_OK)
.extract()
.as(Entries.class), e -> e.getEntries().size() == 1);
// click on subscription
sidebar.getByText(Pattern.compile("CommaFeed test feed\\d*")).click();
// only one unread entry now
PlaywrightAssertions.assertThat(main.getByRole(AriaRole.ARTICLE)).hasCount(1);
// click on second entry
main.getByText("Item 2").click();
PlaywrightAssertions.assertThat(main.getByText("Item 1 description")).hasCount(0);
PlaywrightAssertions.assertThat(main.getByText("Item 2 description")).hasCount(1);
}
}
package com.commafeed.e2e;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import org.apache.commons.io.IOUtils;
import org.apache.hc.core5.http.HttpStatus;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockserver.client.MockServerClient;
import org.mockserver.integration.ClientAndServer;
import org.mockserver.model.HttpRequest;
import org.mockserver.model.HttpResponse;
import com.commafeed.frontend.model.Entries;
import com.microsoft.playwright.Browser;
import com.microsoft.playwright.Locator;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright;
import com.microsoft.playwright.assertions.PlaywrightAssertions;
import com.microsoft.playwright.options.AriaRole;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
@QuarkusTest
class ReadingIT {
private final Playwright playwright = Playwright.create();
private final Browser browser = playwright.chromium().launch();
private Page page;
private MockServerClient mockServerClient;
@BeforeEach
void init() throws IOException {
this.page = browser.newContext().newPage();
this.mockServerClient = ClientAndServer.startClientAndServer(0);
this.mockServerClient.when(HttpRequest.request().withMethod("GET"))
.respond(HttpResponse.response()
.withBody(IOUtils.toString(getClass().getResource("/feed/rss.xml"), StandardCharsets.UTF_8))
.withDelay(TimeUnit.MILLISECONDS, 100));
RestAssured.authentication = RestAssured.preemptive().basic("admin", "admin");
}
@AfterEach
void cleanup() {
playwright.close();
RestAssured.reset();
}
@Test
void scenario() {
// login
page.navigate("http://localhost:8085");
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Log in")).click();
PlaywrightTestUtils.login(page);
Locator header = page.getByRole(AriaRole.BANNER);
Locator sidebar = page.getByRole(AriaRole.NAVIGATION);
Locator main = page.getByRole(AriaRole.MAIN);
PlaywrightAssertions.assertThat(main.getByText("You don't have any subscriptions yet.")).hasCount(1);
// subscribe
header.getByRole(AriaRole.BUTTON, new Locator.GetByRoleOptions().setName("Subscribe")).click();
main.getByText("Feed URL *").fill("http://localhost:" + this.mockServerClient.getPort());
main.getByRole(AriaRole.BUTTON, new Locator.GetByRoleOptions().setName("Next")).click();
main.getByRole(AriaRole.BUTTON, new Locator.GetByRoleOptions().setName("Subscribe").setExact(true)).click();
// click on subscription
sidebar.getByText(Pattern.compile("CommaFeed test feed\\d+")).click();
// we have two unread entries
PlaywrightAssertions.assertThat(main.getByRole(AriaRole.ARTICLE)).hasCount(2);
// click on first entry
main.getByText("Item 1").click();
PlaywrightAssertions.assertThat(main.getByText("Item 1 description")).hasCount(1);
PlaywrightAssertions.assertThat(main.getByText("Item 2 description")).hasCount(0);
// wait for the entry to be marked as read since the UI is updated immediately while the entry is marked as read in the background
Awaitility.await()
.atMost(15, TimeUnit.SECONDS)
.until(() -> RestAssured.given()
.get("rest/category/entries?id=all&readType=unread")
.then()
.statusCode(HttpStatus.SC_OK)
.extract()
.as(Entries.class), e -> e.getEntries().size() == 1);
// click on subscription
sidebar.getByText(Pattern.compile("CommaFeed test feed\\d*")).click();
// only one unread entry now
PlaywrightAssertions.assertThat(main.getByRole(AriaRole.ARTICLE)).hasCount(1);
// click on second entry
main.getByText("Item 2").click();
PlaywrightAssertions.assertThat(main.getByText("Item 1 description")).hasCount(0);
PlaywrightAssertions.assertThat(main.getByText("Item 2 description")).hasCount(1);
}
}