Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 4ceda4c

Browse files
committed
Fix E2E Tests
1 parent ebdacc5 commit 4ceda4c

File tree

7 files changed

+79
-21
lines changed

7 files changed

+79
-21
lines changed

ui/app/scripts/app/controllers/apps.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ define(['model/pageable'], function (Pageable) {
9090
p = $scope.pageable;
9191
} else {
9292
// Remove the else block when paging restored.
93-
$scope.pageable.total = $scope.pageable.items.length;
93+
if ($scope.pageable.items) {
94+
$scope.pageable.total = $scope.pageable.items.length;
95+
}
96+
else {
97+
$scope.pageable.total = 0;
98+
}
9499
$scope.pageable.pageSize = $scope.pageable.total;
95100
$scope.pageNumber = 0;
96101
}
@@ -119,9 +124,11 @@ define(['model/pageable'], function (Pageable) {
119124
* Select all apps
120125
*/
121126
$scope.selectAll = function() {
122-
$scope.pageable.items.forEach(function(item) {
123-
$scope.selected[item.id] = item;
124-
});
127+
if ($scope.pageable.items && $scope.pageable.items.length > 0) {
128+
$scope.pageable.items.forEach(function(item) {
129+
$scope.selected[item.id] = item;
130+
});
131+
}
125132
};
126133

127134
/**

ui/app/scripts/app/dialogs/unregister-apps.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ <h4 class="modal-title">Confirm Unregister Applications</h4>
2121
</div>
2222
<div class="modal-footer">
2323
<button type="button" class="btn btn-default" ng-click="cancel()">No</button>
24-
<button type="button" class="btn btn-primary" ng-click="proceed()">Yes</button>
24+
<button id="unregisterAllAppsConfirmationButton" type="button" class="btn btn-primary" ng-click="proceed()">Yes</button>
2525
</div>

ui/app/scripts/app/views/apps-list.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
<div>
55
<table class="col-lg-12 tab-content-header"><tr>
66
<td class="col-xs-8">
7-
<button type="button" ng-click="registerApps()"
7+
<button id="registerAppsButton" type="button" ng-click="registerApps()"
88
class="btn btn-default"
99
><span class="glyphicon glyphicon-plus"></span>
1010
Register Application(s)
1111
</button>
12-
<button type="button" ng-click="unregisterSelectedApps()"
12+
<button id="unregisterSelectedAppsButton" type="button" ng-click="unregisterSelectedApps()"
1313
class="btn btn-default" ng-disabled="isNoneSelected()"
1414
><span class="glyphicon glyphicon-trash"></span>
1515
Unregister Application(s)
@@ -28,7 +28,7 @@
2828
<thead>
2929
<tr>
3030
<th>
31-
<input type="checkbox" ng-model="toggleSelectAll" ng-model-options="{ getterSetter: true }" ui-indeterminate="isSomeButNotAllSelected()"/>
31+
<input id="selectAllAppsCheckbox" type="checkbox" ng-model="toggleSelectAll" ng-model-options="{ getterSetter: true }" ui-indeterminate="isSomeButNotAllSelected()"/>
3232
</th>
3333
<th>Name</th>
3434
<th>Type</th>

ui/app/scripts/app/views/register-apps.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ <h1>Register Applications</h1>
2626
<tr id="{{$index}}" ng-repeat="app in apps">
2727
<td>
2828
<div ng-class="registerAppsForm[$index + '_name'].$invalid ? 'has-warning has-feedback' : ''">
29-
<input type="text" id="{{$index + '_name'}}" name="{{$index + '_name'}}" class="form-control" placeholder="<Application Name>" required ng-model="app.name" ng-pattern="namePattern">
29+
<input type="text" id="{{'name_' + $index}}" name="{{$index + '_name'}}" class="form-control" placeholder="<Application Name>" required ng-model="app.name" ng-pattern="namePattern">
3030
<span class="glyphicon glyphicon-warning-sign form-control-feedback" ng-show="registerAppsForm[$index + '_name'].$invalid"></span>
3131
</div>
3232
</td>
3333
<td>
34-
<select id="{{$index + '_type'}}" name="{{$index + '_type'}}" class="form-control full-cell-select-input" ng-model="app.type" ng-options="type | capitalize for type in types">
34+
<select id="{{'type_' + $index}}" name="{{$index + '_type'}}" class="form-control full-cell-select-input" ng-model="app.type" ng-options="type | capitalize for type in types">
3535
</td>
3636
<td>
3737
<div ng-class="registerAppsForm[$index + '_uri'].$invalid ? 'has-warning has-feedback' : ''">
38-
<input type="text" id="{{$index + '_uri'}}" name="{{$index + '_uri'}}" class="form-control" placeholder="<maven://io.spring.cloud:scdf-sample-app:jar:1.0.0.BUILD-SNAPSHOT>" required ng-model="app.uri" ng-pattern="uriPattern">
38+
<input type="text" id="{{'uri_' + $index}}" name="{{$index + '_uri'}}" class="form-control" placeholder="<maven://io.spring.cloud:scdf-sample-app:jar:1.0.0.BUILD-SNAPSHOT>" required ng-model="app.uri" ng-pattern="uriPattern">
3939
<span class="glyphicon glyphicon-warning-sign form-control-feedback" ng-show="registerAppsForm[$index + '_uri'].$invalid"></span>
4040
</div>
4141
</td>

ui/app/scripts/stream/directives.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ define(function(require) {
2525
var angular = require('angular');
2626

2727
return angular.module('dataflowStreams.directives', ['dataflowShared.services', 'dataflowStreams.services'])
28-
.directive('uniqueStreamName', ['DataflowUtils', 'StreamService', function (utils, streamService) {
28+
//.directive('uniqueStreamName', ['DataflowUtils', 'StreamService', function (utils, streamService) {
29+
.directive('uniqueStreamName', ['DataflowUtils', function (utils) {
2930
return {
3031
require: 'ngModel',
3132
link: function(scope, elm, attrs, ctrl) {

ui/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"name": "spring-cloud-dataflow-ui",
33
"version": "1.0.0",
4+
"description": "Provides the Dashboard application of Spring Cloud Data Flow",
5+
"license": "Apache-2.0",
46
"devDependencies": {
57
"tmp": "0.0.25",
68
"bower": "1.4.1",

ui/test/e2e/jobs/index-jobs.spec.js

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
* @author Gunnar Hillert
2121
*/
2222
describe('Tests', function() {
23-
2423
beforeEach(function() {
2524
browser.get('/');
2625
browser.ignoreSynchronization = true;
@@ -30,24 +29,49 @@ describe('Tests', function() {
3029
});
3130

3231
describe('When I navigate to the root URL "/"', function() {
33-
it('the app should redirect to "#/tasks/definitions"', function() {
32+
it('the app should redirect to "#/apps/apps"', function() {
3433
browser.get('/');
3534
browser.driver.sleep(2000);
36-
expect(browser.getCurrentUrl()).toContain('/#/streams/definitions')
37-
expect(browser.getTitle()).toBe('Spring Cloud Data Flow');
35+
expect(browser.getCurrentUrl()).toContain('/#/apps/apps')
36+
expect(browser.getTitle()).toBe('Apps');
3837
});
3938
});
4039

4140
describe('When I navigate to some non-existing URL, e.g. "/#/foobar"', function() {
42-
it('the app should redirect to "#/tasks/definitions"', function() {
41+
it('the app should redirect to "#/apps/apps"', function() {
4342
browser.get('/#/foobar');
44-
expect(browser.getCurrentUrl()).toContain('/streams/definitions');
43+
expect(browser.getCurrentUrl()).toContain('/apps/apps');
4544
});
4645
});
4746

4847
//Apps tab
4948

50-
describe('When I navigate to "/tasks/apps"', function() {
49+
describe('When I navigate to "/tasks/apps" (default installation)', function() {
50+
51+
it('First delete all Apps', function() {
52+
browser.get('#/apps/apps').then(function() {
53+
browser.driver.sleep(2000);
54+
var selectAllAppsCheckbox = element(by.css('#selectAllAppsCheckbox'));
55+
56+
selectAllAppsCheckbox.click().then(
57+
function(value) {
58+
//console.log(value, value);
59+
//browser.driver.sleep(4000);
60+
var unregisterSelectedAppsButton = element(by.css('#unregisterSelectedAppsButton'));
61+
62+
unregisterSelectedAppsButton.getAttribute('disabled').then(function(disabled) {
63+
if (!disabled) {
64+
unregisterSelectedAppsButton.click().then(function(value) {
65+
browser.driver.sleep(2000);
66+
var unregisterAllAppsConfirmationButton = element(by.css('#unregisterAllAppsConfirmationButton'));
67+
unregisterAllAppsConfirmationButton.click();
68+
});
69+
}
70+
});
71+
});
72+
});
73+
});
74+
5175
it('there should be 3 tabs of which one is active', function() {
5276
browser.get('#/tasks/apps').then(function() {
5377
expect(element.all(by.css('#dataflow-tasks ul.nav-tabs li')).count()).toEqual(3);
@@ -59,10 +83,34 @@ describe('Tests', function() {
5983
expect(element(by.css('#dataflow-tasks ul li.active a')).getText()).toEqual('Apps');
6084
});
6185
});
62-
it('there should be at least 1 task module being listed', function() {
86+
it('there should be 0 task modules being listed', function() {
6387
browser.get('#/tasks/apps').then(function() {
6488
browser.driver.sleep(2000);
65-
expect(element.all(by.css('#dataflow-tasks table tbody tr')).count()).toBeGreaterThan(0);
89+
expect(element.all(by.css('#dataflow-tasks table tbody tr')).count()).toBe(0);
90+
});
91+
});
92+
it('We need to install the timestamp task', function() {
93+
browser.get('#/apps/apps').then(function() {
94+
browser.driver.sleep(3000);
95+
var registerAppsButton = element(by.css('#registerAppsButton'));
96+
registerAppsButton.click().then(function(value) {
97+
browser.driver.sleep(1000);
98+
var nameInputField = element(by.css('#name_0'));
99+
var typeSelectBox = element(by.css('#type_0'));
100+
var uriInputField = element(by.css('#uri_0'));
101+
102+
nameInputField.clear();
103+
nameInputField.sendKeys('timestamp');
104+
105+
typeSelectBox.element(by.cssContainingText('option', 'Task')).click();
106+
107+
uriInputField.clear();
108+
uriInputField.sendKeys('maven://org.springframework.cloud.task.app:timestamp-task:1.0.0.BUILD-SNAPSHOT');
109+
110+
browser.driver.sleep(2000);
111+
element(by.css('#submit-button')).click()
112+
browser.driver.sleep(2000);
113+
});
66114
});
67115
});
68116
it('there should a task app named timestamp', function() {

0 commit comments

Comments
 (0)