Skip to content

Commit

Permalink
Adapt specs to new format
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-contreras committed May 22, 2024
1 parent 8a49f7a commit da19e6e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion modules/costs/spec/features/time_entries_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
parent_row = wp_table.row(parent)
wp_row = wp_table.row(work_package)

expect(parent_row).to have_css(".inline-edit--container.spentTime", text: "12h 30m")
expect(parent_row).to have_css(".inline-edit--container.spentTime", text: "1d 4h 30m")
expect(wp_row).to have_css(".inline-edit--container.spentTime", text: "2h 30m")
end

Expand Down
6 changes: 3 additions & 3 deletions spec/features/activities/work_package_activity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
it "displays changed attributes in the activity tab", :aggregate_failures do
within("activity-entry", text: admin.name) do
expect(page).to have_list_item(text: "% Complete set to 50%")
expect(page).to have_list_item(text: "Work set to 10h")
expect(page).to have_list_item(text: "Work set to 1d 2h")
expect(page).to have_list_item(text: "Remaining work set to 5h")
expect(page).to have_list_item(text: "Total work set to 20h")
expect(page).to have_list_item(text: "Total remaining work set to 8h")
expect(page).to have_list_item(text: "Total work set to 2d 4h")
expect(page).to have_list_item(text: "Total remaining work set to 1d")
expect(page).to have_list_item(text: "Total % complete set to 60%")
end
end
Expand Down
14 changes: 7 additions & 7 deletions spec/features/work_packages/display_fields/work_display_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@
wp_table.visit_query query

# parent
expect(page).to have_content("5h·Σ 20h")
expect(page).to have_link(20h")
expect(page).to have_content("5h·Σ 2d 4h")
expect(page).to have_link(2d 4h")
# child 2
expect(page).to have_content("3h·Σ 15h")
expect(page).to have_link(15h")
expect(page).to have_content("3h·Σ 1d 7h")
expect(page).to have_link(1d 7h")
end

context "when clicking the link of a top parent" do
Expand All @@ -185,7 +185,7 @@
end

it "shows a work package table with a parent filter to list the direct children" do
click_on(20h")
click_on(2d 4h")

wp_table.expect_work_package_count(4)
wp_table.expect_work_package_listed(parent, child1, child2, child3)
Expand All @@ -202,8 +202,8 @@
end

it "shows also all ancestors in the work package table" do
expect(page).to have_content("Work\n3h·Σ 15h")
click_on(15h")
expect(page).to have_content("Work\n3h·Σ 1d 7h")
click_on(1d 7h")

wp_table.expect_work_package_count(3)
wp_table.expect_work_package_listed(parent, child2, grand_child21)
Expand Down
2 changes: 1 addition & 1 deletion spec/features/work_packages/edit_work_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def visit!
responsible: manager.name,
assignee: manager.name,
combinedDate: "03/04/2013 - 03/20/2013",
estimatedTime: "10h",
estimatedTime: "1d 2h",
remainingTime: "7h",
percentageDone: "30%",
subject: "a new subject",
Expand Down
34 changes: 17 additions & 17 deletions spec/features/work_packages/index_sums_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@
# Expect the total sums row
aggregate_failures do
within(:row, "Total sum") do |row|
expect(row).to have_css(".estimatedTime", text: "1d 1h")
expect(row).to have_css(".remainingTime", text: "12h 30m")
expect(row).to have_css(".estimatedTime", text: "3d 1h")
expect(row).to have_css(".remainingTime", text: "1d 4h 30m")
expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "12")
expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "13.2")
expect(row).to have_css(".laborCosts", text: "15.00 EUR")
Expand All @@ -164,8 +164,8 @@

aggregate_failures do
within(:row, "Total sum") do |row|
expect(row).to have_css(".estimatedTime", text: "1d 11h")
expect(row).to have_css(".remainingTime", text: "19h 30m")
expect(row).to have_css(".estimatedTime", text: "4d 3h")
expect(row).to have_css(".remainingTime", text: "2d 3h 30m")
expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "12")
expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "13.2")
expect(row).to have_css(".laborCosts", text: "15.00 EUR")
Expand All @@ -184,8 +184,8 @@
first_sum_row, second_sum_row = *find_all(:row, "Sum")
# First status row
aggregate_failures do
expect(first_sum_row).to have_css(".estimatedTime", text: "20h")
expect(first_sum_row).to have_css(".remainingTime", text: "12h")
expect(first_sum_row).to have_css(".estimatedTime", text: "2d 4h")
expect(first_sum_row).to have_css(".remainingTime", text: "1d 4h")
expect(first_sum_row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "5")
expect(first_sum_row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "5.5")
expect(first_sum_row).to have_css(".laborCosts", text: "15.00 EUR")
Expand All @@ -195,7 +195,7 @@

# Second status row
aggregate_failures do
expect(second_sum_row).to have_css(".estimatedTime", text: "15h")
expect(second_sum_row).to have_css(".estimatedTime", text: "1d 7h")
expect(second_sum_row).to have_css(".remainingTime", text: "7h 30m")
expect(second_sum_row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "7")
expect(second_sum_row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "7.7")
Expand All @@ -207,8 +207,8 @@
# Total sums row is unchanged
aggregate_failures do
within(:row, "Total sum") do |row|
expect(row).to have_css(".estimatedTime", text: "1d 11h")
expect(row).to have_css(".remainingTime", text: "19h 30m")
expect(row).to have_css(".estimatedTime", text: "4d 3h")
expect(row).to have_css(".remainingTime", text: "2d 3h 30m")
expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "12")
expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "13.2")
expect(row).to have_css(".laborCosts", text: "15.00 EUR")
Expand Down Expand Up @@ -282,8 +282,8 @@
# Expect the total sums row without filtering
aggregate_failures do
within(:row, "Total sum") do |row|
expect(row).to have_css(".estimatedTime", text: "2d 2h")
expect(row).to have_css(".remainingTime", text: "1d 1h")
expect(row).to have_css(".estimatedTime", text: "1w 1d 2h")
expect(row).to have_css(".remainingTime", text: "3d 1h")
expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "24")
expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "26.4")
expect(row).to have_css(".laborCosts", text: "40.00 EUR")
Expand All @@ -303,8 +303,8 @@
# Expect the total sums row to have changed
aggregate_failures do
within(:row, "Total sum") do |row|
expect(row).to have_css(".estimatedTime", text: "1d 6h")
expect(row).to have_css(".remainingTime", text: "15h")
expect(row).to have_css(".estimatedTime", text: "3d 6h")
expect(row).to have_css(".remainingTime", text: "1d 7h")
expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "14")
expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "15.4")
expect(row).to have_css(".laborCosts", text: "", exact_text: true)
Expand All @@ -328,7 +328,7 @@
first_sum_row, second_sum_row = *find_all(:row, "Sum")
# First status row
aggregate_failures do
expect(first_sum_row).to have_css(".estimatedTime", text: "10h")
expect(first_sum_row).to have_css(".estimatedTime", text: "1d 2h")
expect(first_sum_row).to have_css(".remainingTime", text: "5h")
expect(first_sum_row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "5")
expect(first_sum_row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "5.5")
Expand All @@ -339,7 +339,7 @@

# Second status row
aggregate_failures do
expect(second_sum_row).to have_css(".estimatedTime", text: "15h")
expect(second_sum_row).to have_css(".estimatedTime", text: "1d 7h")
expect(second_sum_row).to have_css(".remainingTime", text: "7h 30m")
expect(second_sum_row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "7")
expect(second_sum_row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "7.7")
Expand All @@ -351,8 +351,8 @@
# Total sum
aggregate_failures do
within(:row, "Total sum") do |row|
expect(row).to have_css(".estimatedTime", text: "1d 1h")
expect(row).to have_css(".remainingTime", text: "12h 30m")
expect(row).to have_css(".estimatedTime", text: "3d 1h")
expect(row).to have_css(".remainingTime", text: "1d 4h 30m")
expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "12")
expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "13.2")
expect(row).to have_css(".laborCosts", text: "15.00 EUR")
Expand Down
6 changes: 3 additions & 3 deletions spec/features/work_packages/progress_modal_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def update_work_package_with(work_package, attributes)

work_edit_field.activate!

work_edit_field.expect_modal_field_value("10h")
work_edit_field.expect_modal_field_value("1d 2h")
remaining_work_edit_field.expect_modal_field_value("2h 7m 12s")
percent_complete_edit_field.expect_modal_field_value("78", readonly: true)
end
Expand Down Expand Up @@ -521,7 +521,7 @@ def update_work_package_with(work_package, attributes)
specify "Case 2: when work is set to 12h, " \
"remaining work is automatically set to 6h " \
"and subsequently work is set to 14h, " \
"remaining work updates to 8h" do
"remaining work updates to 1d" do
work_package_table.visit_query(progress_query)
work_package_table.expect_work_package_listed(work_package)

Expand All @@ -537,7 +537,7 @@ def update_work_package_with(work_package, attributes)

work_edit_field.set_value("14")
page.driver.wait_for_network_idle # Wait for live-update to finish
remaining_work_edit_field.expect_modal_field_value("8h")
remaining_work_edit_field.expect_modal_field_value("1d")
end

specify "Case 3: when work is set to 2h, " \
Expand Down
6 changes: 3 additions & 3 deletions spec/features/work_packages/remaining_time_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# need to update work first to enable the remaining work field
wp_page.update_attributes estimatedTime: "200" # rubocop:disable Rails/ActiveRecordAliases
wp_page.update_attributes remainingTime: "125" # rubocop:disable Rails/ActiveRecordAliases
wp_page.expect_attributes remainingTime: "5d 5h"
wp_page.expect_attributes remainingTime: "3w 5h"

work_package.reload
expect(work_package.remaining_hours).to eq 125.0
Expand All @@ -70,8 +70,8 @@
# need to update work first to enable the remaining work field
wp_table_page.update_work_package_attributes work_package, estimatedTime: "200"
wp_table_page.update_work_package_attributes work_package, remainingTime: "125"
wp_table_page.expect_work_package_with_attributes work_package, remainingTime: "5d 5h"
wp_table_page.expect_sums_row_with_attributes remainingTime: "5d 5h"
wp_table_page.expect_work_package_with_attributes work_package, remainingTime: "3w 5h"
wp_table_page.expect_sums_row_with_attributes remainingTime: "3w 5h"

work_package.reload
expect(work_package.remaining_hours).to eq 125.0
Expand Down

0 comments on commit da19e6e

Please sign in to comment.