testRigor & Salesforce
  • NO-CODE UI TESTING: Guide for testRigor & Salesforce
  • Getting Started
    • Get a Salesforce Hands-On Playground Org (free)
    • Get testRigor (free) and create a Test Suite
    • Create Test Case (T00001)
    • Navigation in Salesforce
    • Navigation in testRigor
  • BASIC TEST CASES
    • Record, edit and play a Test Case (T00002)
    • Create and convert a Lead (T00003)
    • Create more records (T00004)
    • Check Account Validation Rule (T00005)
  • ADVANCED TEST CASES
    • Account Action and List View Button (T00006)
    • Validate Field Value Using REST API (T00007)
    • E2E: Lead entry (Titan) ➔ Salesforce ➔ Email
  • OTHER TEST SCENARIOS
    • Submit a Test Lead
    • TH: Opportunity Won THEN Create Contract
    • Monitor data in your website
    • Monitoring in Production
  • FLOW TEST CASES
    • Screen Flow: Update Email Address
  • E-BIKES SAMPLE APP
    • E-Bikes sample app description
    • testRigor version of the UTAM TEST (EBIKES-00001)
    • Product Explorer - Electra X3 (EBIKES-00002)
    • Reseller Order - Create (EBIKES-00003)
    • Case - Create (EBIKES-00004)
  • LWC RECIPES SAMPLE APP
    • LWC Recipes sample app description
    • Test Case for LWC Recipes (LWC-00001)
  • CORAL CLOUDS SAMPLE APP
    • Coral Clouds sample app description
    • Experience - Generate Description using AI (CC-00001)
    • Experience - Generate Reviews Summary using AI (CC-00002)
  • MORE INFORMATION
    • About testing
    • About testing in Salesforce 🤔
    • About test automation
    • About Test-Driven Development (TDD)
    • About testRigor
    • About using testRigor
    • About other solutions
  • FEEDBACK
    • Questions? - Comments!
Powered by GitBook
On this page
  • A. Specify the requirement
  • B. Create a Test Case in testRigor
  • C. Configure / Develop in Salesforce
  1. OTHER TEST SCENARIOS

TH: Opportunity Won THEN Create Contract

PreviousSubmit a Test LeadNextMonitor data in your website

Last updated 5 months ago

A. Specify the requirement

  • When an Opportunity Stage is set to "Closed Won"

    • then a draft Contract should be created.


B. Create a Test Case in testRigor

  1. Create a new Test Case.

  2. Copy-paste all steps from this Test Case: Create more records (T00004)

    • creates a new Account, Contact and Opportunity

  3. Copy-paste lines from the code block below to the end of the Test Case.

  4. Run the Test Case.

  5. Observe that the Test Case fails.

// CLOSE THE OPPORTUNITY
click "Closed" 
click "Select Closed Stage" 
select "Closed Won" from "Stage" roughly below the "*"
click "Save"
click "Details"
check that page contains "Closed Won" to the right of "Stage"

// CHECK THE CONTRACT CREATED
grab value from "Contract" and save it as "ContractNumber"
click on stored value "ContractNumber" to the right of "Contract"
click "Details"
check that page contains "12" below "Contract Term (months)"

C. Configure / Develop in Salesforce

  1. Set Field Level Security for Contract field in Opportunity visible for all Profiles

    • Setup > Object Manager > Opportunity > Fields > Contract

  2. Add Contract field to the Opportunity Layout

  3. Create and activate a Record-Triggered, After Save Flow

    • GIVEN: Opportunity

    • WHEN: Opportunity Stage is changed to Closed Won

    • THEN: Create Contract

  4. Run the test in testRigor


https://trailhead.salesforce.com/content/learn/modules/record-triggered-flows/build-a-record-triggered-flow