From 4ab0aa03188aab30bca409ac3b88624b22255aa3 Mon Sep 17 00:00:00 2001
From: Jaden Diefenbaugh <blakcap@users.noreply.github.com>
Date: Tue, 11 Apr 2017 16:52:44 +0200
Subject: [PATCH] rm deprecated getInnerHtml & fix misc e2e test bugs

---
 .../static/reports/test/report-spec.js        | 23 +++++++++++--------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/beat/web/reports/static/reports/test/report-spec.js b/beat/web/reports/static/reports/test/report-spec.js
index 744037f10..e3dfd675d 100644
--- a/beat/web/reports/static/reports/test/report-spec.js
+++ b/beat/web/reports/static/reports/test/report-spec.js
@@ -387,14 +387,17 @@ describe('reports app', function(){
 
 		// add back the exp to group1
 		afterAll(function(){
-			return addButton.click()
+			const parent = addButton.element(by.xpath('..'));
+
+			parent.getAttribute('class')
+			.then(cls => cls.includes('open') || addButton.click())
 			.then(() => {
 				// make sure list opened correctly & add an exp
-				const parent = addButton.element(by.xpath('..'));
 				const list = parent.element(by.css('ul'));
-				const lis = list.all(by.css('li'));
+				const first = list.element(by.tagName('li'));
+				browser.wait(until.elementToBeClickable(first), 5000, 'First add button isnt becoming clickable')
 
-				return lis.get(0).element(by.css('a')).click();
+				return first.click();
 			});
 		});
 
@@ -415,10 +418,10 @@ describe('reports app', function(){
 				// check state of group after adding exp
 				const analyzer = element(by.css('#group1-explist-heading > h4 > i'));
 				expect(analyzer.isDisplayed()).toBeTruthy();
-				expect(analyzer.getInnerHtml()).not.toBe('');
+				expect(analyzer.getText()).not.toBe('');
 
 				const expsBody = element(by.css('#collapse-group1-explist > .panel-body'));
-				expect(expsBody.getInnerHtml()).not.toBe('');
+				expect(expsBody.getText()).not.toBe('');
 			});
 		});
 
@@ -468,7 +471,7 @@ describe('reports app', function(){
 				it('has a list of formatted dbs & protocols in the third row', function() {
 					const els = cells.get(2).all(by.css('span'));
 					expect(els.count()).toBeGreaterThan(0);
-					expect(els.element(by.css('a')).getText()).toMatch(/\S+@\S+/);
+					expect(els.get(0).element(by.css('a')).getText()).toMatch(/\S+@\S+/);
 				});
 
 				it('has an editable alias input in the fourth row', function() {
@@ -487,12 +490,12 @@ describe('reports app', function(){
 
 		describe('removing 1 experiment', function(){
 			beforeAll(function(){
-				const rmExpButton = element(by.css('#collapse-group1-explist > tbody > .btn-delete'));
+				const rmExpButton = element(by.css('#collapse-group1-explist tbody .btn-delete'));
 				return rmExpButton.click();
 			});
 
 			it('removes the exp table', function(){
-				expect(g1ExpPanel.getInnerHtml()).toBe('');
+				expect(g1ExpPanel.getText()).toBe('');
 			});
 
 			it('removes the analyzer tag', function() {
@@ -502,7 +505,7 @@ describe('reports app', function(){
 			it('lets the user add any experiment again', function() {
 				const expRowsCount = element.all(by.css('#experiment-list-test tbody > tr')).count();
 
-				Promise.all([expRowsCount, addOptionsCount, element(by.css('#group1_exp_add_dropdown')).click()])
+				Promise.all([expRowsCount, element(by.css('#group1_exp_add_dropdown')).click()])
 				.then(([expCount]) =>
 					Promise.all([
 						expCount,
-- 
GitLab