Skip to content

Commit

Permalink
Merge pull request #515 from f-higashi/fix-test-fileupload
Browse files Browse the repository at this point in the history
Fix test of fileupload
  • Loading branch information
bryk committed Mar 18, 2016
2 parents 77d2809 + 4087dbe commit 6937a5a
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cache:
# Use Node.js as primary language because Gulp is the build system used in the project.
language: node_js
node_js:
- 4.2.2
- 5.1.1

addons:
# Run tests that require a browser on SauceLabs CI provider. Learn more at: https://saucelabs.com
Expand Down
4 changes: 2 additions & 2 deletions docs/devel/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ logic and fetches raw data from the various Kubernetes APIs.
Make sure the following software is installed and added to the `$PATH` variable:
* Docker (1.3+)
* go (1.5+)
* nodejs (4.2.2+)
* npm (1.3+)
* nodejs (5.1.1+)
* npm (3+)
* java (7+)
* gulp (3.9+)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ <h4 class="md-title">Delete Replication Controller</h4>
</md-icon>
</md-checkbox>
<md-dialog-actions>
<md-button class="md-primary" ng-click="ctrl.cancel()">Cancel</md-button>
<md-button class="md-primary" ng-click="ctrl.remove()">Delete</md-button>
<md-button class="md-primary kd-cancel-btn" ng-click="ctrl.cancel()">Cancel</md-button>
<md-button class="md-primary kd-delete-btn" ng-click="ctrl.remove()">Delete</md-button>
</md-dialog-actions>
</md-dialog-content>
</md-dialog>
22 changes: 21 additions & 1 deletion src/test/integration/deploy/deployfromfile_po.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,29 @@ export default class DeployFromFilePageObject {
this.inputContainer = element(this.inputContainerQuery);

this.filePickerQuery = by.css('.kd-upload-file-picker');
this.filePicker = element(this.filePickerQuery);
this.filePicker_ = element(this.filePickerQuery);

this.mdDialogQuery = by.tagName('md-dialog');
this.mdDialog = element(this.mdDialogQuery);
}

/**
* Make filePicker input field visible
* Firefox does not allow sendKeys to invisible input[type=file] element
*/
makeInputVisible() {
browser.driver.executeScript(function() {
/* global document */
let filePickerDomElement = document.getElementsByClassName('kd-upload-file-picker')[0];
filePickerDomElement.style.visibility = 'visible';
filePickerDomElement.style.height = '1px';
filePickerDomElement.style.width = '1px';
});
}

/**
* Sets filepath on the filePicker input field
* @param {string} filePath
*/
setFile(filePath) { this.filePicker_.sendKeys(filePath); }
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@

export default class DeleteReplicationControllerDialogObject {
constructor() {
let deleteDialogXPath = '//md-dialog[@aria-label=\'Delete Replication Controller\']';
this.deleteDialogQuery = by.xpath(deleteDialogXPath);
this.deleteDialog = element(this.deleteDialogQuery);

this.deleteAppButtonQuery =
by.xpath(`${deleteDialogXPath}//md-dialog-actions//span[text() = 'Delete']/..`);
this.deleteAppButtonQuery = by.css('.kd-delete-btn');
this.deleteAppButton = element(this.deleteAppButtonQuery);

this.deleteServicesCheckboxQuery = by.xpath(`${deleteDialogXPath}//md-checkbox`);
this.deleteServicesCheckboxQuery = by.css('.kd-deletedialog-services-checkbox');
this.deleteServicesCheckbox = element(this.deleteServicesCheckboxQuery);
}
}
8 changes: 5 additions & 3 deletions src/test/integration/stories/deploy_from_invalid_file_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
// limitations under the License.

import path from 'path';
import remote from 'selenium-webdriver/remote';

import DeployFromFilePageObject from '../deploy/deployfromfile_po';

// Test assumes, that there are no replication controllers in the cluster at the beginning.
// TODO(#494): Reenable this test when fixed.
xdescribe('Deploy from invalid file user story test', () => {
describe('Deploy from invalid file user story test', () => {

/** @type {!DeployFromFilePageObject} */
let deployFromFilePage;

beforeAll(() => {
browser.driver.setFileDetector(new remote.FileDetector());
deployFromFilePage = new DeployFromFilePageObject();
browser.get('#/deploy');
// switches to deploy from file
Expand All @@ -36,7 +37,8 @@ xdescribe('Deploy from invalid file user story test', () => {
let absolutePath = path.resolve(__dirname, fileToUpload);

// when
deployFromFilePage.filePicker.sendKeys(absolutePath);
deployFromFilePage.makeInputVisible();
deployFromFilePage.setFile(absolutePath);
deployFromFilePage.deployButton.click();

// then
Expand Down
8 changes: 5 additions & 3 deletions src/test/integration/stories/deploy_from_valid_file_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
// limitations under the License.

import path from 'path';
import remote from 'selenium-webdriver/remote';

import DeployFromFilePageObject from '../deploy/deployfromfile_po';
import ReplicationControllersPageObject from '../replicationcontrollerslist/replicationcontrollers_po';
import DeleteReplicationControllerDialogObject from '../replicationcontrollerdetail/deletereplicationcontroller_po';
import ZeroStatePageObject from '../zerostate/zerostate_po';

// Test assumes, that there are no replication controllers in the cluster at the beginning.
// TODO(#494): Reenable this test when fixed.
xdescribe('Deploy from valid file user story test', () => {
describe('Deploy from valid file user story test', () => {

/** @type {!DeployFromFilePageObject} */
let deployFromFilePage;
Expand All @@ -39,6 +39,7 @@ xdescribe('Deploy from valid file user story test', () => {
let appName = 'integration-test-valid-rc';

beforeAll(() => {
browser.driver.setFileDetector(new remote.FileDetector());
deployFromFilePage = new DeployFromFilePageObject();
replicationControllersPage = new ReplicationControllersPageObject();
deleteDialog = new DeleteReplicationControllerDialogObject();
Expand All @@ -54,7 +55,8 @@ xdescribe('Deploy from valid file user story test', () => {
let absolutePath = path.resolve(__dirname, fileToUpload);

// when
deployFromFilePage.filePicker.sendKeys(absolutePath);
deployFromFilePage.makeInputVisible();
deployFromFilePage.setFile(absolutePath);
deployFromFilePage.deployButton.click();

// then
Expand Down

0 comments on commit 6937a5a

Please sign in to comment.