*** Settings ***
Resource ${CURDIR}/../../../../common/resources/salesforce_actions.resource
Resource ${CURDIR}/../resources/general_functionality_bulk_appointing.resource
Resource ${CURDIR}/../../bulk_requests/resources/bulk_requests.resource
Resource ${CURDIR}/../../bulk_requests/resources/queries.resource
Suite Setup Suite Initialize
Suite Teardown Teardown Bulk Appointing New
Test Tags bulk_appointing
*** Variables ***
${BULK_APPOINTMENT_WIZARD_URL} /lightning/cmp/agentsync__bulkAppointmentWizard?agentsync__wizardStageNumber=3&agentsync__autoSubmitState={auto_submit_state}&agentsync__bulkRequestBatchId={bulk_request_batch_id}
${H3_TEXT} //h3[text()='Transaction Submission']
${DATA_ID_TOOLTIP} //div[@data-id='autoSubmitDisabledTooltip']
${LIGHTNING_MODAL} //lightning-modal
${DISABLED_RADIO_BUTTON} //span[.//input[@disabled]]
${CREATE_TRANSACTIONS_BUTTON} //button[text()="Submit Transactions"]
${CANCEL_BUTTON} //lightning-modal-footer//button[text()='Cancel']
*** Test Cases ***
Verify Helptext With Auto Submit False
[Documentation] Verifies if the Auto Submit option is FALSE
# Scenario: Verify help text WHEN auto-submit functionality is disabled
# GIVEN the auto-submit feature parameter is set to false
# WHEN the user navigates to the bulk appointment process settings page
# THEN the first radio option should be disabled
# AND tooltip should be displayed
${wizard_url_with_bulk_request_batch_id} Format String
... ${BULK_APPOINTMENT_WIZARD_URL}
... bulk_request_batch_id=${INSERTED_BULK_REQUEST_BATCH_ID} # robotcode: ignore
... auto_submit_state=false
AS Go To With Base URL ${wizard_url_with_bulk_request_batch_id}
AS Wait For Element State Visible ${H3_TEXT}
AS Fail If Element Count Is Not Equal ${DATA_ID_TOOLTIP} 1
AS Fail If Element Count Is Not Equal ${DISABLED_RADIO_BUTTON} 1
Verify Helptext With Auto Submit True
[Documentation] Verifies if the Auto Submit option is TRUE
# Scenario: Test the flow WHEN auto-submit functionality is enabled
# GIVEN the auto-submit feature parameter is set to true
# WHEN the user navigates to the bulk appointment process settings page
# THEN both radio option should be enabled
# AND no tooltip should be displayed
${wizard_url_with_bulk_request_batch_id} Format String
... ${BULK_APPOINTMENT_WIZARD_URL}
... bulk_request_batch_id=${INSERTED_BULK_REQUEST_BATCH_ID} # robotcode: ignore
... auto_submit_state=true
AS Go To With Base URL ${wizard_url_with_bulk_request_batch_id}
AS Wait For Element State Visible ${H3_TEXT}
AS Fail If Element Count Is Not Equal ${DATA_ID_TOOLTIP} 0
# THEN user clicks on Create Transactions button
# AND a modal should open up
AS Click ${CREATE_TRANSACTIONS_BUTTON}
AS Wait For Element State Visible //lightning-modal
AS Fail If Element Count Is Not Equal ${LIGHTNING_MODAL} 1
# THEN user clicks on Cancel button, inside the modal
# AND the modal should close up
AS Click ${CANCEL_BUTTON}
AS Wait For Element State Hidden //lightning-modal
AS Fail If Element Count Is Not Equal ${DATA_ID_TOOLTIP} 0
*** Keywords ***
Suite Initialize
${bulk_request_batch} Create Dictionary name=test bulk request batch
${bulk_request_batch_id} Create Bulk Request Batch SS bulk_request_batch=${bulk_request_batch}
VAR ${INSERTED_BULK_REQUEST_BATCH_ID} ${bulk_request_batch_id} scope=SUITE