"use strict";

describe('Read tokens from xml url', function(){
  var sentence1Url = 'http://services.perseids.org/llt-data/1999.02.0002.2.1.1.xml';
  var sentence2Url = 'http://services.perseids.org/llt-data/1999.02.0002.2.1.2.xml';
  beforeEach(function() {
    browser.get('/app/#/tree');
  });

  describe('Sentence 1', function() {
    beforeEach(function() {
      element(by.model('query')).sendKeys(sentence1Url);
      element(by.buttonText('Search')).click();
    });

    xit('displays a dependency tree (que is above cum)', function() {
      var nodes = element.all(by.css("g.node g text tspan"));
      nodes.map(function(elm, index) {
        return {
          index: index,
          text: elm.getText(),
          location: elm.getLocation()
        };
      }).then(function(nodeInfos) {
        var que;
        var cum;
        for (var index = 0; index < nodeInfos.length; ++index) {
          var element = nodeInfos[index];
          if (element.text === "que") {
            que = element;
          }
          if (element.text === "Cum") {
            cum = element;
          }
        }
        expect(que).toBeDefined();
        expect(cum).toBeDefined();
        expect(que.location.y).toBeGreaterThan(cum.location.y);
      });
    });
  });
});


@@ -22,216 +22,37 @@
 be('
-Read tokens from xml url', function()%7B%0A  var sentence1Url = 'http://services.perseids.org/llt-data/1999.02.0002.2.1.1.xml';%0A  var sentence2Url = 'http://services.perseids.org/llt-data/1999.02.0002.2.1.2.xml';
+Dependency tree', function()%7B
 %0A  b
@@ -98,20 +98,34 @@
 '/app/#/
-tree
+staging2?doc=1&s=1
 ');%0A  %7D)
@@ -197,113 +197,8 @@
 ) %7B%0A
-      element(by.model('query')).sendKeys(sentence1Url);%0A      element(by.buttonText('Search')).click();%0A
     
@@ -206,17 +206,16 @@
 );%0A%0A    
-x
 it('disp
@@ -313,23 +313,17 @@
 ss(%22
-g.node g text t
+div span 
 span

Fix tree spec.