-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6522 from simonladen/FISH-8072-cleanboot-test-java
FISH-8072 - cleanboot test with arquillian
- Loading branch information
Showing
8 changed files
with
625 additions
and
1 deletion.
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
45 changes: 45 additions & 0 deletions
45
appserver/tests/payara-samples/samples/cleanboot/README.md
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,45 @@ | ||
# 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 | ||
|
||
## 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 |
108 changes: 108 additions & 0 deletions
108
appserver/tests/payara-samples/samples/cleanboot/pom.xml
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,108 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. Copyright (c) | ||
[2023] Payara Foundation and/or its affiliates. All rights reserved. The | ||
contents of this file are subject to the terms of either the GNU General | ||
Public License Version 2 only ("GPL") or the Common Development and Distribution | ||
License("CDDL") (collectively, the "License"). You may not use this file | ||
except in compliance with the License. You can obtain a copy of the License | ||
at https://github.com/payara/Payara/blob/master/LICENSE.txt See the License | ||
for the specific language governing permissions and limitations under the | ||
License. When distributing the software, include this License Header Notice | ||
in each file and include the License file at glassfish/legal/LICENSE.txt. | ||
GPL Classpath Exception: The Payara Foundation designates this particular | ||
file as subject to the "Classpath" exception as provided by the Payara Foundation | ||
in the GPL Version 2 section of the License file that accompanied this code. | ||
Modifications: If applicable, add the following below the License Header, | ||
with the fields enclosed by brackets [] replaced by your own identifying | ||
information: "Portions Copyright [year] [name of copyright owner]" Contributor(s): | ||
If you wish your version of this file to be governed by only the CDDL or | ||
only the GPL Version 2, indicate your decision by adding "[Contributor] elects | ||
to include this software in this distribution under the [CDDL or GPL Version | ||
2] license." If you don't indicate a single choice of license, a recipient | ||
has the option to distribute your version of this file under either the CDDL, | ||
the GPL Version 2 or to extend the choice of license to its licensees as | ||
provided above. However, if you add GPL Version 2 code and therefore, elected | ||
the GPL Version 2 license, then the option applies only if the new code is | ||
made subject to such option by the copyright holder. --> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
|
||
<artifactId>cleanboot</artifactId> | ||
<version>6.2024.1-SNAPSHOT</version> | ||
<name>Payara Samples - Payara - Clean boot test</name> | ||
|
||
<parent> | ||
<groupId>fish.payara.samples</groupId> | ||
<artifactId>payara-samples-profiled-tests</artifactId> | ||
<version>6.2024.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<properties> | ||
<playwright.version>1.40.0</playwright.version> | ||
</properties> | ||
|
||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.microsoft.playwright</groupId> | ||
<artifactId>playwright</artifactId> | ||
<version>${playwright.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>fish.payara.samples</groupId> | ||
<artifactId>samples-test-utils</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
|
||
|
||
<profiles> | ||
<profile> | ||
<id>payara-server-managed</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<properties> | ||
<payara.home>${session.executionRootDirectory}/target/${payara.directory.name}</payara.home> | ||
</properties> | ||
</profile> | ||
<profile> | ||
<id>install-deps</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>3.1.1</version> | ||
<executions> | ||
<execution> | ||
<id>install-playwright-dependencies</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<executable>java</executable> | ||
<mainClass>com.microsoft.playwright.CLI</mainClass> | ||
<arguments> | ||
<argument>-classpath</argument> | ||
<classpath /> | ||
<argument>com.microsoft.playwright.CLI</argument> | ||
<argument>install-deps</argument> | ||
</arguments> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
139 changes: 139 additions & 0 deletions
139
...-samples/samples/cleanboot/src/test/java/fish/payara/functional/cleanboot/AdminGroup.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,139 @@ | ||
/* | ||
* 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) { | ||
|
||
System.out.println("Create the deployment group " + nameGroup); | ||
|
||
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) { | ||
|
||
System.out.println("Start the deployment groups"); | ||
|
||
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); | ||
} | ||
} |
Oops, something went wrong.