* CLDC-3499: Update selenium
allows for the tests to run locally as it can download a browser version that exists
* CLDC-3499: Fix validations spec to be non year specific
* CLDC-3499: Remove unneeded 2020 dates from bulk scheme locations spec
* CLDC-3499: Remove year specific tests from form_handler_spec
* CLDC-3499: Remove 2020 test from lettings_log_spec
* CLDC-3499: Remove 2020 test from sales_log_spec
* CLDC-3499: Remove 2020 test from location_spec
makes the current_collection_after_crossover_start_date method a bit more useful, returns the date in the current collection year that crossover will end, rather than the crossover end date of the current period (which will be next year)
* CLDC-3499: Remove 2020 test from scheme_spec
* CLDC-3499: Remove 2020 test from setup_validations_spec
adds missing archived method to collection_time_helper
* CLDC-3499: Start changes to lettings log export service
* CLDC-3499: Remove unneeded old test from check answers summary list component spec
* CLDC-3499: Update check answers page spec for modern years
* CLDC-3499: Add more form helpers
* CLDC-3499: Remove year specific tests from lettings setup validations
* CLDC-3499: Remove year specific tests from managing org rake spec
* CLDC-3499: Update lettings log spec
* CLDC-3499: Update task list spec
* CLDC-3499: Update sales logs controller
* CLDC-3499: Remove old tests from sales log spec
* CLDC-3499: Fix some final old tests
* Revert "CLDC-3499: Start changes to lettings log export service"
This reverts commit 1edbc9ab8c.
* CLDC-3499: Lint
* feat: enforce crossover tests pass
* feat: re-include archived log display test
---------
Co-authored-by: Nat Dean-Lewis <nat.dean-lewis@softwire.com>
Co-authored-by: Nat Dean-Lewis <94526761+natdeanlewissoftwire@users.noreply.github.com>
question_labels=["Tenant code","Lead tenant’s age","Number of Household Members"]
question_labels=["Household links to UK armed forces","Anybody in household pregnant","Anybody with disabled access needs","Anybody in household with physical or mental health condition"]
question_labels.eachdo|label|
expect(page).tohave_content(label)
end
end
it"displays answers given by the user for the question in the subsection"do
expect(page).tohave_link("Enter lead tenant’s age",href:"/lettings-logs/#{empty_lettings_log.id}/person-1-age?referrer=check_answers_new_answer")
expect(page).tohave_link("Tell us if there are any household links to UK armed forces",href:"/lettings-logs/#{id}/armed-forces?referrer=check_answers_new_answer")
@ -1389,16 +1270,16 @@ RSpec.describe LettingsLog do
context"and the new startdate triggers void date validation"do
it"doesn't clear void date value"do
expect{lettings_log.update!(startdate:Time.zone.yesterday)}.toraise_error(ActiveRecord::RecordInvalid,/Enter a void date that is before the tenancy start date/)
context"and the new startdate triggers major repairs date validation"do
it"doesn't clear major repairs date value"do
expect{lettings_log.update!(startdate:Time.zone.yesterday)}.toraise_error(ActiveRecord::RecordInvalid,/Enter a major repairs date that is before the tenancy start date/)
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 2021 to 2022 or 2022 to 2023 collection years, which is between 1st April 2021 and 31st March 2023")
end
it"cannot be after the second collection window end date"do
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 2021 to 2022 or 2022 to 2023 collection years, which is between 1st April 2021 and 31st March 2023")
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 2022 to 2023 collection year, which is between 1st April 2022 and 31st March 2023")
end
it"cannot be after the second collection window end date"do
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 2022 to 2023 collection year, which is between 1st April 2022 and 31st March 2023")
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 2022 to 2023 or 2023 to 2024 collection years, which is between 1st April 2022 and 31st March 2024")
end
it"cannot be after the second collection window end date"do
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 2022 to 2023 or 2023 to 2024 collection years, which is between 1st April 2022 and 31st March 2024")
end
it"cannot be before previous collection year start date"do
expect(record.errors["startdate"]).toinclude(match(/Enter a date within the \d{4} to \d{4} or \d{4} to \d{4} collection years, which is between 1st April \d{4} and 31st March \d{4}/))
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 2023 to 2024 collection year, which is between 1st April 2023 and 31st March 2024")
end
it"cannot be after the second collection window end date"do
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 2023 to 2024 collection year, which is between 1st April 2023 and 31st March 2024")
expect(record.errors["startdate"]).toinclude(match(/Enter a date within the \d{4} to \d{4} collection year, which is between 1st April \d{4} and 31st March \d{4}/))
end
end
@ -125,73 +67,90 @@ RSpec.describe Validations::SetupValidations do
context"when after the new logs end date and after the edit end date for the previous period"do
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 2023 to 2024 collection year, which is between 1st April 2023 and 31st March 2024")
expect(record.errors["startdate"]).toinclude(match(/Enter a date within the \d{4} to \d{4} collection year, which is between 1st April \d{4} and 31st March \d{4}/))
end
it"cannot edit already created logs for the previous collection year"do
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 2023 to 2024 collection year, which is between 1st April 2023 and 31st March 2024")
expect(record.errors["startdate"]).toinclude(match(/Enter a date within the \d{4} to \d{4} collection year, which is between 1st April \d{4} and 31st March \d{4}/))
end
end
end
context"when attempted startdate is more than 14 days from the current date"do
context"and the attempted startdate is in a future collection year"do
it"adds both errors to startdate, with the collection year error first"do
record.startdate=Time.zone.local(2024,4,1)
record.startdate=next_collection_start_date
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"].length).tobe>=2
expect(record.errors["startdate"][0]).toeq("Enter a date within the 2023 to 2024 collection year, which is between 1st April 2023 and 31st March 2024.")
expect(record.errors["startdate"][0]).tomatch(/Enter a date within the \d{4} to \d{4} collection year, which is between 1st April \d{4} and 31st March \d{4}/)
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning organisation was active. Merged org became inactive on 2 February 2023 and was replaced by Absorbing org.")
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning organisation was active. Merged org became inactive on #{merge_date_formatted} and was replaced by Absorbing org.")
end
it"allows startdate before organisation has been merged"do
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning organisation was active. Absorbing org became active on 1 February 2023.")
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning organisation was active. Absorbing org became active on #{available_from_formatted}.")
end
it"allows startdate after absorbing organisation has become available"do
expect(record.errors["startdate"]).toinclude(match"Enter a date when the managing organisation was active. Merged org became inactive on 2 February 2023 and was replaced by Absorbing org.")
expect(record.errors["startdate"]).toinclude(match"Enter a date when the managing organisation was active. Merged org became inactive on #{merge_date_formatted} and was replaced by Absorbing org.")
end
it"allows startdate before organisation has been merged"do
expect(record.errors["startdate"]).toinclude(match"Enter a date when the managing organisation was active. Absorbing org became active on 1 February 2023.")
expect(record.errors["startdate"]).toinclude(match"Enter a date when the managing organisation was active. Absorbing org became active on #{available_from_formatted}.")
end
it"allows startdate after absorbing organisation has become available"do
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning and managing organisation was active. Merged org became inactive on 2 February 2023 and was replaced by Absorbing org.")
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning and managing organisation was active. Merged org became inactive on #{merge_date_formatted} and was replaced by Absorbing org.")
end
it"allows startdate before organisation has been merged"do
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning and managing organisation was active. Absorbing org became active on 1 February 2023.")
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning and managing organisation was active. Absorbing org became active on #{available_from_formatted}.")
end
it"allows startdate after absorbing organisation has become available"do
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning and managing organisations were active. Merged org 2 and Merged org became inactive on 2 February 2023 and were replaced by Absorbing org.")
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning and managing organisations were active. Merged org 2 and Merged org became inactive on #{merge_date_formatted} and were replaced by Absorbing org.")
end
it"allows startdate before organisations have been merged"do
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning and managing organisations were active. Merged org 2 became inactive on 2 February 2023 and was replaced by Absorbing org 2. Merged org became inactive on 2 February 2023 and was replaced by Absorbing org.")
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning and managing organisations were active. Merged org 2 became inactive on #{merge_date_formatted} and was replaced by Absorbing org 2. Merged org became inactive on #{merge_date_formatted} and was replaced by Absorbing org.")
end
it"allows startdate before organisations have been merged"do
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning and managing organisations were active. Absorbing org 2 became active on 1 February 2023, and Absorbing org became active on 1 February 2023.")
expect(record.errors["startdate"]).toinclude(match"Enter a date when the owning and managing organisations were active. Absorbing org 2 became active on #{available_from_formatted}, and Absorbing org became active on #{available_from_formatted}.")
end
it"allows startdate after absorbing organisation has become available"do
expect(json_response["errors"]).tocontain_exactly(["beds",["Number of bedrooms must be 1 if the property is a bedsit."]],["proptype",["Answer cannot be 'Bedsit' if the property has 2 or more bedrooms."]])
"Number of bedrooms must be 1 if the property is a bedsit.",
],
],
[
"proptype",
[
"Answer cannot be 'Bedsit' if the property has 2 or more bedrooms.",
],
],
[
"saledate",
[
"Enter a date within the #{previous_collection_start_year} to #{previous_collection_end_year} or #{current_collection_start_year} to #{current_collection_end_year} collection years, which is between 1st April #{previous_collection_start_year} and 31st March #{current_collection_end_year}.",
],
],
)
end
end
end
@ -341,72 +366,70 @@ RSpec.describe SalesLogsController, type: :request do
expect(page).tohave_content("This log is from the 2021 to 2022 collection window, which is now closed.")
expect(page).tohave_content("This log is from the #{archived_collection_start_year} to #{archived_collection_end_year} collection window, which is now closed.")
end
end
@ -959,6 +964,7 @@ RSpec.describe SalesLogsController, type: :request do