<commit_before>*** Settings ***
Documentation
...  This suite tests the `Populate Field` keyword.
...  Specifically, it verifies that the keyword properly
...  overwrites previous values. We had some bugs where
...  new values were getting appended rather than replacing
...  existing values.
...
...  This suite uses an opportunity, since the edit dialog
...  has several different field types on it.

Library   String
Library   DateTime
Resource  cumulusci/robotframework/Salesforce.robot

Suite Setup     run keywords
...  Open test browser
...  Create opportunity
Suite Teardown  Delete Records and Close Browser

*** Keywords ***
Create opportunity
    [Documentation]
    ...  Creates a test opportunity with a random name and a close
    ...  date 30 days in the future. A reference to the created
    ...  opportunity will be stored in the suite variable ${opportunity},
    ...  and be return as the result of this keyword.

    ${30 days from now}=  Get Current Date  increment=30 days  result_format=%Y-%m-%d
    ${random}=  Generate random string  8  [NUMBERS]
    ${opportunity_id}=    Salesforce Insert  Opportunity
    ...                   Name=Test Opportunity ${random}
    ...                   CloseDate=2018-04-01
    ...                   Amount=100000
    ...                   Probability=42
    ...                   StageName=Prospecting
    ...                   Description=Clever description here
    &{opportunity}=       Salesforce Get  Opportunity  ${opportunity_id}
    set suite variable    ${opportunity}
    [Return]  ${opportunity}

Verify "populate field" replaces previous value
    [Arguments]  ${field name}  ${new value}
    [Documentation]
    ...  Verify that a field has the expected value after calling 'populate field'
    ...  This keyword will NOT cause the test to fail immediately, so that we can
    ...  check multiple fields before the test completes
<commit_msg>Use the computed date rather than a hard-coded date.<commit_after>*** Settings ***
Documentation
...  This suite tests the `Populate Field` keyword.
...  Specifically, it verifies that the keyword properly
...  overwrites previous values. We had some bugs where
...  new values were getting appended rather than replacing
...  existing values.
...
...  This suite uses an opportunity, since the edit dialog
...  has several different field types on it.

Library   String
Library   DateTime
Resource  cumulusci/robotframework/Salesforce.robot

Suite Setup     run keywords
...  Open test browser
...  Create opportunity
Suite Teardown  Delete Records and Close Browser

*** Keywords ***
Create opportunity
    [Documentation]
    ...  Creates a test opportunity with a random name and a close
    ...  date 30 days in the future. A reference to the created
    ...  opportunity will be stored in the suite variable ${opportunity},
    ...  and be return as the result of this keyword.

    ${30 days from now}=  Get Current Date  increment=30 days  result_format=%Y-%m-%d
    ${random}=  Generate random string  8  [NUMBERS]
    ${opportunity_id}=    Salesforce Insert  Opportunity
    ...                   Name=Test Opportunity ${random}
    ...                   CloseDate=${30 days from now}
    ...                   Amount=100000
    ...                   Probability=42
    ...                   StageName=Prospecting
    ...                   Description=Clever description here
    &{opportunity}=       Salesforce Get  Opportunity  ${opportunity_id}
    set suite variable    ${opportunity}
    [Return]  ${opportunity}

Verify "populate field" replaces previous value
    [Arguments]  ${field name}  ${new value}
    [Documentation]
    ...  Verify that a field has the expected value after calling 'populate field'
    ...  This keyword will NOT cause the test to fail immediately, so that we can
    ...  check multiple fields before the test completes

{'fraction_non_alphanumeric': 0.08578052550231839, 'fraction_numerical': 0.010303967027305513, 'mean_word_length': 2.4181338028169015, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3830949', 'n_tokens_mistral': 1024, 'n_tokens_neox': 956, 'n_words': 417}