Skip to content

Commit

Permalink
Add E2E tests for licence condtions pre-fill
Browse files Browse the repository at this point in the history
  • Loading branch information
currycoder committed Dec 16, 2024
1 parent 82dd6fa commit 344a793
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 3 deletions.
2 changes: 1 addition & 1 deletion caseworker/advice/templates/advice/advice_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ <h2 class="govuk-heading-m">Reason for approving</h2>

{% if advice.0.proviso %}
<h2 class="govuk-heading-m">Licence condition</h2>
<p class="govuk-body">{{ advice.0.proviso|linebreaks }}</p>
<div class="govuk-body licence-condition">{{ advice.0.proviso|linebreaks }}</div>
{% endif %}

{% if advice.0.note %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,77 @@ Feature: I want to record my user advice and any comments and conditions relatin
And I click on "Details" tab
Then I see the case status is now "Finalised"
And I see the case is not assigned to any queues

@lu_consolidate_advice_ogd_licence_conditions
Scenario: LU consolidate advice with OGD licence conditions
Given I sign in as Test UAT user
And I create standard application or standard application has been previously created
# LR
When I switch to "Licensing Reception" with queue "Licensing Reception SIEL applications" and I submit the case
Then I see the case status is now "Initial checks"
And I see the case is assigned to queues "Enforcement Unit Cases to Review, Technical Assessment Unit SIELs to Review"
# EU
When I switch to "Enforcement Unit" with queue "Enforcement Unit Cases to Review" and I submit the case
Then I see the case status is now "Initial checks"
And I see the case is assigned to queues "Technical Assessment Unit SIELs to Review"
And I see the case is not assigned to queues "Enforcement Unit Cases to Review"
# TAU
When I go to my profile page
And I change my team to "Technical Assessment Unit" and default queue to "Technical Assessment Unit SIELs to Review"
And I go to my case list
Then I see previously created application
When I click on the application previously created
And I assign myself to the case
Then I click on Product assessment
And I select good
And I select the CLE "ML1a"
And I select "components for" / "microwave components" as report summary prefix / subject and regime to none and submit
When I click move case forward
Then I don't see previously created application
# LU
When I switch to "Licensing Unit" with queue "Licensing Unit Pre-circulation Cases to Review" and I submit the case
Then I see the case status is now "OGD Advice"
And I see the case is assigned to queues "MOD-DI Indirect cases to review, MOD-CapProt cases to review, FCDO Cases to Review"
# MOD-DI
When I switch to "MOD-DI" with queue "MOD-DI Indirect cases to review" and I submit the case
Then I see the case status is now "OGD Advice"
And I see the case is assigned to queues "MOD-CapProt cases to review, FCDO Cases to Review"

##### Sub-advisor to give advice #####
When I go to my profile page
And I change my team to "MOD-CapProt" and default queue to "MOD-CapProt cases to review"
And I go to my case list
Then I should see my case in the cases list
When I click the application previously created
And I assign myself to the case
And I click the recommendations and decision tab
And I click make recommendation
And I click approve all
And I click continue
And I enter "reason for approving" as the reasons for approving
And I click the text "Add a licence condition, instruction to exporter or footnote"
And I enter "MOD licence condition" as the licence condition
And I enter "instruction for exporter" as the instructions for the exporter
And I enter "reporting footnote" as the reporting footnote
And I click submit recommendation
Then I see "reason for approving" as the reasons for approving
And I see "MOD licence condition" as the licence condition
And I see "instruction for exporter" as the instructions for the exporter
And I see "reporting footnote" as the reporting footnote
When I logout
Given I sign in as Licensing Unit Officer
And I prepare the application for final review
When I go to my case list
And I go to my case list
And I click the application previously created
And I assign myself as case officer to the case
And I go to my case list
And I click the application previously created
And I click the recommendations and decision tab
And I click "Review and combine"
And I enter "reason for approving" as the reasons for approving
And I click "Add licence condition"
And I click submit recommendation
Then I see "reason for approving" as the reasons for approving
And I see "MOD licence condition" in the licence condition
And I see "condition that you add the firearm’s serial numbers" in the licence condition
4 changes: 2 additions & 2 deletions ui_tests/caseworker/pages/advice.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ def get_refusal_note(self):

def get_licence_condition(self):
return self.driver.find_element(
by=By.XPATH,
value="//p[preceding-sibling::*[self::h2 or self::h3][contains(text(), 'Licence condition')]][2]",
by=By.CLASS_NAME,
value="licence-condition",
).text

def get_instructions_for_exporter(self):
Expand Down
5 changes: 5 additions & 0 deletions ui_tests/caseworker/step_defs/test_give_advice/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ def should_see_licence_condition(driver, licence_condition, context): # noqa
assert RecommendationsAndDecisionPage(driver).get_licence_condition() == licence_condition


@then(parsers.parse('I see "{licence_condition}" in the licence condition'))
def should_see_licence_condition(driver, licence_condition, context): # noqa
assert licence_condition in RecommendationsAndDecisionPage(driver).get_licence_condition()


@then(parsers.parse('I see "{instructions}" as the instructions for the exporter'))
def should_see_instructions_for_exporter(driver, instructions, context): # noqa
assert RecommendationsAndDecisionPage(driver).get_instructions_for_exporter() == instructions
Expand Down

0 comments on commit 344a793

Please sign in to comment.