require File.expand_path(File.dirname(__FILE__) + '/common')

describe 'Global Navigation' do
  include_examples 'in-process server selenium tests'

  context 'As a Teacher' do
    before do
      course_with_teacher_logged_in
      Account.default.enable_feature! :use_new_styles
    end

    describe 'Courses Link' do
      it 'should show the courses tray upon clicking' do
        pending 'https://gerrit.instructure.com/#/c/56046/9 needs merging first'
        get "/"
        f('#global_nav_courses_link').click
        wait_for_ajaximations
        expect(f('.ReactTray__primary-content')).to be_displayed
      end
    end

    describe 'LTI Tools' do
      it 'should show the Commons logo/link if it is enabled' do
        Account.default.enable_feature! :lor_for_account
        @teacher.enable_feature! :lor_for_user
        @tool = Account.default.context_external_tools.new({
          :name => "Commons",
          :domain => "canvaslms.com",
          :consumer_key => '12345',
          :shared_secret => 'secret'
        })
        @tool.set_extension_setting(:global_navigation, {
          :url => "canvaslms.com",
          :visibility => "admins",
          :display_type => "full_width",
          :text => "Commons"
        })
        @tool.save!
        get "/"
        expect(f('.ic-icon-svg--commons')).to be_displayed
      end
    end
  end
end
require File.expand_path(File.dirname(__FILE__) + '/common')

describe 'Global Navigation' do
  include_examples 'in-process server selenium tests'

  context 'As a Teacher' do
    before do
      course_with_teacher_logged_in
      Account.default.enable_feature! :use_new_styles
    end

    describe 'Courses Link' do
      it 'should show the courses tray upon clicking' do
        get "/"
        f('#global_nav_courses_link').click
        wait_for_ajaximations
        expect(f('.ReactTray__primary-content')).to be_displayed
      end
    end

    describe 'LTI Tools' do
      it 'should show the Commons logo/link if it is enabled' do
        Account.default.enable_feature! :lor_for_account
        @teacher.enable_feature! :lor_for_user
        @tool = Account.default.context_external_tools.new({
          :name => "Commons",
          :domain => "canvaslms.com",
          :consumer_key => '12345',
          :shared_secret => 'secret'
        })
        @tool.set_extension_setting(:global_navigation, {
          :url => "canvaslms.com",
          :visibility => "admins",
          :display_type => "full_width",
          :text => "Commons"
        })
        @tool.save!
        get "/"
        expect(f('.ic-icon-svg--commons')).to be_displayed
      end
    end
  end
end
Revert "Marks 'should show the courses tray upon clicking' as pending"
Revert "Marks 'should show the courses tray upon clicking' as pending"

This reverts commit ded4c74f6b8297cacf0fb89e8c24f98472a8349c.

Change-Id: Id04f99d2e1d31fe93ba370e4433a268acaa562a3
Reviewed-on: https://gerrit.instructure.com/56843
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <b3f594e10a9edcf5413cf1190121d45078c62290@instructure.com>
Product-Review: Clay Diffrient <9dff2e5c98626d20d2848250c411e8009465bb87@instructure.com>
QA-Review: Clay Diffrient <9dff2e5c98626d20d2848250c411e8009465bb87@instructure.com>
