Skip to content

Commit

Permalink
Merge pull request #1783 from uktrade/LTD-4595-ui-test-caseworker-clo…
Browse files Browse the repository at this point in the history
…se-query

LTD-4595: Add UI test for caseworker manually closing a query with response
  • Loading branch information
saruniitr authored Feb 9, 2024
2 parents 3cb4175 + 7c2cf95 commit fd86a5c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ui_tests/caseworker/features/ecju_queries.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,20 @@ Feature: I want to create ECJU queries
When I go to application previously created
And I click the queries tab
Then I see "Some unique response" as the response under closed queries

@caseworker_close
Scenario: Caseworker manually closing query with a response
# Caseworker creates query
Given I sign in to SSO or am signed into SSO
And I create standard application or standard application has been previously created
When I go to application previously created
And I assign myself to the case
And I click the queries tab
And I click "Send a query to the exporter"
And I enter "Provide data sheet for line item1" as the query
And I click send
Then I see "Provide data sheet for line item1" as the query under open queries
# Caseworker adds response and closes query
When I click close query to manually close the query
And I enter "required details provided by exporter" as the query response and submit
Then I see "required details provided by exporter" as the response under closed queries
10 changes: 10 additions & 0 deletions ui_tests/caseworker/pages/ecju_queries_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ class EcjuQueriesPages(BasePage):
def enter_question_text(self, text):
self.driver.find_element(by=By.ID, value=self.TEXTAREA_QUESTION_ID).send_keys(text)

def enter_response_and_submit(self, response_text):
open_queries = self.driver.find_element(by=By.ID, value="open-queries")
element = open_queries.find_element(by=By.CLASS_NAME, value="govuk-textarea")
element.clear()
element.send_keys(response_text)

# submit response
submit = open_queries.find_element(by=By.ID, value="id_submit")
submit.click()

def click_new_query_button(self):
self.driver.find_element(by=By.ID, value=self.BUTTON_NEW_QUERY_ID).click()

Expand Down
13 changes: 13 additions & 0 deletions ui_tests/caseworker/step_defs/test_ecju_queries.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from uuid import uuid4

from pytest_bdd import when, then, scenarios, given, parsers
from selenium.webdriver.common.by import By

from ui_tests.caseworker.pages.shared import Shared
from ui_tests.caseworker.pages.application_page import ApplicationPage
Expand Down Expand Up @@ -83,3 +84,15 @@ def response_in_closed_list(driver, response, context):
closed_text = EcjuQueriesPages(driver).get_closed_queries_text()
assert context.ecju_question in closed_text
assert response in closed_text


@when("I click close query to manually close the query")
def click_to_manually_close_query(driver):
open_queries = driver.find_element(by=By.ID, value="open-queries")
open_queries.find_element(by=By.CSS_SELECTOR, value=".govuk-details__summary").click()


@when(parsers.parse('I enter "{response}" as the query response and submit'))
def i_enter_query_response(driver, response):
ecju_queries_pages = EcjuQueriesPages(driver)
ecju_queries_pages.enter_response_and_submit(response)

0 comments on commit fd86a5c

Please sign in to comment.