MyProfilePageControllerTest class fails when StateAndCountryPicklist is enabled, and a System.AssertException occurs in the auto-generated MyProfilePageControllerTest class.
Sample JSON
{
"orgName": "aikebe company",
"edition": "Developer",
"features": [
"Communities",
"StateAndCountryPicklist", "PlatformCache", "Sites"
],
"settings": {
"lightningExperienceSettings": {
"enableS1DesktopEnabled": true
},
"mobileSettings": {
"enableS1EncryptedStoragePref2": false
}
}
}
Steps to reproduce
1. Create a Scratch Org - Enable StateAndCountryPicklist feature in the project-scratch-def.json.
2. Once its created, it auto generates an apex class MyProfilePageControllerTest
3. Run Test- Execute MyProfilePageControllerTest.testSave().
4. Observe Failure - System.AssertException: Assertion Failed: Class.MyProfilePageControllerTest.testSave: line 30, column 1
1.Exclude StateAndCountryPicklist feature when creating the scratch org
2.Enable the S/C feature manually once the scratch org is created by following the required steps in the UI which will requires converting the State and Country values to a valid value.
3.Then run the apex test once the S/C is successfully enabled
005318600

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.