Skip to content

Commit

Permalink
LRCI-3881 Add playwright batch
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjiheigel authored and brianchandotcom committed Nov 20, 2023
1 parent c4011f4 commit 8c07934
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions build-test-batch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7196,6 +7196,101 @@ ${output.content}</echo>
</run-batch-test>
</target>

<target name="playwright-js-tomcat90-mysql57-jdk8">
<run-batch-test>
<test-action>
<database-test-run-test database.type="mysql" stop.app.server="true">
<test-action>
<delete dir="${liferay.home}/work" />

<antcall inheritAll="false" target="prepare-log4j-ext-xml" />

<antcall if:set="env.JENKINS_HOME" inheritAll="false" target="prepare-portal-ext-properties" />

<antcall inheritall="false" target="start-app-server" />

<waitfor maxwait="${timeout.app.server.wait}" maxwaitunit="second">
<http url="http://localhost:8080/web/guest" />
</waitfor>

<trycatch>
<try>
<start-docker-playwright />

<gradle-execute dir="${project.dir}/modules/test/playwright" task="npmInstall" />

<docker-execute container="${playwright.docker.host}">
cd /opt/dev/projects/github/liferay-portal/modules/test/playwright

npx playwright test
</docker-execute>
</try>
<finally>
<stop-docker-playwright />

<antcall target="stop-app-server" />

<beanshell>
<![CDATA[
import com.liferay.jenkins.results.parser.Dom4JUtil;
import com.liferay.jenkins.results.parser.JenkinsResultsParserUtil;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.Node;
String projectDir = project.getProperty("project.dir");
File testResultsFile = new File(projectDir + "/modules/test/playwright/test-results/TEST-playwright.xml");
if (!testResultsFile.exists()) {
return;
}
String content = JenkinsResultsParserUtil.read(testResultsFile);
try {
Document document = Dom4JUtil.parse(content);
List nodes = Dom4JUtil.getNodesByXPath(document, "//testsuite");
if ((nodes != null) && !nodes.isEmpty()) {
int i = 1;
for (Node node : nodes) {
if (!(node instanceof Element)) {
continue;
}
Element element = (Element)node;
File partitionedTestResultsFile = new File(projectDir + "/modules/test/playwright/test-results/TEST-playwright" + i + ".xml");
JenkinsResultsParserUtil.write(partitionedTestResultsFile, Dom4JUtil.format(element));
i++;
}
}
testResultsFile.delete();
}
catch (Exception exception) {
exception.printStackTrace();
}
]]>
</beanshell>
</finally>
</trycatch>
</test-action>
</database-test-run-test>
</test-action>

<test-set-up>
<setup-test-environment />
</test-set-up>
</run-batch-test>
</target>

<target name="plugins-compile-jdk8">
<run-batch-test>
<test-action>
Expand Down

0 comments on commit 8c07934

Please sign in to comment.