Project

General

Profile

Patch #25775 » 25775-ui-test.patch

Akiko Takano, 2017-05-08 13:52

View differences:

/dev/null Thu Jan 01 00:00:00 1970 +0000 → test/ui/avatar_test_ur.rb Mon May 08 20:48:10 2017 +0900
1
require File.expand_path('../base', __FILE__)
2

  
3
module Redmine
4
  module UiTest
5
    class AvatarTest < Redmine::UiTest::Base
6
      fixtures :projects, :users, :email_addresses, :roles, :members,
7
               :member_roles, :trackers, :projects_trackers, :enabled_modules,
8
               :issue_statuses, :issues, :enumerations
9

  
10
      def test_create_issue_with_assignee_when_disable_gravatar
11
        with_settings gravatar_enabled: '0' do
12
          login_and_create do
13
            assert page.has_no_css? 'img'
14
          end
15
        end
16
      end
17

  
18
      def test_create_issue_with_assignee_when_enable_gravatar
19
        with_settings gravatar_enabled: '1' do
20
          login_and_create do
21
            assert page.has_css? 'img', 2
22
            assert page.has_css? 'img.gravatar', 1
23
          end
24
        end
25
      end
26

  
27
      private
28

  
29
      def login_and_create
30
        log_user('jsmith', 'jsmith')
31
        visit '/projects/ecookbook/issues/new'
32
        within('form#issue-form') do
33
          fill_in 'Subject', with: 'Issue with Assignee except author'
34

  
35
          select 'Dave Lopper', from: 'issue_assigned_to_id'
36
          find('input[name=commit]').click
37
        end
38
        assert page.has_css?('div.gravatar-with-child') do
39
          yield
40
        end
41
      end
42
    end
43
  end
44
end
(5-5/5)