From e4762e036abedaf10eaf590cdae606c66b5fe070 Mon Sep 17 00:00:00 2001 From: Simon Laden Date: Fri, 22 Dec 2023 15:15:43 +0000 Subject: [PATCH 1/5] FISH-8072 - cleanboot test with arquillian --- .../samples/cleanboot/README.md | 24 +++ .../payara-samples/samples/cleanboot/pom.xml | 73 +++++++ .../functional/cleanboot/AdminGroup.java | 134 +++++++++++++ .../functional/cleanboot/AdminInstance.java | 184 ++++++++++++++++++ .../functional/cleanboot/AdminPage.java | 21 ++ .../functional/cleanboot/CleanBootIT.java | 99 ++++++++++ 6 files changed, 535 insertions(+) create mode 100644 appserver/tests/payara-samples/samples/cleanboot/README.md create mode 100644 appserver/tests/payara-samples/samples/cleanboot/pom.xml create mode 100644 appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminGroup.java create mode 100644 appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminInstance.java create mode 100644 appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminPage.java create mode 100644 appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/CleanBootIT.java diff --git a/appserver/tests/payara-samples/samples/cleanboot/README.md b/appserver/tests/payara-samples/samples/cleanboot/README.md new file mode 100644 index 00000000000..47d1850b79f --- /dev/null +++ b/appserver/tests/payara-samples/samples/cleanboot/README.md @@ -0,0 +1,24 @@ +# Cleanboot File Tests + +Boots the domain and test the admin console in a browser. + +Creates an instance, starts it, checks the logs for any trace above INFO, stops the instance(s), deletes the instance(s) + +Creates a deployment group, create instances for that group, starts the group, checks the logs for any trce above INFO, stops the instances, delete the instances, delete the group + +Logs above INFO are printed in the output, to be assessed manually (some warnings are known issues and can be ignored). + +Any log above WARNING will fail the test. + + +## run the tests: + +By default, it is run in managed mode, with the command + + mvn clean verify + +This will run the test against the current version of Payara Server, with Arquillian. + +Alternatively, you can start the domain indepedently and run the test in remote mode: + + mvn clean verify -Ppayara-server-remote \ No newline at end of file diff --git a/appserver/tests/payara-samples/samples/cleanboot/pom.xml b/appserver/tests/payara-samples/samples/cleanboot/pom.xml new file mode 100644 index 00000000000..41ac021bca9 --- /dev/null +++ b/appserver/tests/payara-samples/samples/cleanboot/pom.xml @@ -0,0 +1,73 @@ + + + + 4.0.0 + + + + fish.payara.samples + payara-samples-profiled-tests + 6.2024.1-SNAPSHOT + + + fish.payara.samples + clean-boot-test + 6.2024.1-SNAPSHOT + Payara Samples - Payara - Clean boot test + + + 1.40.0 + + + + + + com.microsoft.playwright + playwright + ${playwright.version} + + + fish.payara.samples + samples-test-utils + test + + + + + + payara-server-managed + + true + + + ${session.executionRootDirectory}/target/${payara.directory.name} + + + + \ No newline at end of file diff --git a/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminGroup.java b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminGroup.java new file mode 100644 index 00000000000..4de11fb8d60 --- /dev/null +++ b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminGroup.java @@ -0,0 +1,134 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package fish.payara.functional.cleanboot; + +import com.microsoft.playwright.Locator; +import com.microsoft.playwright.Page; +import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; +import com.microsoft.playwright.options.AriaRole; +import com.microsoft.playwright.options.WaitForSelectorState; + +public class AdminGroup { + + static public void goToDeploymentGroupPage(Page page) { + // Click on the option Instances in the menu + Locator groupButton = page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Deployment Groups").setExact(true)); + groupButton.click(); + page.waitForSelector("div[id='propertyForm:dgTable']"); + + // Expect the title to contain Instances + assertThat(page).hasTitle("Deployment Groups"); + } + + static public void waitForProcess(Page page) { + // wait for modal to appear and disappear + page.waitForSelector("input[value='Processing...']"); + //page.waitForSelector("div#ajaxPanelBody"); + page.waitForSelector("input[value='Processing...']", + new Page.WaitForSelectorOptions().setTimeout(120000).setState(WaitForSelectorState.HIDDEN)); + page.waitForSelector("div#ajaxPanelBody", + new Page.WaitForSelectorOptions().setTimeout(120000).setState(WaitForSelectorState.HIDDEN)); + + } + + static public void acceptDialog(Page page) { + //Confirm the next dialog window + page.onceDialog(dialog -> { + dialog.accept(); + }); + } + + static public void dismissDialog(Page page) { + //Confirm the next dialog window + page.onceDialog(dialog -> { + dialog.dismiss(); + }); + } + + static public void createGroup(Page page, String nameGroup, String[] nameInstances) { + + AdminPage.gotoHomepage(page); + goToDeploymentGroupPage(page); + + // Create new instance + page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("New...")).click(); + page.waitForSelector("input[id='propertyForm:propertySheet:propertySectionTextField:NameTextProp:NameText']"); + page.getByRole(AriaRole.TEXTBOX).fill(nameGroup); + page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("OK")).click(); + page.waitForSelector("input[value='New...']"); + + //Check for the presence of the new instance in the table + Locator groupLink = page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(nameGroup).setExact(true)); + assertThat(groupLink).isVisible(); + groupLink.click(); + page.waitForSelector("table.Tab1TblNew_sun4"); + + //Create instances in the group + for (String nameInstance : nameInstances) { + Locator groupTabs = page.locator("table.Tab1TblNew_sun4"); + Locator groupInstanceTab = groupTabs.getByRole(AriaRole.LINK, new Locator.GetByRoleOptions().setName("Instances").setExact(true)); + groupInstanceTab.click(); + + //Create new instance + page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("New...")).click(); + page.waitForSelector("input[id='propertyForm:propertySheet:propertSectionTextField:NameTextProp:NameText']"); + page.getByRole(AriaRole.TEXTBOX).fill(nameInstance); + page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("OK")).click(); + page.waitForSelector("input[value=' Save ']"); + + // Check for the presence of the new instance in the table + Locator instanceLink = page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(nameInstance).setExact(true)); + assertThat(instanceLink).isVisible(); + + Locator groupGeneralTab = groupTabs.getByRole(AriaRole.LINK, new Locator.GetByRoleOptions().setName("General").setExact(true)); + groupGeneralTab.click(); + } + + } + + static public void startGroups(Page page) { + AdminPage.gotoHomepage(page); + goToDeploymentGroupPage(page); + + acceptDialog(page); + + Locator selectAllButton = page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Select All").setExact(true)); + selectAllButton.click(); + Locator startButton = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Start Deployment Group")); + startButton.click(); + + waitForProcess(page); + } + + static public void stopGroups(Page page) { + AdminPage.gotoHomepage(page); + goToDeploymentGroupPage(page); + + acceptDialog(page); + + //Select all groups and Stop + Locator selectAllButton = page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Select All").setExact(true)); + selectAllButton.click(); + Locator stopButton = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Stop Deployment Group")); + stopButton.click(); + + waitForProcess(page); + } + + static public void deleteGroups(Page page) { + AdminPage.gotoHomepage(page); + goToDeploymentGroupPage(page); + + acceptDialog(page); + + //Delete all groups + Locator selectAllButton = page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Select All").setExact(true)); + selectAllButton.click(); + Locator deleteButton = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Delete")); + deleteButton.click(); + + waitForProcess(page); + } +} diff --git a/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminInstance.java b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminInstance.java new file mode 100644 index 00000000000..c0f28b641bd --- /dev/null +++ b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminInstance.java @@ -0,0 +1,184 @@ +package fish.payara.functional.cleanboot; + +import com.microsoft.playwright.Locator; +import com.microsoft.playwright.Page; +import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; +import com.microsoft.playwright.options.AriaRole; +import com.microsoft.playwright.options.WaitForSelectorState; +import java.util.List; + +public class AdminInstance { + + static public void goToInstancePage(Page page) { + //Click on the option Instances in the menu + Locator instanceButton = page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Instances").setExact(true)); + instanceButton.click(); + page.waitForSelector("input[value=' Save ']"); + + //Expect the title to contain Instances + assertThat(page).hasTitle("Payara Server Instances"); + } + + static public void waitForProcess(Page page) { + //Wait for modal to appear and disappear + page.waitForSelector("input[value='Processing...']"); + //page.waitForSelector("div#ajaxPanelBody"); + page.waitForSelector("input[value='Processing...']", + new Page.WaitForSelectorOptions().setTimeout(120000).setState(WaitForSelectorState.HIDDEN)); + page.waitForSelector("div#ajaxPanelBody", + new Page.WaitForSelectorOptions().setTimeout(120000).setState(WaitForSelectorState.HIDDEN)); + + } + + static public void acceptDialog(Page page) { + //Confirm the next dialog window + page.onceDialog(dialog -> { + dialog.accept(); + }); + } + + static public void dismissDialog(Page page) { + //Confirm the next dialog window + page.onceDialog(dialog -> { + dialog.dismiss(); + }); + } + + static public void createInstance(Page page, String nameInstance) { + + AdminPage.gotoHomepage(page); + goToInstancePage(page); + + //Create new instance + page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("New...")).click(); + page.waitForSelector("input[id='propertyForm:propertySheet:propertSectionTextField:NameTextProp:NameText']"); + page.getByRole(AriaRole.TEXTBOX).fill(nameInstance); + page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("OK")).click(); + page.waitForSelector("input[value=' Save ']"); + + //Check for the presence of the new instance in the table + Locator instanceLink = page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(nameInstance).setExact(true)); + assertThat(instanceLink).isVisible(); + } + + static public void startInstance(Page page, String nameInstance) { + + AdminPage.gotoHomepage(page); + goToInstancePage(page); + + //Open the page of the instance to start it + Locator instanceLink = page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(nameInstance).setExact(true)); + instanceLink.click(); + page.waitForSelector("div[id='propertyForm:propertyContentPage']"); + + //Confirm the dialog window + acceptDialog(page); + + Locator startButton = page.locator("input[value='Start']"); + startButton.click(); + + waitForProcess(page); + } + + static public void startInstances(Page page, String nameInstance) { + + AdminPage.gotoHomepage(page); + goToInstancePage(page); + + //Select all instances and start + Locator selectAllButton = page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Select All").setExact(true)); + selectAllButton.click(); + + //Confirm the dialog window + acceptDialog(page); + + Locator startButton = page.locator("input[value='Start']"); + startButton.click(); + + waitForProcess(page); + } + + static public void stopInstances(Page page) { + + AdminPage.gotoHomepage(page); + goToInstancePage(page); + + //Confirm the dialog window + acceptDialog(page); + + //Select all instances and start + Locator selectAllButton = page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Select All").setExact(true)); + selectAllButton.click(); + Locator stopButton = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Stop")); + stopButton.click(); + + waitForProcess(page); + } + + static public void deleteInstances(Page page) { + + AdminPage.gotoHomepage(page); + goToInstancePage(page); + + //Confirm the dialog window + acceptDialog(page); + + //Delete all instances + Locator selectAllButton = page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Select All").setExact(true)); + selectAllButton.click(); + Locator deleteButton = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Delete")); + deleteButton.click(); + + waitForProcess(page); +} + + static public String collectLogs(Page page, String nameInstance, String[] logLevels) { + String logs = nameInstance + " : \n"; + + AdminPage.gotoHomepage(page); + goToInstancePage(page); + + //Open the page of the instance and open the logs + Locator instanceLink = page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(nameInstance).setExact(true)); + instanceLink.click(); + page.waitForSelector("div[id='propertyForm:propertyContentPage']"); + Locator viewLogButton = page.locator("input[value='View Log Files']"); + + try ( + Page logPage = page.waitForPopup(() -> { + viewLogButton.click(); + })) { + logPage.waitForLoadState(); + + logPage.waitForSelector("div[id='propertyForm:basicTable']"); + + Locator logLevelCombobox = logPage.locator("select[id='propertyForm:propertyContentPage:propertySheet:propertSectionTextField:logLevelProp:logLevel']"); + logLevelCombobox.click(); + for (String logLevel : logLevels) { + //Change the log level to the desired value and filter logs on that level + Locator logLevelSelector = logPage.getByLabel("Log Level:"); + logLevelSelector.selectOption(logLevel, new Locator.SelectOptionOptions().setForce(true)); + Locator searchButton = logPage.locator("input[id='propertyForm:propertyContentPage:bottomButtons:searchButtonBottom']"); + searchButton.click(); + logPage.waitForLoadState(); + //Create list of every details buttons displayed + List detailsButtons = logPage.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("(details)")).all(); + for (Locator detailsButton : detailsButtons) { + try (Page detailPageEvent = logPage.waitForPopup(() -> { + detailsButton.click(); + })) { + detailPageEvent.waitForLoadState(); + String logEntryLevel = detailPageEvent.locator("span[id*='logLevel']").textContent(); + List logEntryMessages = detailPageEvent.locator("span[id*='completeMessage']").all(); + if (!logEntryMessages.isEmpty()) { + String logEntryMessage = detailPageEvent.locator("span[id*='completeMessage']").textContent(); + logs = logs.concat(logEntryLevel + " - " + logEntryMessage + " \n"); + } + } + } + } + } + logs = logs.concat(" \n"); + return logs; + } +} diff --git a/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminPage.java b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminPage.java new file mode 100644 index 00000000000..35a6a2cf2a5 --- /dev/null +++ b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminPage.java @@ -0,0 +1,21 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package fish.payara.functional.cleanboot; + +import com.microsoft.playwright.Page; + +/** + * + * @author SimonLaden + */ +public class AdminPage { + + static public void gotoHomepage(Page page) { + // Open the admin page + page.navigate("http://localhost:4848"); + page.waitForSelector("div[id='treeForm:tree_children']"); + } + +} diff --git a/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/CleanBootIT.java b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/CleanBootIT.java new file mode 100644 index 00000000000..0070d673492 --- /dev/null +++ b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/CleanBootIT.java @@ -0,0 +1,99 @@ +package fish.payara.functional.cleanboot; + +import com.microsoft.playwright.*; +import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.RunAsClient; + +import fish.payara.samples.PayaraArquillianTestRunner; +import fish.payara.samples.PayaraTestShrinkWrap; +import fish.payara.samples.NotMicroCompatible; + +import org.jboss.shrinkwrap.api.spec.WebArchive; +import java.sql.Timestamp; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(PayaraArquillianTestRunner.class) +@NotMicroCompatible +public class CleanBootIT { + + static private Page page; + + @Deployment(testable = false) + public static WebArchive createDeployment() { + WebArchive archive = PayaraTestShrinkWrap.getWebArchive(); + return archive; + } + + @BeforeClass + static public void openPage() { + //Load the Admin Console + Playwright playwright = Playwright.create(); + Browser browser = playwright.chromium().launch(); + page = browser.newPage(); + page.navigate("http://localhost:4848/"); + page.waitForSelector("table[role='presentation']", new Page.WaitForSelectorOptions().setTimeout(120000)); + } + + @AfterClass + static public void closePage() { + page.close(); + } + + @Test + @RunAsClient + public void openAdminConsole() { + AdminPage.gotoHomepage(page); + assertThat(page).hasTitle("Payara Server Console - Common Tasks"); + } + + @Test + @RunAsClient + public void createInstanceTest() { + Timestamp timestamp = new Timestamp(System.currentTimeMillis()); + String logs = timestamp.toString() + " \n"; + + AdminInstance.createInstance(page, "testInstance1"); + AdminInstance.startInstance(page, "testInstance1"); + + String[] logLevels = {"WARNING", "SEVERE", "ALERT", "EMERGENCY"}; + logs = logs.concat(AdminInstance.collectLogs(page, "testInstance1", logLevels)); + + AdminInstance.stopInstances(page); + AdminInstance.deleteInstances(page); + + timestamp = new Timestamp(System.currentTimeMillis()); + logs = logs.concat(timestamp.toString()) + " \n"; + Assert.assertTrue(!(logs.contains("SEVERE") && !(logs.contains("ALERT"))) && !(logs.contains("EMERGENCY"))); + System.out.println(logs); + } + + @Test + @RunAsClient + public void createDeploymentGroupTest() { + Timestamp timestamp = new Timestamp(System.currentTimeMillis()); + String logs = timestamp.toString() + " \n"; + String[] instances = {"groupInstance1", "groupInstance2"}; + + AdminGroup.createGroup(page, "group1", instances); + AdminGroup.startGroups(page); + + String[] logLevels = {"WARNING", "SEVERE", "ALERT", "EMERGENCY"}; + logs = logs.concat(AdminInstance.collectLogs(page, "groupInstance1", logLevels)); + logs = logs.concat(AdminInstance.collectLogs(page, "groupInstance2", logLevels)); + + AdminGroup.stopGroups(page); + AdminGroup.deleteGroups(page); + AdminInstance.deleteInstances(page); + + timestamp = new Timestamp(System.currentTimeMillis()); + logs = logs.concat(timestamp.toString()) + " \n"; + Assert.assertTrue(!(logs.contains("SEVERE") && !(logs.contains("ALERT"))) && !(logs.contains("EMERGENCY"))); + System.out.println(logs); + } +} From 22e88408cf5f7cba3c585e04a52bfa499ea8ff4b Mon Sep 17 00:00:00 2001 From: Simon Laden Date: Wed, 10 Jan 2024 13:24:36 +0000 Subject: [PATCH 2/5] FISH-8072 - add cleanboot test to the list of modules to run in samples FISH-8072 - install playwright dependencies in jenkins --- Jenkinsfile | 15 +++++++++++++++ .../payara-samples/samples/cleanboot/pom.xml | 9 ++++----- appserver/tests/payara-samples/samples/pom.xml | 1 + 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 335fcfcb485..1996860b96c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -74,6 +74,21 @@ pipeline { } stage('Setup for Payara Samples Tests') { steps { + echo '*#*#*#*#*#*#*#*#*#*#*#*# Install Playwright Dependencies *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + sh """sudo apt-get update""" + sh """sudo apt-get -y install libatk1.0-0\ + libatk-bridge2.0-0\ + libcups2\ + libxkbcommon0\ + libatspi2.0-0\ + libxcomposite1\ + libxdamage1\ + libxfixes3\ + libxrandr2\ + libgbm1\ + libpango-1.0-0\ + libcairo2""" + echo '*#*#*#*#*#*#*#*#*#*#*#*# Playwright Dependencies installed *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' setupDomain() } } diff --git a/appserver/tests/payara-samples/samples/cleanboot/pom.xml b/appserver/tests/payara-samples/samples/cleanboot/pom.xml index 41ac021bca9..b71c04a2749 100644 --- a/appserver/tests/payara-samples/samples/cleanboot/pom.xml +++ b/appserver/tests/payara-samples/samples/cleanboot/pom.xml @@ -29,17 +29,16 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + + cleanboot + 6.2024.1-SNAPSHOT + Payara Samples - Payara - Clean boot test fish.payara.samples payara-samples-profiled-tests 6.2024.1-SNAPSHOT - - fish.payara.samples - clean-boot-test - 6.2024.1-SNAPSHOT - Payara Samples - Payara - Clean boot test 1.40.0 diff --git a/appserver/tests/payara-samples/samples/pom.xml b/appserver/tests/payara-samples/samples/pom.xml index e76c8b4ad5d..6f5628d837e 100644 --- a/appserver/tests/payara-samples/samples/pom.xml +++ b/appserver/tests/payara-samples/samples/pom.xml @@ -90,6 +90,7 @@ reproducers opentelemetry use-bundled-jsf-primefaces + cleanboot From 178f6c7d29b4612d80ff98db10ecb6f907e1f012 Mon Sep 17 00:00:00 2001 From: Simon Laden Date: Thu, 11 Jan 2024 16:00:13 +0000 Subject: [PATCH 3/5] FISH-8072 - install dependencies via mvn --- Jenkinsfile | 15 ---------- .../payara-samples/samples/cleanboot/pom.xml | 30 +++++++++++++++++++ 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1996860b96c..335fcfcb485 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -74,21 +74,6 @@ pipeline { } stage('Setup for Payara Samples Tests') { steps { - echo '*#*#*#*#*#*#*#*#*#*#*#*# Install Playwright Dependencies *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - sh """sudo apt-get update""" - sh """sudo apt-get -y install libatk1.0-0\ - libatk-bridge2.0-0\ - libcups2\ - libxkbcommon0\ - libatspi2.0-0\ - libxcomposite1\ - libxdamage1\ - libxfixes3\ - libxrandr2\ - libgbm1\ - libpango-1.0-0\ - libcairo2""" - echo '*#*#*#*#*#*#*#*#*#*#*#*# Playwright Dependencies installed *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' setupDomain() } } diff --git a/appserver/tests/payara-samples/samples/cleanboot/pom.xml b/appserver/tests/payara-samples/samples/cleanboot/pom.xml index b71c04a2749..fc4eed71c37 100644 --- a/appserver/tests/payara-samples/samples/cleanboot/pom.xml +++ b/appserver/tests/payara-samples/samples/cleanboot/pom.xml @@ -57,6 +57,36 @@ test + + + + org.codehaus.mojo + exec-maven-plugin + 3.1.1 + + + install-playwright-dependencies + pre-integration-test + + exec + + + + + java + com.microsoft.playwright.CLI + + -classpath + + com.microsoft.playwright.CLI + install-deps + + false + + + + + From edec5db154a23339c5dc29ae81e83ccb48535114 Mon Sep 17 00:00:00 2001 From: Simon Laden Date: Tue, 16 Jan 2024 16:33:09 +0000 Subject: [PATCH 4/5] FISH-8072 - playwright dependencies installation can be bypassed --- Jenkinsfile | 2 +- .../samples/cleanboot/README.md | 23 ++++++- .../payara-samples/samples/cleanboot/pom.xml | 64 ++++++++++--------- .../tests/payara-samples/samples/pom.xml | 10 ++- 4 files changed, 67 insertions(+), 32 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 335fcfcb485..33ef9e25911 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -80,7 +80,7 @@ pipeline { stage('Run Payara Samples Tests') { steps { echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - sh """mvn -V -B -ff clean install --strict-checksums -Ppayara-server-remote \ + sh """mvn -V -B -ff clean install --strict-checksums -Ppayara-server-remote,playwright \ -Dpayara.version=${pom.version} \ -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ -Djavax.xml.accessExternalSchema=all \ diff --git a/appserver/tests/payara-samples/samples/cleanboot/README.md b/appserver/tests/payara-samples/samples/cleanboot/README.md index 47d1850b79f..37d3d0146dc 100644 --- a/appserver/tests/payara-samples/samples/cleanboot/README.md +++ b/appserver/tests/payara-samples/samples/cleanboot/README.md @@ -21,4 +21,25 @@ This will run the test against the current version of Payara Server, with Arquil Alternatively, you can start the domain indepedently and run the test in remote mode: - mvn clean verify -Ppayara-server-remote \ No newline at end of file + mvn clean verify -Ppayara-server-remote + +## Playwright dependencies + +By default, this test will check and install Playwright dependencies before running the test. +The user needs to have the permimssions to install such dependencies. +Alternatively, dependencies can be installed manually. +Playwright needs the following libraries to run: + libatk1.0-0 + libatk-bridge2.0-0 + libcups2 + libxkbcommon0 + libatspi2.0-0 + libxcomposite1 + libxdamage1 + libxfixes3 + libxrandr2 + libgbm1 + libpango-1.0-0 + libcairo2 +and to run the test without installing the dependencies with maven and Playwright CLI command: + mvn clean verify -P!install-deps \ No newline at end of file diff --git a/appserver/tests/payara-samples/samples/cleanboot/pom.xml b/appserver/tests/payara-samples/samples/cleanboot/pom.xml index fc4eed71c37..7ae7cf9fabe 100644 --- a/appserver/tests/payara-samples/samples/cleanboot/pom.xml +++ b/appserver/tests/payara-samples/samples/cleanboot/pom.xml @@ -57,35 +57,7 @@ test - - - - org.codehaus.mojo - exec-maven-plugin - 3.1.1 - - - install-playwright-dependencies - pre-integration-test - - exec - - - - - java - com.microsoft.playwright.CLI - - -classpath - - com.microsoft.playwright.CLI - install-deps - - false - - - - + @@ -98,5 +70,39 @@ ${session.executionRootDirectory}/target/${payara.directory.name} + + install-deps + + true + + + + + org.codehaus.mojo + exec-maven-plugin + 3.1.1 + + + install-playwright-dependencies + pre-integration-test + + exec + + + + + java + com.microsoft.playwright.CLI + + -classpath + + com.microsoft.playwright.CLI + install-deps + + + + + + \ No newline at end of file diff --git a/appserver/tests/payara-samples/samples/pom.xml b/appserver/tests/payara-samples/samples/pom.xml index 6f5628d837e..2866e37998e 100644 --- a/appserver/tests/payara-samples/samples/pom.xml +++ b/appserver/tests/payara-samples/samples/pom.xml @@ -90,7 +90,6 @@ reproducers opentelemetry use-bundled-jsf-primefaces - cleanboot @@ -109,4 +108,13 @@ + + + + playwright + + cleanboot + + + From 6a7bffdc0edfebaba7e5a4c3032f3d9b847399d4 Mon Sep 17 00:00:00 2001 From: Simon Laden Date: Wed, 17 Jan 2024 10:32:40 +0000 Subject: [PATCH 5/5] FISH-8072 - add logs and conditions to fail --- .../payara/functional/cleanboot/AdminGroup.java | 5 +++++ .../functional/cleanboot/AdminInstance.java | 15 ++++++++++++++- .../payara/functional/cleanboot/CleanBootIT.java | 10 ++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminGroup.java b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminGroup.java index 4de11fb8d60..a993d8c683a 100644 --- a/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminGroup.java +++ b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminGroup.java @@ -49,6 +49,8 @@ static public void dismissDialog(Page page) { static public void createGroup(Page page, String nameGroup, String[] nameInstances) { + System.out.println("Create the deployment group " + nameGroup); + AdminPage.gotoHomepage(page); goToDeploymentGroupPage(page); @@ -89,6 +91,9 @@ static public void createGroup(Page page, String nameGroup, String[] nameInstanc } static public void startGroups(Page page) { + + System.out.println("Start the deployment groups"); + AdminPage.gotoHomepage(page); goToDeploymentGroupPage(page); diff --git a/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminInstance.java b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminInstance.java index c0f28b641bd..026044944ba 100644 --- a/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminInstance.java +++ b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminInstance.java @@ -46,6 +46,8 @@ static public void dismissDialog(Page page) { static public void createInstance(Page page, String nameInstance) { + System.out.println("Create the instance " + nameInstance); + AdminPage.gotoHomepage(page); goToInstancePage(page); @@ -63,6 +65,8 @@ static public void createInstance(Page page, String nameInstance) { static public void startInstance(Page page, String nameInstance) { + System.out.println("Start the instance " + nameInstance); + AdminPage.gotoHomepage(page); goToInstancePage(page); @@ -80,7 +84,9 @@ static public void startInstance(Page page, String nameInstance) { waitForProcess(page); } - static public void startInstances(Page page, String nameInstance) { + static public void startInstances(Page page) { + + System.out.println("Start the instances"); AdminPage.gotoHomepage(page); goToInstancePage(page); @@ -100,6 +106,8 @@ static public void startInstances(Page page, String nameInstance) { static public void stopInstances(Page page) { + System.out.println("Stop the instances"); + AdminPage.gotoHomepage(page); goToInstancePage(page); @@ -117,6 +125,8 @@ static public void stopInstances(Page page) { static public void deleteInstances(Page page) { + System.out.println("Delete the instances"); + AdminPage.gotoHomepage(page); goToInstancePage(page); @@ -133,6 +143,9 @@ static public void deleteInstances(Page page) { } static public String collectLogs(Page page, String nameInstance, String[] logLevels) { + + System.out.println("Collect the logs from " + nameInstance); + String logs = nameInstance + " : \n"; AdminPage.gotoHomepage(page); diff --git a/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/CleanBootIT.java b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/CleanBootIT.java index 0070d673492..545064e3069 100644 --- a/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/CleanBootIT.java +++ b/appserver/tests/payara-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/CleanBootIT.java @@ -69,8 +69,11 @@ public void createInstanceTest() { timestamp = new Timestamp(System.currentTimeMillis()); logs = logs.concat(timestamp.toString()) + " \n"; - Assert.assertTrue(!(logs.contains("SEVERE") && !(logs.contains("ALERT"))) && !(logs.contains("EMERGENCY"))); System.out.println(logs); + boolean containsError = logs.contains("SEVERE") || logs.contains("ALERT") || logs.contains("EMERGENCY"); + if (containsError) { + Assert.fail("Logs contain SEVERE or ALERT or EMERGENCY"); + } } @Test @@ -93,7 +96,10 @@ public void createDeploymentGroupTest() { timestamp = new Timestamp(System.currentTimeMillis()); logs = logs.concat(timestamp.toString()) + " \n"; - Assert.assertTrue(!(logs.contains("SEVERE") && !(logs.contains("ALERT"))) && !(logs.contains("EMERGENCY"))); System.out.println(logs); + boolean containsError = logs.contains("SEVERE") || logs.contains("ALERT") || logs.contains("EMERGENCY"); + if (containsError) { + Assert.fail("Logs contain SEVERE or ALERT or EMERGENCY"); + } } }