describe('OIDE Filetree', function(){
  //Helper function which returns true if the specified element has the specified class
  var classMatcherHelper = function(element, cls) {
    return element.getAttribute('class').then(function(classes){
      return classes.split(' ').indexOf(cls) !== -1;
    });
  };

  // Run tests for filetree

  it('should open the filetree when a node is clicked', function(){
    // Get the first filetree node
    var fileNode = element.all(by.css('.tree-branch-head')).first();
    // The element should have class fa-folder
    expect(classMatcherHelper(fileNode, 'fa-folder')).toBeTruthy();
    // Simulate click for the element
    fileNode.click();
    // The element should now have class fa-folder-open
    expect(classMatcherHelper(fileNode, 'fa-folder-open')).toBeTruthy();
    // On clicking again, the class should not be set to fa-folder-open
    fileNode.click();
    expect(classMatcherHelper(fileNode, 'fa-folder-open')).toBeFalsy();
  });

  it('should open the rename modal when rename is clicked', function(){
      $('.tree-label').click().then(function(){
        $('.dropdown-toggle').click().then(function(){
          //click on rename
          $$('.fc-dropdown-link').get(4).click()
          //Expect modal to be displayed
          expect($('.modal').isDisplayed()).toBeTruthy();
          // Modal title should be Rename File
          expect($('.modal-title').getInnerHtml()).toBe('Rename File');
          // browser.pause();
        });
      });
  });
});

@@ -31,16 +31,17 @@
 tion()%7B%0A
+%0A
   //Help
@@ -1233,16 +1233,17 @@
 .click()
+;
 %0A       
@@ -1453,16 +1453,16 @@
 File');%0A
-
         
@@ -1479,24 +1479,999 @@
 er.pause();%0A
+          $('.btn-danger').click();%0A        %7D);%0A      %7D);%0A  %7D);%0A%0A  it('should open a file for editing', function()%7B%0A      var fileNode = element.all(by.css('.tree-branch-head')).first();%0A      fileNode.click();%0A      var initialNumberOfFiles = 0;%0A      var newNumberOfFiles = 0;%0A      //Save the initial number of open files%0A      $$('tab-heading %3E span.ng-binding').then(function(elements)%7B%0A        initialNumberOfFiles = elements.length;%0A      %7D);%0A      console.log(initialNumberOfFiles);%0A      //Open a file%0A      $('li.tree-leaf %3E div').click().then(function()%7B%0A        //Click on edit file%0A        $('.filetree-btn').click().then(function()%7B%0A          //Get new number of open files%0A          $$('tab-heading %3E span.ng-binding').then(function(elements)%7B%0A            newNumberOfFiles = elements.length;%0A            //Expect new number of files to be 1 greater than initial number of file%0A            expect(newNumberOfFiles).toBe(initialNumberOfFiles + 1);%0A          %7D);%0A
         %7D);%0A

add spec to test editing a file