Skip to content

Commit

Permalink
Tests/eui 1002 test coverage (#357)
Browse files Browse the repository at this point in the history
* Refactor and fix existing functional tests

* New browser to handle user registration email on mailinator domain

* Functional tests invite user and validate after successful registration

* End to end scenarios added

* common run config to separet file

* Fixed config import/require

* minor fix to use chai-promised

* Fixed minor issues. added jenkins nightly file for nightly functional test build.

* Fixed step definition mapping issue.

* Include invite suer scenario to functional test group

* config update

* added retry page load on blank or service error.

* Applied fixes to make tests robust

* locator fix

* Added scenario to validate MC login for invited user

* Fixes to improve robustness of tests.

* merge conflict fixes

* Added retry actions to handle scenario robustness

* Ret login added to get to login page

* fix missing async keyword for function

* Fixes to screenshot util and Invite user retries

* Fixed world param reference in step definition

* Replaced page refresh with get url to overcome service error page.

* Fixed by adding  async function

* Disabled flakey tests on pipeline

* Fix to wait for spinner to disappear

* Handing spinner to improve test stability.

* fix to use screenshot util in  step def.
  • Loading branch information
sreekanthpuligadda authored and Vamshi-Muniganti committed Jan 24, 2020
1 parent 30ed82e commit 9c021dc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
7 changes: 7 additions & 0 deletions test/e2e/features/pageObjects/headerPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class HeaderPage {
}

async clickUser(){
await this.waitForSpinnerNotPresent();
await BrowserWaits.waitForElementNotVisible(this.spinner);
await BrowserWaits.waitForElement(this.user);
await BrowserWaits.waitForElementClickable(this.user);
Expand All @@ -51,13 +52,19 @@ class HeaderPage {
}

async clickOrganisation() {
await this.waitForSpinnerNotPresent();
await BrowserWaits.waitForElementNotVisible(this.spinner);
await BrowserWaits.waitForElement(this.organisation);
await BrowserWaits.waitForElementClickable(this.organisation);
await this.organisation.click();
// browser.sleep(AMAZING_DELAY);
}

async waitForSpinnerNotPresent(){
await BrowserWaits.waitForElementNotVisible(element(by.css('div.spinner-wrapper')), 60000);

}



}
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/features/step_definitions/loginLogout.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const browserWaits = require('../../support/customWaits');
const mailinatorService = require('../pageObjects/mailinatorService');
const manageCasesService = require('../pageObjects/manageCasesService');


const HeaderPage = require('../pageObjects/headerPage');
const headerPage = new HeaderPage();

async function waitForElement(el) {
await browser.wait(result => {
Expand Down Expand Up @@ -113,6 +114,7 @@ defineSupportCode(function ({ Given, When, Then }) {
browser.sleep(SHORT_DELAY);
await expect(loginPage.signOutlink.isDisplayed()).to.eventually.be.true;
browser.sleep(SHORT_DELAY);
await headerPage.waitForSpinnerNotPresent();
await loginPage.signOutlink.click();
browser.sleep(SHORT_DELAY);
});
Expand Down
7 changes: 5 additions & 2 deletions test/e2e/features/step_definitions/viewOrganisation.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const loginPage = require('../pageObjects/loginLogoutObjects');
const { AMAZING_DELAY, SHORT_DELAY, MID_DELAY, LONG_DELAY } = require('../../support/constants');
const EC = protractor.ExpectedConditions;
const browserWaits = require('../../support/customWaits');
const { config } = require('../../config/common.conf.js');

var {defineSupportCode} = require('cucumber');

Expand All @@ -20,8 +21,10 @@ defineSupportCode(function ({And, But, Given, Then, When}) {
.then(stream => {
const decodedImage = new Buffer(stream.replace(/^data:image\/(png|gif|jpeg);base64,/, ''), 'base64');
world.attach(decodedImage, 'image/png');
})
await headerPage.clickOrganisation();
});
await browser.get(config.config.baseUrl + '/organisation');

// await headerPage.clickOrganisation();
});
});

Expand Down
5 changes: 4 additions & 1 deletion test/e2e/features/step_definitions/viewUser.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const loginPage = require('../pageObjects/loginLogoutObjects');

const { AMAZING_DELAY, SHORT_DELAY, MID_DELAY, LONG_DELAY } = require('../../support/constants');
const EC = protractor.ExpectedConditions;
const { config } = require('../../config/common.conf.js');

var {defineSupportCode} = require('cucumber');
const browserWaits = require('../../support/customWaits');
Expand All @@ -27,8 +28,10 @@ defineSupportCode(function ({And, But, Given, Then, When}) {
const decodedImage = new Buffer(stream.replace(/^data:image\/(png|gif|jpeg);base64,/, ''), 'base64');
world.attach(decodedImage, 'image/png');
})
await headerPage.clickUser();
await browser.get(config.config.baseUrl+'/users');
// await headerPage.clickUser();
});

await viewUserPage.amOnPage();

// browser.sleep(AMAZING_DELAY);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/support/customWaits.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class BrowserWaits {
await browser.wait(EC.visibilityOf(waitelement), this.waitTime, "Error : " + waitelement.locator().toString());
}

async waitForElementNotVisible(element) {
await browser.wait(EC.not(EC.presenceOf(element), this.waitTime, "Error : " + element.locator().toString()));
async waitForElementNotVisible(element,customWait) {
await browser.wait(EC.not(EC.presenceOf(element), customWait ? customWait : this.waitTime, "Error : " + element.locator().toString()));
}

async waitForPresenceOfElement(element) {
Expand Down

0 comments on commit 9c021dc

Please sign in to comment.