Project

General

Profile

Feature #33682 » 0002-Fix-functional-tests.patch

Takashi Kato, 2023-08-03 00:46

View differences:

test/functional/calendars_controller_test.rb
65 65
    # Assert context menu on issues
66 66
    assert_select 'form[data-cm-url=?]', '/issues/context_menu'
67 67

  
68
    assert_select 'table.cal' do
69
      assert_select 'tr' do
70
        assert_select 'td' do
71
          assert_select(
72
            'div.issue.hascontextmenu.tooltip.starting',
73
            :text => /Add ingredients categories/
74
          ) do
75
            assert_select 'a.issue[href=?]', '/issues/2', :text => 'Feature request #2'
76
            assert_select 'span.tip' do
77
              assert_select 'img[class="gravatar"]'
78
            end
79
            assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '2'
68
    assert_select 'ul.cal' do
69
      assert_select 'li' do
70
        assert_select(
71
          'div.issue.hascontextmenu.tooltip.starting',
72
          :text => /Add ingredients categories/
73
        ) do
74
          assert_select 'a.issue[href=?]', '/issues/2', :text => 'Feature request #2'
75
          assert_select 'span.tip' do
76
            assert_select 'img[class="gravatar"]'
80 77
          end
78
          assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '2'
81 79
        end
82 80
      end
83 81
    end
......
89 87
    get(:show, :params => {:project_id => 1})
90 88
    assert_response :success
91 89

  
92
    assert_select 'table.cal' do
93
      assert_select 'tr' do
94
        assert_select 'td' do
95
          assert_select(
96
            'div.issue.hascontextmenu.tooltip.ending',
97
            :text => /Cannot print recipes/
98
          ) do
99
            assert_select 'a.issue[href=?]', '/issues/1', :text => 'Bug #1'
100
            assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '1'
101
          end
90
    assert_select 'ul.cal' do
91
      assert_select 'li' do
92
        assert_select(
93
          'div.issue.hascontextmenu.tooltip.ending',
94
          :text => /Cannot print recipes/
95
        ) do
96
          assert_select 'a.issue[href=?]', '/issues/1', :text => 'Bug #1'
97
          assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '1'
102 98
        end
103 99
      end
104 100
    end
......
120 116
    )
121 117
    assert_response :success
122 118

  
123
    assert_select 'table.cal' do
124
      assert_select 'tr' do
125
        assert_select 'td' do
119
    assert_select 'ul.cal' do
120
      assert_select 'li' do
121
        assert_select(
122
          'div.issue.hascontextmenu.tooltip.starting.ending',
123
          :text => /#{subject}/
124
        ) do
126 125
          assert_select(
127
            'div.issue.hascontextmenu.tooltip.starting.ending',
128
            :text => /#{subject}/
129
          ) do
130
            assert_select(
131
              'a.issue[href=?]', "/issues/#{issue.id}",
132
              :text => "Bug ##{issue.id}"
133
            )
134
            assert_select(
135
              'input[name=?][type=?][value=?]',
136
              'ids[]',
137
              'checkbox',
138
              issue.id.to_s
139
            )
140
          end
126
            'a.issue[href=?]', "/issues/#{issue.id}",
127
            :text => "Bug ##{issue.id}"
128
          )
129
          assert_select(
130
            'input[name=?][type=?][value=?]',
131
            'ids[]',
132
            'checkbox',
133
            issue.id.to_s
134
          )
141 135
        end
142 136
      end
143 137
    end
......
149 143
    get(:show, :params => {:project_id => 1})
150 144
    assert_response :success
151 145

  
152
    assert_select 'table.cal' do
153
      assert_select 'tr' do
154
        assert_select 'td' do
155
          assert_select(
156
            'span.icon.icon-package'
157
          ) do
158
            assert_select 'a[href=?]', '/versions/2', :text => '1.0'
159
          end
146
    assert_select 'ul.cal' do
147
      assert_select 'li' do
148
        assert_select(
149
          'span.icon.icon-package'
150
        ) do
151
          assert_select 'a[href=?]', '/versions/2', :text => '1.0'
160 152
        end
161 153
      end
162 154
    end
......
179 171
    get :show
180 172
    assert_response :success
181 173

  
182
    assert_select 'table.cal' do
183
      assert_select 'tr' do
184
        assert_select 'td' do
185
          assert_select(
186
            'div.issue.hascontextmenu.tooltip.starting',
187
            :text => /eCookbook.*Add ingredients categories/m
188
          ) do
189
            assert_select 'a.issue[href=?]', '/issues/2', :text => 'Feature request #2'
190
            assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '2'
191
          end
174
    assert_select 'ul.cal' do
175
      assert_select 'li' do
176
        assert_select(
177
          'div.issue.hascontextmenu.tooltip.starting',
178
          :text => /eCookbook.*Add ingredients categories/m
179
        ) do
180
          assert_select 'a.issue[href=?]', '/issues/2', :text => 'Feature request #2'
181
          assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '2'
192 182
        end
193 183
      end
194 184
    end
......
200 190
    get :show
201 191
    assert_response :success
202 192

  
203
    assert_select 'table.cal' do
204
      assert_select 'tr' do
205
        assert_select 'td' do
193
    assert_select 'ul.cal' do
194
      assert_select 'li' do
195
        assert_select(
196
          'span.icon.icon-package'
197
        ) do
206 198
          assert_select(
207
            'span.icon.icon-package'
208
          ) do
209
            assert_select(
210
              'a[href=?]', '/versions/2',
211
              :text => 'eCookbook - 1.0'
212
            )
213
          end
199
            'a[href=?]', '/versions/2',
200
            :text => 'eCookbook - 1.0'
201
          )
214 202
        end
215 203
      end
216 204
    end
......
228 216
      assert_response :success
229 217
    end
230 218

  
231
    assert_select 'tr' do
232
      assert_select 'td.week-number', :text => '53'
233
      assert_select 'td.odd', :text => '27'
234
      assert_select 'td.even', :text => '2'
219
    assert_select 'ul' do
220
      assert_select 'li.week-number:nth-of-type(2)', :text => /^53/
221
      assert_select 'li.odd', :text => /^27/
222
      assert_select 'li.even', :text => /^2/
235 223
    end
236 224

  
237
    assert_select 'tr' do
238
      assert_select 'td.week-number', :text => '1'
239
      assert_select 'td.odd', :text => '3'
240
      assert_select 'td.even', :text => '9'
225
    assert_select 'ul' do
226
      assert_select 'li.week-number', :text => /^1/
227
      assert_select 'li.odd', :text => /^3/
228
      assert_select 'li.even', :text => /^9/
241 229
    end
242 230

  
243 231
    with_settings :start_of_week => 1 do
......
251 239
      assert_response :success
252 240
    end
253 241

  
254
    assert_select 'tr' do
255
      assert_select 'td.week-number', :text => '53'
256
      assert_select 'td.even', :text => '28'
257
      assert_select 'td.even', :text => '3'
242
    assert_select 'ul' do
243
      assert_select 'li.week-number:nth-of-type(2)', :text => /^53/
244
      assert_select 'li.even', :text => /^28/
245
      assert_select 'li.even', :text => /^3/
258 246
    end
259 247

  
260
    assert_select 'tr' do
261
      assert_select 'td.week-number', :text => '1'
262
      assert_select 'td.even', :text => '4'
263
      assert_select 'td.even', :text => '10'
248
    assert_select 'ul' do
249
      assert_select 'li.week-number', :text => /^1/
250
      assert_select 'li.even', :text => /^4/
251
      assert_select 'li.even', :text => /^10/
264 252
    end
265 253
  end
266 254

  
......
296 284
    )
297 285
    assert_response :success
298 286

  
299
    assert_select 'tr:nth-child(2)' do
300
      assert_select 'td.week-number', :text => '49'
287
    assert_select 'ul' do
288
      assert_select 'li.week-number:nth-of-type(2)', :text => /^48/
301 289
      # non working days should have "nwday" CSS class
302
      assert_select 'td.nwday', 2
303
      assert_select 'td.nwday', :text => '4'
304
      assert_select 'td.nwday', :text => '10'
290
      assert_select 'li.nwday', 10
291
      assert_select 'li.nwday', :text => /^4/
292
      assert_select 'li.nwday', :text => /^10/
305 293
    end
306 294
  end
307 295
end
test/functional/my_controller_test.rb
444 444

  
445 445
    assert_select 'form[data-cm-url=?]', '/issues/context_menu'
446 446

  
447
    assert_select 'table.cal' do
448
      assert_select 'tr' do
449
        assert_select 'td' do
447
    assert_select 'ul.cal' do
448
      assert_select 'li' do
449
        assert_select(
450
          'div.issue.hascontextmenu.tooltip.starting.ending',
451
          :text => /eCookbook.*#{subject}/m
452
        ) do
453
          assert_select(
454
            'a.issue[href=?]', "/issues/#{issue.id}",
455
            :text => "Bug ##{issue.id}"
456
          )
450 457
          assert_select(
451
            'div.issue.hascontextmenu.tooltip.starting.ending',
452
            :text => /eCookbook.*#{subject}/m
453
          ) do
454
            assert_select(
455
              'a.issue[href=?]', "/issues/#{issue.id}",
456
              :text => "Bug ##{issue.id}"
457
            )
458
            assert_select(
459
              'input[name=?][type=?][value=?]',
460
              'ids[]',
461
              'checkbox',
462
              issue.id.to_s
463
            )
464
          end
458
            'input[name=?][type=?][value=?]',
459
            'ids[]',
460
            'checkbox',
461
            issue.id.to_s
462
          )
465 463
        end
466 464
      end
467 465
    end
(4-4/4)