Project

General

Profile

Defect #40683 » 0002-Stabilize-inline-autocomplete-system-test.patch

Ko Nagase, 2024-05-12 16:18

View differences:

test/application_system_test_case.rb
105 105
    end
106 106
    files.last
107 107
  end
108

  
109
  def fill_in_with_delay(locator, with:, delay: 0.01)
110
    find(:fillable_field, locator).set('')
111
    if with.is_a?(String) && with.length > 0
112
      with.chars.each do |char|
113
        find(:fillable_field, locator).send_keys(char)
114
        sleep delay
115
      end
116
    end
117
  end
108 118
end
109 119

  
110 120
FileUtils.mkdir_p ApplicationSystemTestCase::DOWNLOADS_PATH
test/system/inline_autocomplete_test.rb
47 47
    log_user('admin', 'admin')
48 48
    visit 'projects/ecookbook/issues/new'
49 49

  
50
    fill_in 'Description', :with => '##12'
50
    fill_in_with_delay 'Description', :with => '##12'
51 51

  
52 52
    within('.tribute-container') do
53 53
      assert page.has_text? 'Bug #12: Closed issue on a locked version'
......
62 62
    log_user('jsmith', 'jsmith')
63 63
    visit 'issues/new'
64 64

  
65
    fill_in 'Description', :with => '#Closed'
65
    fill_in_with_delay 'Description', :with => '#Closed'
66 66

  
67 67
    within('.tribute-container') do
68 68
      assert page.has_text? 'Bug #12: Closed issue on a locked version'
......
150 150
    log_user('jsmith', 'jsmith')
151 151
    visit 'issues/new'
152 152

  
153
    fill_in 'Description', :with => '[['
153
    fill_in_with_delay 'Description', :with => '[['
154 154

  
155 155
    within('.tribute-container') do
156 156
      assert page.has_text? 'Child_1_1'
157 157
      assert page.has_text? 'Page_with_sections'
158 158
    end
159 159

  
160
    fill_in 'Description', :with => '[[page'
160
    fill_in_with_delay 'Description', :with => '[[page'
161 161
    within('.tribute-container') do
162 162
      assert page.has_text? 'Page_with_sections'
163 163
      assert page.has_text? 'Another_page'
......
174 174
    log_user('jsmith', 'jsmith')
175 175
    visit 'projects/1/issues/new'
176 176

  
177
    fill_in 'Description', :with => '#This'
177
    fill_in_with_delay 'Description', :with => '#This'
178 178

  
179 179
    within('.tribute-container') do
180 180
      assert page.has_text? "Bug ##{issue.id}: This issue has a <select> element"
......
186 186
    visit '/issues/1/edit'
187 187

  
188 188
    find('#issue_notes').click
189
    fill_in 'issue[notes]', :with => '@lopper'
189
    fill_in_with_delay 'issue[notes]', :with => '@lopper'
190 190

  
191 191
    within('.tribute-container') do
192 192
      assert page.has_text? "Dave Lopper"
......
195 195
    page.find('#issue_status_id').select('Feedback')
196 196

  
197 197
    find('#issue_notes').click
198
    fill_in 'issue[notes]', :with => '@lopper'
198
    fill_in_with_delay 'issue[notes]', :with => '@lopper'
199 199

  
200 200
    within('.tribute-container') do
201 201
      assert page.has_text? "Dave Lopper"
......
207 207
    visit '/issues/bulk_edit?ids[]=1&ids[]=2'
208 208

  
209 209
    find('#notes').click
210
    fill_in 'notes', :with => '@lopper'
210
    fill_in_with_delay 'notes', :with => '@lopper'
211 211

  
212 212
    within('.tribute-container') do
213 213
      assert page.has_text? 'Dave Lopper'
(1-1/3)