From a6f808ef2ac5a9724cd122b07dce6c40fa90a9c8 Mon Sep 17 00:00:00 2001
From: Jaden Diefenbaugh <blakcap@users.noreply.github.com>
Date: Wed, 12 Apr 2017 17:14:06 +0200
Subject: [PATCH] add most of exps table functionality tests, disabled browser
 nav tests for later

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

diff --git a/beat/web/reports/static/reports/test/report-spec.js b/beat/web/reports/static/reports/test/report-spec.js
index 48f152178..2f4eb924d 100644
--- a/beat/web/reports/static/reports/test/report-spec.js
+++ b/beat/web/reports/static/reports/test/report-spec.js
@@ -786,25 +786,22 @@ describe('reports app', function(){
 	});
 
 	describe('group experiment panel functionality', function() {
-		describe('experiment link', function() {
-			it('links to a valid experiment', function() {
-
-			});
-		});
-
-		describe('database~protocol link', function() {
-			it('links to a valid database~protocol', function() {
-
-			});
-		});
+		const firstRowCells = element(by.css('#collapse-group1-explist tbody > tr')).all(by.css('td'));
 
 		describe('alias field', function() {
-			it('lets you change the alias', function() {
+			const alias = element(by.css('#collapse-group1-explist table > tbody input'));
+			const strToType = 'asdf';
 
+			it('lets you change the alias', function() {
+				alias.sendKeys(strToType)
+				.then(() => expect(alias.getAttribute('value')).toContain(strToType))
+				;
 			});
 
-			it('saves the alias value when focus is moved from the input', function() {
+			it('changed the experiment name in the first row in the table item', function(){
+				const nameEl = element(by.css('#collapse-group1_table_0 td'));
 
+				expect(nameEl.getText()).toContain(strToType);
 			});
 		});
 	});
@@ -838,4 +835,38 @@ describe('reports app', function(){
 			});
 		});
 	});
+
+	// need to save report before doing these
+	describe('links outside the report page', function(){
+		const firstRowCells = element(by.css('#collapse-group1-explist tbody > tr')).all(by.css('td'));
+		describe('experiment link', function() {
+			/*
+			const link = firstRowCells.get(1).element(by.css('a'));
+
+			afterAll(function(){
+				return browser.navigate().back();
+			});
+
+			it('links to a valid experiment', function() {
+				link.click()
+				.then(([expName]) => expect(browser.getTitle()).toBe(`BEAT - ${expName}`))
+			});
+			*/
+		});
+
+		describe('database~protocol link', function() {
+			/*
+			const link = firstRowCells.get(2).element(by.css('a'));
+
+			afterAll(function(){
+				return browser.navigate().back();
+			});
+
+			it('links to a valid database~protocol', function() {
+				Promise.all([link.getText(), link.click()])
+				.then(([dbProtName]) => expect(browser.getTitle()).toBe(`BEAT - ${dbProtName.split('@')[0]}`))
+			});
+			*/
+		});
+	});
 });
-- 
GitLab