Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
Added new test - for new user registering for openshift.io
Browse files Browse the repository at this point in the history
  • Loading branch information
ldimaggi authored and michaelkleinhenz committed Mar 21, 2017
1 parent a945f9d commit 159aee5
Show file tree
Hide file tree
Showing 2 changed files with 171 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/tests/work-item/work-item-list/TBD/openshift-io-poc.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* POC test for automated UI tests for Fabric8
*
* Note on screen resolutions - See: http://www.itunesextractor.com/iphone-ipad-resolution.html
* Tests will be run on these resolutions:
* - iPhone6s - 375x667
* - iPad air - 768x1024
* - Desktop - 1920x1080
*
* beforeEach will set the mode to phone. Any tests requiring a different resolution will must set explicitly.
*
* @author ldimaggi, nverma
*/

let until = protractor.ExpectedConditions;

var OpenShiftIoStartPage = require('../page-objects/openshift-io-start.page'),
testSupport = require('../testSupport'),
constants = require("../constants");

describe('openshift.io End-to-End POC test - Scenario - New user registers', function () {
var page, items, browserMode;
var EMAIL_ADDRESS = "[email protected]";
var VOUCHER_CODE = "bad voucher code";

beforeEach(function () {
testSupport.setBrowserMode('tablet');
// Failed: Error while waiting for Protractor to sync with the page: "window.getAllAngularTestabilities is not a function"
// http://stackoverflow.com/questions/38050626/angular-2-with-protractorjs-failed-error-while-waiting-for-protractor-to-sync-w
browser.ignoreSynchronization = true;
page = new OpenShiftIoStartPage();
});

it('should enable a new user to register', function() {

page.setEmail (EMAIL_ADDRESS);
page.setVoucherCode (VOUCHER_CODE);

page.clickRegisterButton();
expect (page.toastMessage.getText()).toBe("We've placed you on the waitlist! We'll be in touch soon.");

/* Verify that after registration the user is prevented from registering again */
page.clickToastMessageCloseButton();
expect (page.registerButton.isEnabled()).toBe(false);
expect (page.email.isEnabled()).toBe(false);
expect (page.voucherCode.isEnabled()).toBe(false);





});

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/**
* AlMighty page object example module for Fabric8 start page
* See: http://martinfowler.com/bliki/PageObject.html,
* https://www.thoughtworks.com/insights/blog/using-page-objects-overcome-protractors-shortcomings
* @author [email protected]
*/

'use strict';

/*
* openshidt.io Start Page Object Model Definition
*/

let testSupport = require('../testSupport');
let constants = require("../constants");
let until = protractor.ExpectedConditions;

class OpenShiftIoStartPage {

constructor() {
browser.get("http://prod-preview.openshift.io/");
};

/* Navigation panel UI objects */

/* The navigation bar */
get navBar () {
return element(by.css(".navbar-header"));
}
clickNavBar () {
return this.navBar.click();
}

/* OpenShift.io image */
get openShiftIoImage () {
return element(by.css(".navbar-brand>img"));
}
clickOpenShiftIoImage () {
return this.openShiftIoImage.click();
}

/* The navigation bar */
get navBar () {
return element(by.css(".navbar-header"));
}
clickNavBar () {
return this.navBar.click();
}

/* Sign in button in nav bar */
get signIn () {
return element(by.css("#login"));
}
clickSignIn () {
return this.signIn.click();
}

/* UI Element for new users to register */

/* Email address */
get email () {
return element(by.css("#email"));
}
clickEmail () {
return this.email.click();
}
setEmail (emailString) {
return this.email.sendKeys(emailString);
}

/* Access code (voucher code) */
get voucherCode () {
return element(by.css("#vouchercode"));
}
clickVouchercode () {
return this.vouchercode.click();
}
setVoucherCode (vouchercodeString) {
return this.voucherCode.sendKeys(vouchercodeString);
}

/* Register button */
get registerButton () {
return element(by.css("#register"));
}
clickRegisterButton () {
return this.registerButton.click();
}

/* Toaster alert that registration was submitted */

/* Text in toaster alert */
get toastMessage () {
return element(by.css("#toastMessage"));
}

/* The "X" close button for the toaster alert */
get toastMessageCloseButton () {
return element(by.css(".pficon.pficon-close"));
}
clickToastMessageCloseButton () {
browser.wait(until.elementToBeClickable(this.toastMessageCloseButton), constants.WAIT, 'Failed to find toastMessageCloseButton');
return this.toastMessageCloseButton.click();
}

/* The circle "X" close icon for the toaster alert */
get toastMessageCloseIcon () {
return element(by.css(".pficon.pficon-error-circle-o"));
}
clickToastMessageCloseIcon () {
browser.wait(until.elementToBeClickable(this.toastMessageCloseIcon), constants.WAIT, 'Failed to find toastMessageCloseIcon');
return this.toastMessageCloseIcon.click();
}

}

module.exports = OpenShiftIoStartPage;

0 comments on commit 159aee5

Please sign in to comment.