diff --git a/e2e/full/search.e2e.js b/e2e/full/search.e2e.js index 6ff3a2bb..278c505e 100644 --- a/e2e/full/search.e2e.js +++ b/e2e/full/search.e2e.js @@ -14,7 +14,7 @@ describe('search page', function() { }); it('lightbox', async function() { - $('#nav-search').click(); + $('#nav-search a').click(); let searchLb = $('div[tg-search-box]'); @@ -83,6 +83,8 @@ describe('search page', function() { it('change current tab content on typing in the right column', async function() { let text = await $$('.table-main').get(0).$('a').getText(); + let initialCount = await $$('.table-main').count(); + let searchTerm = element(by.model('searchTerm')); searchTerm.clear(); @@ -93,7 +95,8 @@ describe('search page', function() { let count = await $$('.table-main').count(); - expect(count).to.equal(1); + expect(count).to.below(initialCount); + expect(count).to.above(0); }); }); }); diff --git a/e2e/utils/common.js b/e2e/utils/common.js index 3dc8925b..c94ddb7b 100644 --- a/e2e/utils/common.js +++ b/e2e/utils/common.js @@ -4,6 +4,22 @@ var fs = require('fs'); var uuid = require('node-uuid'); var path = require('path'); +common.getElm = function(el) { + var deferred = protractor.promise.defer(); + + if (typeof el === 'string' || el instanceof String) { + browser.wait(function() { + return browser.isElementPresent($(el).locator()); + }, 4000).then(() => { + deferred.fulfill($(el)); + }); + } else { + deferred.fulfill($(el)); + } + + return deferred.promise; +}; + common.hasClass = async function (element, cls) { let classes = await element.getAttribute('class'); diff --git a/e2e/utils/lightbox.js b/e2e/utils/lightbox.js index 07e76234..323c2b6e 100644 --- a/e2e/utils/lightbox.js +++ b/e2e/utils/lightbox.js @@ -6,12 +6,12 @@ var transition = 300; lightbox.open = async function(el) { var deferred = protractor.promise.defer(); - if (typeof el == 'string' || el instanceof String) { + if (typeof el === 'string' || el instanceof String) { el = $(el); } let open = await browser.wait(function() { - return common.hasClass(el, 'open') + return common.hasClass(el, 'open'); }, 4000); await browser.sleep(transition);