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
# Assert context menu on issues
assert_select 'form[data-cm-url=?]', '/issues/context_menu'
assert_select 'table.cal' do
assert_select 'tr' do
assert_select 'td' do
assert_select(
'div.issue.hascontextmenu.tooltip.starting',
:text => /Add ingredients categories/
) do
assert_select 'a.issue[href=?]', '/issues/2', :text => 'Feature request #2'
assert_select 'span.tip' do
assert_select 'img[class="gravatar"]'
end
assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '2'
assert_select 'ul.cal' do
assert_select 'li' do
assert_select(
'div.issue.hascontextmenu.tooltip.starting',
:text => /Add ingredients categories/
) do
assert_select 'a.issue[href=?]', '/issues/2', :text => 'Feature request #2'
assert_select 'span.tip' do
assert_select 'img[class="gravatar"]'
end
assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '2'
end
end
end
......
get(:show, :params => {:project_id => 1})
assert_response :success
assert_select 'table.cal' do
assert_select 'tr' do
assert_select 'td' do
assert_select(
'div.issue.hascontextmenu.tooltip.ending',
:text => /Cannot print recipes/
) do
assert_select 'a.issue[href=?]', '/issues/1', :text => 'Bug #1'
assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '1'
end
assert_select 'ul.cal' do
assert_select 'li' do
assert_select(
'div.issue.hascontextmenu.tooltip.ending',
:text => /Cannot print recipes/
) do
assert_select 'a.issue[href=?]', '/issues/1', :text => 'Bug #1'
assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '1'
end
end
end
......
)
assert_response :success
assert_select 'table.cal' do
assert_select 'tr' do
assert_select 'td' do
assert_select 'ul.cal' do
assert_select 'li' do
assert_select(
'div.issue.hascontextmenu.tooltip.starting.ending',
:text => /#{subject}/
) do
assert_select(
'div.issue.hascontextmenu.tooltip.starting.ending',
:text => /#{subject}/
) do
assert_select(
'a.issue[href=?]', "/issues/#{issue.id}",
:text => "Bug ##{issue.id}"
)
assert_select(
'input[name=?][type=?][value=?]',
'ids[]',
'checkbox',
issue.id.to_s
)
end
'a.issue[href=?]', "/issues/#{issue.id}",
:text => "Bug ##{issue.id}"
)
assert_select(
'input[name=?][type=?][value=?]',
'ids[]',
'checkbox',
issue.id.to_s
)
end
end
end
......
get(:show, :params => {:project_id => 1})
assert_response :success
assert_select 'table.cal' do
assert_select 'tr' do
assert_select 'td' do
assert_select(
'span.icon.icon-package'
) do
assert_select 'a[href=?]', '/versions/2', :text => '1.0'
end
assert_select 'ul.cal' do
assert_select 'li' do
assert_select(
'span.icon.icon-package'
) do
assert_select 'a[href=?]', '/versions/2', :text => '1.0'
end
end
end
......
get :show
assert_response :success
assert_select 'table.cal' do
assert_select 'tr' do
assert_select 'td' do
assert_select(
'div.issue.hascontextmenu.tooltip.starting',
:text => /eCookbook.*Add ingredients categories/m
) do
assert_select 'a.issue[href=?]', '/issues/2', :text => 'Feature request #2'
assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '2'
end
assert_select 'ul.cal' do
assert_select 'li' do
assert_select(
'div.issue.hascontextmenu.tooltip.starting',
:text => /eCookbook.*Add ingredients categories/m
) do
assert_select 'a.issue[href=?]', '/issues/2', :text => 'Feature request #2'
assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '2'
end
end
end
......
get :show
assert_response :success
assert_select 'table.cal' do
assert_select 'tr' do
assert_select 'td' do
assert_select 'ul.cal' do
assert_select 'li' do
assert_select(
'span.icon.icon-package'
) do
assert_select(
'span.icon.icon-package'
) do
assert_select(
'a[href=?]', '/versions/2',
:text => 'eCookbook - 1.0'
)
end
'a[href=?]', '/versions/2',
:text => 'eCookbook - 1.0'
)
end
end
end
......
assert_response :success
end
assert_select 'tr' do
assert_select 'td.week-number', :text => '53'
assert_select 'td.odd', :text => '27'
assert_select 'td.even', :text => '2'
assert_select 'ul' do
assert_select 'li.week-number:nth-of-type(2)', :text => /^53/
assert_select 'li.odd', :text => /^27/
assert_select 'li.even', :text => /^2/
end
assert_select 'tr' do
assert_select 'td.week-number', :text => '1'
assert_select 'td.odd', :text => '3'
assert_select 'td.even', :text => '9'
assert_select 'ul' do
assert_select 'li.week-number', :text => /^1/
assert_select 'li.odd', :text => /^3/
assert_select 'li.even', :text => /^9/
end
with_settings :start_of_week => 1 do
......
assert_response :success
end
assert_select 'tr' do
assert_select 'td.week-number', :text => '53'
assert_select 'td.even', :text => '28'
assert_select 'td.even', :text => '3'
assert_select 'ul' do
assert_select 'li.week-number:nth-of-type(2)', :text => /^53/
assert_select 'li.even', :text => /^28/
assert_select 'li.even', :text => /^3/
end
assert_select 'tr' do
assert_select 'td.week-number', :text => '1'
assert_select 'td.even', :text => '4'
assert_select 'td.even', :text => '10'
assert_select 'ul' do
assert_select 'li.week-number', :text => /^1/
assert_select 'li.even', :text => /^4/
assert_select 'li.even', :text => /^10/
end
end
......
)
assert_response :success
assert_select 'tr:nth-child(2)' do
assert_select 'td.week-number', :text => '49'
assert_select 'ul' do
assert_select 'li.week-number:nth-of-type(2)', :text => /^48/
# non working days should have "nwday" CSS class
assert_select 'td.nwday', 2
assert_select 'td.nwday', :text => '4'
assert_select 'td.nwday', :text => '10'
assert_select 'li.nwday', 10
assert_select 'li.nwday', :text => /^4/
assert_select 'li.nwday', :text => /^10/
end
end
end
test/functional/my_controller_test.rb
assert_select 'form[data-cm-url=?]', '/issues/context_menu'
assert_select 'table.cal' do
assert_select 'tr' do
assert_select 'td' do
assert_select 'ul.cal' do
assert_select 'li' do
assert_select(
'div.issue.hascontextmenu.tooltip.starting.ending',
:text => /eCookbook.*#{subject}/m
) do
assert_select(
'a.issue[href=?]', "/issues/#{issue.id}",
:text => "Bug ##{issue.id}"
)
assert_select(
'div.issue.hascontextmenu.tooltip.starting.ending',
:text => /eCookbook.*#{subject}/m
) do
assert_select(
'a.issue[href=?]', "/issues/#{issue.id}",
:text => "Bug ##{issue.id}"
)
assert_select(
'input[name=?][type=?][value=?]',
'ids[]',
'checkbox',
issue.id.to_s
)
end
'input[name=?][type=?][value=?]',
'ids[]',
'checkbox',
issue.id.to_s
)
end
end
end
(4-4/4)