Skip to content

Commit 30418af

Browse files
committed
#555 added uninstall test
1 parent ee1874d commit 30418af

File tree

9 files changed

+99
-10
lines changed

9 files changed

+99
-10
lines changed

quick-start/e2e/page-objects/appPage.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export class AppPage extends Page {
3131
return element(by.css('#flows-tab'));
3232
}
3333

34+
get settingsTab() {
35+
return element(by.css('#settings-tab'));
36+
}
37+
3438
get menuButton() {
3539
return element(by.css('#header-menu'));
3640
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { protractor, browser, element, by, By, $, $$, ExpectedConditions as EC } from 'protractor'
2+
import { AppPage } from '../appPage';
3+
import { pages } from '../page';
4+
5+
export class SettingsPage extends AppPage {
6+
7+
//to get the login box locater
8+
locator() {
9+
return by.css('.settings-page');
10+
}
11+
12+
get uninstallButton() {
13+
return element(by.buttonText('Uninstall Hub'));
14+
}
15+
16+
get uninstallConfirmation() {
17+
return element(by.buttonText('Uninstall'));
18+
}
19+
20+
get uninstallStatus() {
21+
return element(by.css('.uninstall-status'));
22+
}
23+
24+
get redeployButton() {
25+
return element(by.buttonText('Redeploy Hub'));
26+
}
27+
}
28+
29+
var settingsPage = new SettingsPage();
30+
export default settingsPage;
31+
pages.addPage(settingsPage);

quick-start/e2e/specs/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {pages} from '../page-objects/page';
33
import auth from './auth'
44
import create from './create';
55
import runFlows from './run';
6+
import uninstall from './uninstall';
7+
68
import CUSTOM_MATCHERS from '../matchers'
79
import loginPage from '../page-objects/auth/login';
810
const request = require('request').defaults({ strictSSL: false })
@@ -54,4 +56,5 @@ describe('QuickStart', function () {
5456
auth(tmpobj.name);
5557
create();
5658
runFlows();
59+
uninstall();
5760
});

quick-start/e2e/specs/run/run.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ export default function() {
1313

1414
it ('should redeploy modules', function() {
1515
flowPage.redeployButton.click();
16-
// let message = 'Redeploying Modules...';
17-
// browser.wait(EC.visibilityOf(flowPage.toast));
18-
// expect(flowPage.toast.isDisplayed()).toBe(true);
19-
browser.wait(EC.visibilityOf(element(by.cssContainingText('#last-deployed-time', 'Last Deployed: less than a minute ago'))));
16+
browser.wait(element(by.css('#last-deployed-time')).getText().then((txt) => {
17+
return (
18+
txt === 'Last Deployed: less than a minute ago' ||
19+
txt === 'Last Deployed: 1 minute ago'
20+
);
21+
}));
2022
});
2123

2224
let flowCount = 1;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import uninstall from './uninstall'
2+
3+
export default function () {
4+
describe('uninstall', function () {
5+
uninstall()
6+
})
7+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { protractor , browser, element, by, By, $, $$, ExpectedConditions as EC} from 'protractor';
2+
import { pages } from '../../page-objects/page';
3+
import loginPage from '../../page-objects/auth/login';
4+
import dashboardPage from '../../page-objects/dashboard/dashboard';
5+
import entityPage from '../../page-objects/entities/entities';
6+
import flowPage from '../../page-objects/flows/flows';
7+
import settingsPage from '../../page-objects/settings/settings';
8+
9+
export default function() {
10+
describe('Uninstall', () => {
11+
beforeAll(() => {
12+
flowPage.isLoaded();
13+
});
14+
15+
it ('should go to the settings page', function() {
16+
flowPage.settingsTab.click();
17+
settingsPage.isLoaded();
18+
});
19+
20+
it ('should click the uninstall button', function() {
21+
settingsPage.uninstallButton.click();
22+
browser.wait(EC.elementToBeClickable(settingsPage.uninstallConfirmation));
23+
settingsPage.uninstallConfirmation.click();
24+
});
25+
26+
it ('should show the uninstall progress bar', function() {
27+
browser.wait(EC.visibilityOf(settingsPage.uninstallStatus));
28+
expect(settingsPage.uninstallStatus.isDisplayed()).toBe(true);
29+
});
30+
31+
it ('should uninstall the hub', function() {
32+
loginPage.isLoadedWithtimeout(200000);
33+
});
34+
});
35+
}

quick-start/protractor.conf.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ exports.config = {
1212
auth: './e2e/specs/auth/auth.ts'
1313
},
1414
capabilities: {
15-
'browserName': 'chrome'
15+
'browserName': 'chrome',
16+
chromeOptions: {
17+
args: [ "--headless", "--disable-gpu", "--window-size=1280,900" ]
18+
}
1619
},
1720
directConnect: true,
1821
baseUrl: 'http://localhost:4200/',

quick-start/src/main/ui/app/installer/install.service.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,15 @@ export class InstallService {
4040
this.stomp.subscribe('/topic/uninstall-status').then((msgId: string) => {
4141
unsubscribeId = msgId;
4242
});
43-
let resp = this.http.delete(`/api/current-project/uninstall`).share();
44-
resp.subscribe(() => {
45-
this.stomp.unsubscribe(unsubscribeId);
43+
return this.ngZone.runOutsideAngular(() => {
44+
let resp = this.http.delete(`/api/current-project/uninstall`).share();
45+
resp.subscribe(() => {
46+
this.ngZone.run(() => {
47+
this.stomp.unsubscribe(unsubscribeId);
48+
});
49+
});
50+
return resp.map(this.extractData);
4651
});
47-
return resp.map(this.extractData);
4852
}
4953

5054
private extractData(res: Response) {

quick-start/src/main/ui/app/settings/settings.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div layout-padding layout="column" layout-align="center center">
1+
<div layout-padding layout="column" layout-align="center center" class="settings-page">
22
<h3>Data Hub Settings</h3>
33

44
<table left-align

0 commit comments

Comments
 (0)