Skip to content

Commit 0d5f04e

Browse files
mserigithubguglo
authored andcommitted
SCRD-4708 Add a basic protractor test for day2 (#251)
* SCRD-4708 Add a basic protractor test for day2 * SCRD-6353 Add a basic protractor test for day2
1 parent b9bbd49 commit 0d5f04e

9 files changed

+335
-19
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ the express server
1515
You will get the express server (UI) running on `localhost:2209`.
1616

1717
To run the selenium tests:
18-
1. perform initial setup `npm run protractor-setup` (once, does not
18+
1. Assuming `npm install` is already run, perform initial setup `npm run protractor-setup` (once, does not
1919
need to be done each time)
2020
2. start the app in another terminal `npm start`
21-
3. run the tests `npm run protractor`
21+
3. run the tests `npm run protractor-day0` (for running day0 Installer tests)
22+
4. run the tests `npm run protractor-day2` (for running day2 CLM Admin Console tests)
2223

2324
For more information on protractor/selenium locators see http://www.protractortest.org/#/locators
2425

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"less-loader": "^4.1.0",
4949
"mini-css-extract-plugin": "^0.4.1",
5050
"protractor": "^5.1.2",
51+
"protractor-beautiful-reporter": "^1.2.7",
5152
"react-hot-loader": "^4.3.12",
5253
"style-loader": "^0.23.1",
5354
"url-loader": "^1.1.2",
@@ -60,7 +61,9 @@
6061
"test": "npm run protractor",
6162
"lints": "eslint .",
6263
"protractor-setup": "webdriver-manager update",
63-
"protractor": "protractor protractor.conf.js",
64+
"protractor": "protractor protractor-day0.conf.js",
65+
"protractor-day0": "protractor protractor-day0.conf.js",
66+
"protractor-day2": "protractor protractor-day2.conf.js",
6467
"postinstall": "yes n | cp -i pre-commit.sh .git/hooks/pre-commit",
6568
"start": " webpack-dev-server --mode=development --port 2209 --hot --host 0.0.0.0",
6669
"dist": "webpack --mode=production -p"

protractor-day0.conf.js

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// (c) Copyright 2017-2018 SUSE LLC
2+
/**
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
**/
15+
var HtmlReporter = require('protractor-beautiful-reporter');
16+
17+
18+
exports.config = {
19+
specs: ['./test/e2e/suites/day0/*.spec.js'],
20+
21+
capabilities: {
22+
//Chrome browser settings. Uncomment browserName.
23+
browserName: 'chrome',
24+
25+
//Enable below chromeOptions if you want to run in headless mode
26+
//chromeOptions: {
27+
// args: [ "--headless", "--window-size=1800x1600" ]
28+
//},
29+
30+
//Firefox browser settings. Uncomment browserName and marionette
31+
//browserName: 'firefox',
32+
//marionette : true,
33+
34+
//Enable below firefoxOptions if you want to run in headless mode
35+
//'moz:firefoxOptions': {
36+
// args: [ "--headless" ]
37+
//},
38+
39+
//For bypassing ssl cert
40+
acceptInsecureCerts : true,
41+
42+
// allows different specs to run in parallel.
43+
// If this is set to be true, specs will be sharded by file
44+
// (i.e. all files to be run by this set of capabilities will run in parallel).
45+
// Default is false.
46+
shardTestFiles: true,
47+
48+
// Maximum number of browser instances that can run in parallel for this
49+
// set of capabilities. This is only needed if shardTestFiles is true.
50+
// Default is 1.
51+
maxInstances: 3,
52+
},
53+
54+
55+
// Options to be passed to Jasmine-node
56+
jasmineNodeOpts: {
57+
showColors: true, // Use colors in the command line report.
58+
defaultTimeoutInterval: 200000, // set timeout for async calls
59+
},
60+
61+
baseUrl: 'http://localhost:9085',
62+
framework: 'jasmine',
63+
64+
onPrepare: function() {
65+
browser.ignoreSynchronization = true;
66+
browser.driver.manage().window().maximize();
67+
68+
// Add a screenshot reporter and store screenshots to `/tmp/screenshots`:
69+
jasmine.getEnv().addReporter(new HtmlReporter({
70+
baseDirectory: 'tmp/screenshots'
71+
}).getJasmine2Reporter());
72+
}
73+
};

protractor-day2.conf.js

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// (c) Copyright 2017-2018 SUSE LLC
2+
/**
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
**/
15+
var HtmlReporter = require('protractor-beautiful-reporter');
16+
17+
exports.config = {
18+
//specs: ['./test/**/*.spec.js'],
19+
suites: {
20+
clm_admin_console_service: './test/e2e/suites/day2/clm_admin_console_services/*.spec.js',
21+
},
22+
23+
capabilities: {
24+
//Chrome browser settings. Uncomment browserName.
25+
browserName: 'chrome',
26+
27+
//Enable below chromeOptions if you want to run in headless mode
28+
//chromeOptions: {
29+
// args: [ "--headless", "--window-size=1800x1600" ]
30+
//},
31+
32+
//Firefox browser settings. Uncomment browserName and marionette
33+
//browserName: 'firefox',
34+
//marionette : true,
35+
36+
//Enable below firefoxOptions if you want to run in headless mode
37+
//'moz:firefoxOptions': {
38+
// args: [ "--headless" ]
39+
//},
40+
41+
//For bypassing ssl cert
42+
acceptInsecureCerts : true,
43+
44+
// allows different specs to run in parallel.
45+
// If this is set to be true, specs will be sharded by file
46+
// (i.e. all files to be run by this set of capabilities will run in parallel).
47+
// Default is false.
48+
shardTestFiles: true,
49+
50+
// Maximum number of browser instances that can run in parallel for this
51+
// set of capabilities. This is only needed if shardTestFiles is true.
52+
// Default is 1.
53+
maxInstances: 3,
54+
},
55+
56+
// Options to be passed to Jasmine-node
57+
jasmineNodeOpts: {
58+
showColors: true, // Use colors in the command line report.
59+
defaultTimeoutInterval: 200000, // set timeout for async calls
60+
},
61+
62+
baseUrl: 'http://localhost:9085',
63+
framework: 'jasmine',
64+
65+
onPrepare: function() {
66+
browser.ignoreSynchronization = true;
67+
browser.driver.manage().window().maximize();
68+
69+
// Add a screenshot reporter and store screenshots to `/tmp/screenshots`:
70+
jasmine.getEnv().addReporter(new HtmlReporter({
71+
baseDirectory: 'tmp/screenshots'
72+
}).getJasmine2Reporter());
73+
}
74+
};

protractor.conf.js

-11
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// (c) Copyright 2017-2018 SUSE LLC
2+
/**
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
**/
15+
var commonObjects = function() {
16+
17+
this.username = element(by.css('input[type="text"]'));
18+
this.password = element(by.css('input[type="password"]'));
19+
this.login = element(by.css('button[type="submit"]'));
20+
this.logout = element(by.css('i.logout-btn'));
21+
this.nextButton = element(by.xpath('.//Button[.="Next"]'));
22+
this.backButton = element(by.xpath('.//Button[.="Back"]'));
23+
24+
this.stateLineWrapperContainer = element(by.css('.wizard-progress-container'));
25+
this.firstIndicator = this.stateLineWrapperContainer.all(by.css('.progress')).first();
26+
this.lastIndicator = this.stateLineWrapperContainer.all(by.css('.progress')).last();
27+
28+
29+
this.headerTitle = element(by.css('aside > header'));
30+
//this.spinner = $('.spinners-container');
31+
//this.loading = $('.spinners-container details-modal-mask');
32+
this.spinner = element(by.css('span[class^="spinners"]'));
33+
this.loading = element(by.css('.spinners-container'));
34+
this.errorModal = $('Error');
35+
36+
this.toggle = $('.btn-toggle');
37+
this.adminConsoleSideBar = $('.main-menu');
38+
this.detailsContainer = $('.details-container');
39+
this.footerContainer = $('.btn-row.footer-container');
40+
this.buttonsAll = $$('.btn-row.footer-container');
41+
42+
this.pickerContainerElements = function() {
43+
$$('.picker-container').each(function(element, index) {
44+
// Will print 0 First, 1 Second, 2 Third.
45+
element.getText().then(function (text) {
46+
console.log(text);
47+
});
48+
});
49+
};
50+
51+
//Services page common web elements
52+
this.information = element(by.xpath('//a[text()= "Information"]'));
53+
this.openStackPackages = element(by.xpath('//a[text()= "OpenStack Packages"]'));
54+
this.suseOpenStackCloudPackages = element(by.xpath('//a[text()= "SUSE OpenStack Cloud Packages"]'));
55+
this.configuration = element(by.xpath('//a[text()= "Configuration"]'));
56+
this.roles = element(by.xpath('//a[text()= "Roles"]'));
57+
58+
//Service Information details
59+
this.ardana = element(by.xpath('//*[@id="root"]/div/section/section[2]/div/table/tbody/tr[1]/td[1]'));
60+
61+
};
62+
63+
module.exports = commonObjects;

test/e2e/specs/sanitycheck.spec.js test/e2e/suites/day0/sanitycheck.spec.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
describe('basic sanity tests', function() {
1717

1818
beforeAll(function() {
19-
browser.get('localhost:2209?installreset=true');
19+
browser.get('http://localhost:2209/?installreset=true#/');
2020
browser.sleep(1000);
2121
});
2222

@@ -28,7 +28,7 @@ describe('basic sanity tests', function() {
2828
var stateLineWrapperContainer = element(by.css('.wizard-progress-container'));
2929
var firstIndicator = stateLineWrapperContainer.all(by.css('.progress')).first();
3030

31-
expect(firstIndicator.getCssValue('background-color')).toEqual('rgba(0, 192, 129, 1)');//the rgba value of #00C081
31+
expect(firstIndicator.getCssValue('background-color')).toContain('0, 192, 129');//the rgba value of #00C081
3232
});
3333

3434
it('advances to the next page and updates the indicator', function() {
@@ -37,13 +37,13 @@ describe('basic sanity tests', function() {
3737
var lastIndicator = stateLineWrapperContainer.all(by.css('.progress')).last();
3838

3939
//the first indicator is the correct "in-progress" color
40-
expect(firstIndicator.getCssValue('background-color')).toEqual('rgba(0, 192, 129, 1)');//the rgba value of #00C081
40+
expect(firstIndicator.getCssValue('background-color')).toContain('0, 192, 129');//the rgba value of #00C081
4141

4242
var nextButton = element(by.xpath('.//Button[.="Next"]'));
4343
nextButton.click();
4444
//the first indicator has updated to the "complete" color
45-
expect(firstIndicator.getCssValue('background-color')).toEqual('rgba(0, 192, 129, 1)');//the rgba value of #00C081
45+
expect(firstIndicator.getCssValue('background-color')).toContain('0, 192, 129');//the rgba value of #00C081
4646
//the last indicator has a "notdone" color
47-
expect(lastIndicator.getCssValue('background-color')).toEqual('rgba(106, 114, 118, 1)');//the rgba value of #6a7276
47+
expect(lastIndicator.getCssValue('background-color')).toContain('106, 114, 118');//the rgba value of #6a7276
4848
});
4949
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// (c) Copyright 2017-2018 SUSE LLC
2+
/**
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
**/
15+
var CommonObjects = require('../../common/common.pageObject.js');
16+
17+
var AdminConsoleServices = function() {
18+
var commonObjects = new CommonObjects();
19+
20+
//services side menu item
21+
var services = element(by.xpath('//a[text()= "Services"]'));
22+
23+
//various tabs on services page
24+
this.information = element(by.xpath('//a[text()= "Information"]'));
25+
this.openStackPackages = element(by.xpath('//a[text()= "OpenStack Packages"]'));
26+
this.suseOpenStackCloudPackages = element(by.xpath('//a[text()= "SUSE OpenStack Cloud Packages"]'));
27+
this.configuration = element(by.xpath('//a[text()= "Configuration"]'));
28+
this.roles = element(by.xpath('//a[text()= "Roles"]'));
29+
30+
//details from Service Information
31+
//var moreDetails = use $$ for tbody tr .material-icons
32+
var contextMenu = element(by.css('.context-menu-container .menu-item'));
33+
34+
this.getAllSideBarMenuItems = function() {
35+
var allSideBarMenuItems = element.all(commonObjects.adminConsoleSideBar).count();
36+
console.log(allSideBarMenuItems);
37+
//return this.allSideBarMenuItems;
38+
};
39+
40+
this.getColor = function(){
41+
return this.firstIndicator.getCssValue('background-color');
42+
};
43+
44+
};
45+
46+
module.exports = AdminConsoleServices;

0 commit comments

Comments
 (0)