         .click                  sidebarSectionsHeaderSelector
 
 
-  createChannel: (browser, user, channelName, isInvalid, purpose) ->
-
-    channelModalSelector             = '.CreateChannel-Modal .CreateChannel-content'
-    createChannelModalNameSelector   = "#{channelModalSelector} .channelName input"
-    purposeSelector                  = "#{channelModalSelector} .channelPurpose input"
-    createChannelModalButtonSelector = '.CreateChannel-Modal .Modal-buttons .Button--danger'
-    channelName                    or= helpers.getFakeText().split(' ')[0] + Date.now()
-    channelName                      = channelName.substring(0, 19)
-    channelLinkOnSidebarSelector     = "#{sidebarSectionsSelector} a[href='/Channels/#{channelName}']"
-
-    @moveToSidebarHeader(browser, yes)
-
-    browser
-      .waitForElementVisible  '.CreateChannel-Modal', 20000
-      .waitForElementVisible  createChannelModalNameSelector, 20000
-      .setValue               createChannelModalNameSelector, channelName
-
-    if purpose
-      browser
-        .waitForElementVisible  purposeSelector, 20000
-        .setValue               purposeSelector, purpose
-
-    browser
-      .waitForElementVisible  createChannelModalButtonSelector, 20000
-      .moveToElement          createChannelModalButtonSelector, 32, 12
-      .click                  createChannelModalButtonSelector
-
-    if isInvalid
-      browser
-        .waitForElementVisible  '.channelName.invalid', 20000
-        .pause                   2000
-        .waitForElementVisible  '.CreateChannel-Modal', 20000
-    else
-      browser
-        .pause                  3000 # wait for page load
-        .waitForElementVisible  chatItem, 20000
-        .pause                  3000
-        .assert.containsText    chatItem, user.username
-        .waitForElementVisible  sidebarSectionsSelector, 20000
-        .pause                  2000 # wait for side bar channel list
-        .waitForElementVisible  channelLinkOnSidebarSelector, 20000
-        .assert.containsText    sidebarSectionsSelector, channelName
-
-    if purpose
-      browser.assert.containsText '.ChannelThreadPane-purposeWrapper .ChannelThreadPane-purpose', purpose
-
-    return channelName
-
-
-  sendComment: (browser, message, messageType) ->
-
-    chatInputSelector     = '.ChatPaneFooter .ChatInputWidget textarea'
-    imageSelector         = '.EmbedBox-container .EmbedBoxImage'
-    imageTextSelector     = '.Pane-body .ChatList .ChatItem .ChatItem-contentBody:nth-of-type(1)'
-    linkTextSelector      = '.EmbedBoxLinkContent .EmbedBoxLinkContent-description'
-    emojiSelector         = '.ChatList .ChatItem .SimpleChatListItem .ChatListItem-itemBodyContainer .ChatItem-contentBody '
-    blockSelector         = '.Pane-body .ChatList .ChatItem .ChatListItem-itemBodyContainer .ChatItem-contentBody .MessageBody blockquote'
-    emojiSmileySelector   = "#{emojiSelector} .emoji-smiley"
-    emojiThumbsUpSelector = "#{emojiSelector} .emoji-thumbsup"
-    messageWithShortCode  = "console.log('123456789')"
-    textAreaSelector      = '.Pane-body .ChatList'
-
-    browser
-      .waitForElementVisible  chatItem, 20000
-      .waitForElementVisible  chatInputSelector, 20000
-      .setValue               chatInputSelector, message + '\n'
-      .waitForElementVisible  chatItem, 20000
-
-    if not messageType
-      browser
-        .assert.containsText      textAreaSelector, message
-
-    switch messageType
-      when 'messageWithCode'
-        browser
-          .pause                  3000
-          .assert.containsText    "#{textAreaSelector} .ChatItem .SimpleChatListItem", messageWithShortCode
-      when 'messageWithImage'
-        browser
-          .waitForElementVisible  imageSelector, 20000
-          .assert.containsText    imageTextSelector, message
-      when 'messageWithLink'
-        browser
-          .waitForElementVisible  linkTextSelector, 20000
-          .assert.containsText    linkTextSelector, 'The Free Encyclopedia'
-      when 'messageWithEmoji'
-        browser
-          .waitForElementVisible  emojiSmileySelector, 20000
-          .waitForElementVisible  emojiSmileySelector, 20000
-          .pause                  2000
-          .waitForElementVisible  emojiThumbsUpSelector, 20000
-      when 'messageWithBlockquote'
-        browser
-          .pause                  3000
-          .waitForElementVisible  blockSelector, 20000
-          .assert.containsText    blockSelector, 'Message with blockquote'
-
-
-  createChannelsAndCheckList: (browser, user) ->
-
-    channelHeader     = "#{sidebarSectionsSelector} .SidebarSection-header"
-    channelListModal  = '.ChannelList-Modal'
-    activeTabSelector = "#{channelListModal} .ChannelList-tab.active-tab"
-    listItemSelector  = "#{channelListModal} .ChannelListItem"
-    threadsContainer  = "#{channelListModal} .SidebarModalThreads"
-
-    channelName1 = @createChannel(browser, user)
-    channelName2 = @createChannel(browser, user)
-    channelName3 = @createChannel(browser, user)
-
-    browser
-      .waitForElementVisible  sidebarSectionsSelector, 20000
-      .waitForElementVisible  channelHeader, 20000
-      .click                  channelHeader
-      .waitForElementVisible  channelListModal, 20000
-      .waitForElementVisible  activeTabSelector, 20000
-      .assert.containsText    activeTabSelector, 'Your Channels'
-      .waitForElementVisible  listItemSelector, 20000
-      .assert.containsText    threadsContainer, channelName1
-      .assert.containsText    threadsContainer, channelName2
-      .assert.containsText    threadsContainer, channelName3
-
-    return [ channelName1, channelName2, channelName3 ]
-
-
-  leaveChannel: (browser) ->
-
-    channelHeaderPaneSelector = '.ChannelThreadPane-content .ChannelThreadPane-header'
-    buttonSelector            = "#{channelHeaderPaneSelector} .ButtonWithMenuWrapper"
-    channelActionsSelector    = '.ButtonWithMenuItemsList.ChannelThreadPane-menuItems'
-    leaveChannelSelector      = "#{channelActionsSelector} li:nth-child(2)"
-    followChannelBox          = '.ChannelThreadPane-body .FollowChannelBox'
-
-    browser
-      .waitForElementVisible     channelHeaderPaneSelector, 20000
-      .waitForElementVisible     buttonSelector, 20000
-      .click                     buttonSelector
-      .waitForElementVisible     channelActionsSelector, 20000
-      .moveToElement             leaveChannelSelector, 70, 12
-      .waitForElementVisible     leaveChannelSelector, 20000
-      .click                     leaveChannelSelector
-      .waitForElementVisible     followChannelBox, 20000 # Assertion
-      .waitForElementNotVisible  chatInputSelector, 20000 # Assertion
-
-
-  joinChannel: (browser) ->
-
-    followChannelBox    = '.FollowChannelBox'
-    followChannelButton = "#{followChannelBox} .Button-followChannel"
-
-    @leaveChannel(browser)
-
-    browser
-      .waitForElementVisible     followChannelButton, 20000
-      .click                     followChannelButton
-      .waitForElementNotVisible  followChannelButton, 20000
-
-
   inviteUser: (browser, addMoreUser = no) ->
 
     invitationsModalSelector = '.kdmodal-content  .AppModal--admin-tabs .invitations'

      .pause                     5000 # wait for listing
      .waitForElementVisible     emailList, 20000
      .assert.containsText       emailList, userEmail


  likeunlikePost: (browser, likeLikePost = no) ->

    likeContainer       = '.ChatItem .SimpleChatListItem .ChatListItem-itemBodyContainer'
    likeButtonUnpressed = "#{likeContainer} a[class~=ActivityLikeLink]:not(.is-likedByUser)"
    likeButtonPressed   = "#{likeContainer} .ActivityLikeLink.is-likedByUser"
    textSelector        = '.ChatListItem-itemBodyContainer:nth-of-type(1)'

    browser
      .pause                  2000
      .waitForElementVisible  textSelector, 20000
      .moveToElement          textSelector, 10, 10
      .waitForElementVisible  likeButtonUnpressed, 20000
      .click                  likeButtonUnpressed
      .waitForElementVisible  likeButtonPressed, 20000
      .assert.visible         likeButtonPressed

    if likeLikePost
      browser
        .click                    likeButtonPressed
        .waitForElementVisible    likeButtonUnpressed, 20000
        .pause                    3000
        .assert.elementNotPresent likeButtonPressed


  editOrDeletePost: (browser, editPost = no, deletePost = no) ->

    editedmessage       = 'Message after editing'
    textSelector        = '.ChatItem .SimpleChatListItem.ChatItem-contentWrapper .ChatListItem-itemBodyContainer'
    menuButton          = '.SimpleChatListItem.ChatItem-contentWrapper:nth-of-type(1) .ButtonWithMenuWrapper button'
    editButton          = '.ButtonWithMenuItemsList li:nth-child(1)'
    chatInput           = '.editing .ChatItem-updateMessageForm .ChatInputWidget textarea'
    editedText          = '.ChatItem .SimpleChatListItem.edited .ChatListItem-itemBodyContainer .ChatItem-contentBody .MessageBody'
    deleteButton        = '.ButtonWithMenuItemsList li:nth-child(2)'
    confirmDelete       = '.Modal-DeleteItemPrompt .Modal-buttons .Button--danger'
    deletedTextSelector = '.Pane-body .ChatList .ChatItem .SimpleChatListItem .ChatListItem-itemBodyContainer'

    browser
      .waitForElementVisible  textSelector, 20000
      .moveToElement          textSelector, 10, 10
      .waitForElementVisible  menuButton, 20000
      .click                  menuButton

    if editPost
      browser
        .waitForElementVisible  editButton, 20000
        .click                  editButton
        .pause                  3000 # wait for textarea
        .waitForElementVisible  chatInput, 20000
        .clearValue             chatInput
        .setValue               chatInput, editedmessage
        .setValue               chatInput, browser.Keys.ENTER
        .waitForElementVisible  editedText, 20000
        .pause                  2000 # wait for new text
        .assert.containsText    editedText, editedmessage

    if deletePost
      browser
        .waitForElementVisible     deleteButton, 20000
        .click                     deleteButton
        .waitForElementVisible     confirmDelete, 20000
        .click                     confirmDelete
        .pause                     3000 #for the text to be deleted
        .assert.elementNotPresent  deletedTextSelector


  updateChannelPurpose: (browser) ->

    editedPurposeText  = 'edited text on the purpose field'
    menuButtonSelector = '.ChannelThreadPane-content .ChannelThreadPane-header .ButtonWithMenuWrapper button'
    editButtonSelector = '.ButtonWithMenuItemsList.ChannelThreadPane-menuItems li:nth-child(3)'
    inputTextSelector  = '.ThreadHeader.ChannelThreadPane-header .ChannelThreadPane-purposeWrapper.editing input'
    editedTextSelector = '.ChannelThreadPane-purposeWrapper .ChannelThreadPane-purpose'

    browser
      .waitForElementVisible  menuButtonSelector, 20000
      .click                  menuButtonSelector
      .waitForElementVisible  editButtonSelector, 20000
      .click                  editButtonSelector
      .waitForElementVisible  inputTextSelector, 20000
      .clearValue             inputTextSelector
      .setValue               inputTextSelector, editedPurposeText + browser.Keys.ENTER
      .pause                  3000 #waiting for the text to change
      .waitForElementVisible  editedTextSelector, 20000
      .assert.containsText    editedTextSelector, editedPurposeText


  createPrivateChat: (browser) ->

    emptyInviteMembersInputText = '.CreateChannel-Modal .CreateChannel-content .channelName input'
    createChatButton            = '.CreateChannel-Modal .Modal-buttons button:first-child'
    markedAsInvalidInputText    = '.CreateChannel-content .channelName.invalid'

    @moveToSidebarHeader(browser, yes)

    browser
      .waitForElementVisible  emptyInviteMembersInputText, 20000
      .waitForElementVisible  createChatButton, 20000
      .click                  createChatButton
      .waitForElementVisible  markedAsInvalidInputText, 20000


      .waitForElementVisible  '.TeamsModal--domain', 20000
      .waitForElementVisible  'input[name=slug]', 20000
      .click                  'button[testpath=domain-button]'
      .pause                  2000 # wait for modal change


