'use strict';

/* https://github.com/angular/protractor/blob/master/docs/toc.md */

describe('chat ui tests', function() {


  it('should automatically redirect to /list when location hash/fragment is empty', function() {
    browser.get('index.html');
    expect(browser.getLocationAbsUrl()).toMatch("/list");
  });

  describe('chat details view', function() {

    beforeEach(function() {
      browser.get('index.html#!/list/0');
      element.all(by.repeater('chatObj in userChats')).get(0).click();
      // browser.sleep(5000);
    });

    it('should render chat details when user clicks on a chat', function() {
      var el = element.all(by.tagName('section-header'));
      el.getAttribute('type').then(function(value) {
        expect(value[0]).toEqual('chatDetail');
      })
    });
  });
});

@@ -507,11 +507,8 @@
     
- //
  bro
@@ -522,9 +522,9 @@
 eep(
-5
+2
 000)
@@ -787,18 +787,748 @@
     %7D);%0A
-
   %7D);
+%0A%0A  describe('chat details send message', function() %7B%0A    var chatLength;%0A    beforeEach(function() %7B%0A      browser.get('index.html#!/list/0');%0A      browser.sleep(2000);%0A      element.all(by.repeater('chatObj in userChats')).get(0).click();%0A      browser.sleep(2000);%0A      element.all(by.repeater('msg in messages')).count().then(function(count) %7B chatLength = count %7D);%0A    %7D);%0A%0A    it('should add a message to the chat', function() %7B%0A      element(by.id('msgEl')).sendKeys('this is a test message');%0A      element(by.css('.send-link')).click();%0A      browser.sleep(2000);%0A      element.all(by.repeater('msg in messages')).count().then(function(newCount) %7B%0A        expect(newCount).toEqual(chatLength+1);%0A      %7D);%0A    %7D)%0A  %7D)
 %0A%7D);%0A

write e2e test for adding a message to an existing chat