Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: WINDUP-1710 - e2e testing #526

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 137 additions & 8 deletions tests/e2e/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,58 @@
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20</version>
<configuration>
<includes>
<include>**/**IT.java</include>
</includes>
<systemPropertyVariables>
<wildfly.remote.port>${wildfly.port}</wildfly.remote.port>
<protractor.path>./node_modules/protractor/bin/protractor</protractor.path>
<protractor.args>protractor.conf.js --params.upload.filePath ${project.build.directory}/deployments/rhamt-web.war --params.visualRegression true</protractor.args>
<workingDirectory>${project.build.directory}/npm</workingDirectory>
<args.conf>protractor.conf.js</args.conf>
<args.params.uploadFile>${project.build.directory}/deployments/rhamt-web.war</args.params.uploadFile>
<args.params.visualRegression>true</args.params.visualRegression>
<logFile>${project.build.directory}/e2e-output.log</logFile>
</systemPropertyVariables>
<failIfNoTests>false</failIfNoTests>
<failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
</configuration>
<executions>
<execution>
<id>failsafe-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>failsafe-verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<executions>
<execution>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
Expand All @@ -82,6 +134,46 @@
</resources>
</configuration>
</execution>
<execution>
<id>copy-database</id>
<phase>test-compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${wildfly.directory}/standalone/data/windup/h2</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/h2</directory>
<filtering>false</filtering>
<includes>
<include>windup-web.h2.db</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>unzip-reports</id>
<phase>test-compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Unzip reports" />
<unzip src="src/main/resources/windup/1355.zip" dest="${project.build.directory}/${wildfly.directory}/standalone/data/windup" />
<chmod file="${project.build.directory}/npm/verify-results.js" perm="771" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand Down Expand Up @@ -146,7 +238,7 @@
<executions>
<execution>
<id>start-wildfly</id>
<phase>test-compile</phase>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>execute-commands</goal>
Expand All @@ -170,7 +262,7 @@
</execution>
<execution>
<id>stop-wildfly</id>
<phase>package</phase>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
Expand Down Expand Up @@ -232,32 +324,69 @@
<outputFile>${project.build.directory/webdriver-update.log}</outputFile>
</configuration>
</execution>

<!--
<execution>
<id>run-e2e</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>



<configuration>
<skip>${skipTests}</skip>
<executable>./node_modules/protractor/bin/protractor</executable>
<workingDirectory>${project.build.directory}/npm</workingDirectory>
<arguments>
<argument>protractor.conf.js</argument>
<argument>- -params.upload.filePath</argument>
<argument>${project.build.directory}/deployments/rhamt-web.war</argument>
</arguments>
<outputFile>${project.build.directory}/e2e-output.log</outputFile>
</configuration>
</execution>
-->
<execution>
<id>run-e2e-visual-regression</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${skipTests}</skip>
<!-- <executable>./run-tests</executable> -->
<successCodes>
<!-- This is a hack, 1 means test failures, but we need to handle it outside of maven-exec plugin -->
<code>1</code>
</successCodes>
<executable>./node_modules/protractor/bin/protractor</executable>
<workingDirectory>${project.build.directory}/npm</workingDirectory>
<arguments>
<argument>protractor.conf.js</argument>
<argument>--params.upload.filePath</argument>
<argument>${project.build.directory}/deployments/rhamt-web.war</argument>
</arguments>

<outputFile>${project.build.directory}/e2e-output.log</outputFile>
</configuration>
</execution>
<execution>
<id>make-results-report</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${skipTests}</skip>
<!-- <executable>./run-tests</executable> -->
<executable>./verify-results.js</executable>
<workingDirectory>${project.build.directory}/npm</workingDirectory>
<arguments>
<argument>${project.build.directory}/npm/test-results.xml</argument>
<argument>${project.build.directory}/failsafe-reports/failsafe-summary.xml</argument>
</arguments>
<outputFile>${project.build.directory}/e2e-verify-results.log</outputFile>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>
14 changes: 10 additions & 4 deletions tests/e2e/src/main/npm/e2e/pages/confirm-dialog.po.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import {browser, by, element, ElementFinder} from "protractor";
import {$, by, element} from "protractor";

export class ConfirmDialogPage {
confirmButton = element(by.css('.confirm-button'));
modal = element(by.css('.modal'));
confirmButton = $('.confirm-button');
modal = $('.modal');
textInput = element(by.id('resource-to-delete'));

isPresent() {
return this.modal.isPresent();
return Promise.all([
this.modal.isPresent(),
this.modal.getAttribute('class')
]).then((result) => {
console.log('IsPresent: ', result);
return result[0] && result[1].search('in') !== -1;
}, error => console.error('Error in isPresent', error));
}

requiresText(): Promise<boolean> {
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/src/main/npm/e2e/pages/login.po.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {browser, by, element} from "protractor";
import {$, browser} from "protractor";

/**
* TODO: This seems to be required in onPrepare phase, I'm not sure if it can be used from this file
* (it would be probably better)
*/
export class LoginPage {
username = element(by.css('#username'));
password = element(by.css('#password'));
loginButton = element(by.css('#kc-login'));
username = $('#username');
password = $('#password');
loginButton = $('#kc-login');

public navigateTo() {
browser.get('/rhamt-web/');
return browser.get('/rhamt-web/');
}

public login(user: string, password: string) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
import {browser, by, element, ElementFinder} from "protractor";
import {$, $$, browser} from "protractor";

export class AnalysisConfigurationPage {
protected transformationPaths = $$('.radio-inline.control-label input');

}
targets = {
EAP7: this.transformationPaths.first(),
EAP6: this.transformationPaths.get(1),
CloudReadiness: this.transformationPaths.get(2)
};

enableCloudReadinessInput = $('[name="cloudTargetsIncluded"]');

selectedApplications = $$('.search-choice');

packages = $$('wu-js-tree-wrapper');

includedPackages = this.packages.first().$$('.jstree-node[aria-selected=true]');

excludedPackages = this.packages.get(1).$$('.jstree-node[aria-selected=true]');

saveAndRunButton = $('.btn-save-run');

public navigateTo(projectId: number) {
return browser.get(`projects/${projectId}/analysis-context`);
}

public saveAndRun() {
return this.saveAndRunButton.click();
}
}
66 changes: 39 additions & 27 deletions tests/e2e/src/main/npm/e2e/pages/project-level/analysis-list.po.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,54 @@
import {browser, by, element, ElementFinder} from "protractor";
import {$, $$, browser, by, element, ElementFinder} from "protractor";

export class AnalysisListPage {
searchTextBox = element(by.name('searchValue'));
searchClearButton = element(by.css('wu-search button.clear'));
searchClearButton = $('wu-search button.clear');

table = element(by.css('table.executions-list-table'));
tableHeaders = this.table.all(by.css('th'));
table = $('table.executions-list-table');
tableHeaders = this.table.$$('th');

emptyDiv = element(by.css('.blank-slate-pf-main-action'));
emptyDiv = $('.blank-slate-pf-main-action');

configureAnalysisButton = element(by.css('.btn.btn-primary'));
configureAnalysisButton = $('.btn.btn-primary');

public getExecutions(): Promise<any[]> {
progressbar = $('.progress-container');

noActiveAnalysisText = $$('.progressbar-no-active-analysis');

public getExecutions(): Promise<Execution[]> {
return this.table.isPresent().then(isPresent => {
if (!isPresent) {
return [];
}

return this.table.all(by.css('tr')).then((tableRows: ElementFinder[]): any => Promise.all(tableRows.map(row => {
const tableColumns = row.all(by.css('td'));

const execution = {
id: '',
status: '',
applications: '',
dateStarted: '',
actions: {
showAnalysisDetail: tableColumns.get(0),
showReport: tableColumns.get(4).all(by.css('a')).get(0),
delete: tableColumns.get(4).all(by.css('a')).get(1)
return this.table.$('tbody').$$('tr').then((tableRows: ElementFinder[]): any => Promise.all(tableRows.map(row => {
const tableColumns = row.$$('td');

return tableColumns.count().then(count => {
if (count == 0) {
return [];
}
};

return Promise.all([
tableColumns.get(0).getText().then(id => execution.id = id),
tableColumns.get(1).getText().then(status => execution.status = status),
tableColumns.get(2).getText().then(countApplications => execution.applications = countApplications),
tableColumns.get(3).getText().then(dateStarted => execution.dateStarted = dateStarted)
]).then(() => execution);

const execution = {
id: '',
status: '',
applications: '',
dateStarted: '',
actions: {
showAnalysisDetail: tableColumns.get(0),
showReport: tableColumns.get(4).$$('a').get(0),
delete: tableColumns.get(4).$$('a').get(1)
},
row: row
};

return Promise.all([
tableColumns.get(0).getText().then(id => execution.id = id),
tableColumns.get(1).getText().then(status => execution.status = status),
tableColumns.get(2).getText().then(countApplications => execution.applications = countApplications),
tableColumns.get(3).getText().then(dateStarted => execution.dateStarted = dateStarted)
]).then(() => execution) as any;
});
})));
});
}
Expand Down Expand Up @@ -75,4 +86,5 @@ export interface Execution {
applications: string;
dateStarted: string;
actions: ExecutionActions;
row: ElementFinder;
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import {browser, by, element, ElementFinder} from "protractor";
import {$, browser, by, element, ElementFinder} from "protractor";

export class ApplicationsListPage {
searchTextBox = element(by.name('searchValue'));
searchClearButton = element(by.css('wu-search button.clear'));
searchClearButton = $('wu-search button.clear');

table = element(by.css('table'));
tableHeaders = this.table.all(by.css('th'));
table = $('table');
tableHeaders = this.table.$$('th');

public getApplications(): Promise<Application[]> {
return this.table.isPresent().then(isPresent => {
if (!isPresent) {
return [];
}

const tableRowsFinder = this.table.element(by.css('tbody')).all(by.css('tr'));
const tableRowsFinder = this.table.$('tbody').$$('tr');

return tableRowsFinder.then((tableRows: ElementFinder[]): any => Promise.all(tableRows.map(row => {
const tableColumns = row.all(by.css('td'));
const tableColumns = row.$$('td');

const application = {
name: '',
Expand Down
Loading