lovinghouston / lwcgoogleplacesbutton

Adds a Lightning Web Component to create Google Place Listings (currently hardcoded to type "church") as a Salesforce object (currently hardcoded to a custom object named Church_School_Partnership__c).
3 stars 1 forks source link

Validate the Google Nearby Places API Call in Salesforce Method #14

Closed Julian88Tex closed 4 years ago

Julian88Tex commented 4 years ago

As a technical user, I want to be able use a script [to be provided by developer] with certain parameters [like "church" and location] to be able to get a list of Google Maps places that match those parameters [like "church" and location] in debug logs.

AC

Given a script the runs a method And the script includes type = church And the location [long & lat] = 4029 43rd Street San Diego, CA 92105 And the radius = 1500 And the key = [valid key] When the script is run Then in debug logs Churches are returned And the churches are within a radius of 1500 And the churches have names And the format is json

Given a script the runs a method And the script includes type = school And the location [long & lat] = 4029 43rd Street San Diego, CA 92105 And the radius = 1500 And the key = [valid key] When the script is run Then in debug logs school are returned And the school are within a radius of 1500 And the school have names And the format is json

Given a script the runs a method And the script includes type = church And the location [long & lat] = 4029 43rd Street San Diego, CA 92105 And the radius = 100 And the key = [valid key] When the script is run Then in debug logs Churches are returned And the churches are within a radius of 100 And the churches have names And the format is json

Given a script the runs a method And the script includes type = church And the location [long & lat] = 4029 43rd Street San Diego, CA 92105 And the radius = null And the key = [valid key] When the script is run Then in debug logs Churches are returned And the churches are with an error display "INVALID_REQUEST"

Given a script the runs a method And the script includes type = church And the location [long & lat] = null And the radius = 1500 And the key = [valid key] When the script is run And an error is displayed "INVALID_REQUEST"

Given a script the runs a method And the script includes type = null And the location [long & lat] = 4029 43rd Street San Diego, CA 92105 And the radius = 1500 And the key = [valid key] When the script is run Then in debug logs all places are returned And all places are within a radius of 1500 And all places have names And the format is json

Given a script the runs a method And the script includes type = church And the location [long & lat] = 4029 43rd Street San Diego, CA 92105 And the radius = 1500 And the key = [invalid key] When the script is run Then an error is displayed "REQUEST_DENIED"

Test Notes:

Julian88Tex commented 4 years ago

Points: 13

Julian88Tex commented 4 years ago

@sungysang Will add key to lastpass and share with @mersine

Julian88Tex commented 4 years ago

@mersine this trail should be all you need to do this ticket: https://trailhead.salesforce.com/content/learn/modules/developer_console

In particular, the "Generate Debug Logs" page will be what you want to pay the most attention to

Julian88Tex commented 4 years ago

@mersine here are some other things that I think will help:

https://www.youtube.com/watch?v=0IoG-mSvWSo this can help make your json more readable if it is just in one long string: https://jsonformatter.curiousconcept.com/

Julian88Tex commented 4 years ago

@sungysang @mersine In order to give Rodney something to test, I went ahead and created a Proof of Concept class in Loving Houston's sandbox

@mersine I went ahead and created you a user in their sandbox username: lovinghoust+rodney@gmail.com; let me know if you have issues logging in; note that since it's a Sandbox you'll login by navigating to test.salesforce.com. The first time you log in you'll have to create a password.

In order to run these testing, you'll need to open Anonymous Apex in their Developer Console and use the paste in the following code:

GooglePlaces.searchPlace(-33.8670522, 151.1957362,1500,'church','<googleAPIkeyonLastPass>');

You will need to replace the googleAPIkeyonLastPass with the actual key found in LastPass. Don't forget to include the quotes ('').

After running it, you will need to double click on the Debug Log which will open it and then click the "Debug Only" checkbox. Results should look something similar to this:

Screenshot 2020-02-02 18 46 12

Let me know if you have any trouble with the above!

rodney-zhu commented 4 years ago

Testing in this google doc.

Julian88Tex commented 4 years ago

@Rodney-Zhu nice :-) let me know if you have questions as you go!

Julian88Tex commented 4 years ago

@Rodney-Zhu In case this helps, here's a script run using our address (City Heights Square)'s Longitude and Latitude:

GooglePlaces.searchPlace(32.750010,-117.101700, 1500,'church',<googleapikey>);

sungysang commented 4 years ago

@Julian88Tex @Rodney-Zhu FYI I edited the Sandbox code so the debug logs won't display exactly as expected in this ticket. You can just test the criteria for https://github.com/Loving-Houston/lovinghouston/issues/18 instead

Julian88Tex commented 4 years ago

@sungysang @Rodney-Zhu I've completed testing on this ticket by completed testing on #18, so I'll close it.