Skip to content

Commit

Permalink
Merge pull request #43 from keysight-eggplant/table-image-validation-…
Browse files Browse the repository at this point in the history
…dave-hester

Dave completed challenge 02
  • Loading branch information
CosmicKetchup authored Dec 13, 2022
2 parents 6e80529 + 16f1f23 commit fd147e2
Show file tree
Hide file tree
Showing 11 changed files with 267 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{CaptureDate = "2022-10-28 11:48:34 -0400"; CaptureHost = "screenshot.png \U2013 C:/ScriptRepositories/Sensetalk-Solutions/02-table-image-validation.suite/Resources"; CaptureScreenSize = (1456, 1000); CropRectangle = "8,0,29,22"; HasAlpha = 0; HotSpotX = 8; HotSpotY = 19; ImageDescription = <>; LastKnownLocationX = 0; LastKnownLocationY = 0; OriginalLocationX = 20; OriginalLocationY = 953; Precise = 1; Pulsing = 0; Scale = 1; SearchObjectName = "dave/TableBL2"; tags = (); }
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{CaptureDate = "2022-10-28 11:49:12 -0400"; CaptureHost = "screenshot.png \U2013 C:/ScriptRepositories/Sensetalk-Solutions/02-table-image-validation.suite/Resources"; CaptureScreenSize = (1456, 1000); CropRectangle = "0,0,23,24"; HasAlpha = 0; HotSpotX = 22; HotSpotY = 22; ImageDescription = <>; LastKnownLocationX = 0; LastKnownLocationY = 0; OriginalLocationX = 1406; OriginalLocationY = 951; Precise = 1; Pulsing = 0; Scale = 1; SearchObjectName = "dave/TableBR"; tags = (); }
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{CaptureDate = "2022-10-28 11:44:08 -0400"; CaptureHost = "screenshot.png \U2013 C:/ScriptRepositories/Sensetalk-Solutions/02-table-image-validation.suite/Resources"; CaptureScreenSize = (1456, 1000); CropRectangle = "0,9,27,33"; HasAlpha = 0; HotSpotX = 24; HotSpotY = 9; ImageDescription = <>; LastKnownLocationX = 0; LastKnownLocationY = 0; OriginalLocationX = 1402; OriginalLocationY = 20; Precise = 1; Pulsing = 0; Scale = 1; SearchObjectName = "dave/TableUR"; tags = (); }
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions 02-table-image-validation.suite/Scripts/dave.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
put resourcePath("screenshot.png") into screenshotPath
connect {name: screenshotPath, type: "screenshot"}

//calculate tighly bounded table coordinates
set myBL_SearchArea to (0,top of ImageRectangle("dave/TableBR"),left of ImageRectangle("dave/TableBR"),bottom of ImageRectangle("dave/TableBR"))
put ImageLocation(image:"dave/TableBL",SearchRectangle:myBL_SearchArea) into myBL_Hotspot
put ImageLocation("dave/TableUR") into myUR_Hotspot
put ImageLocation("dave/TableBR") into myBR_Hotspot
put item 1 of myBL_Hotspot into ULx
put item 2 of myUR_Hotspot into ULy
put item 1 of myBR_Hotspot into BRx
put item 2 of myBR_Hotspot into BRy
put ReadTable(ULx,ULy,BRx,BRy) into myTableData

//initialize select variables: counter and empty lists
set i = 1
put [] into myRowHeaders
put [] into myColumnHeaders

//normalize data in myTableData
replace every occurrence of newline in myTableData with space -- resolves issues of ReadTable introducing newline characters

repeat with each item CurrentRow of myTableData by reference

Put the number of items of CurrentRow into myRowItemCount
Log "The original number of items in the Current Row is" && myRowItemCount

If item 2 of CurrentRow is empty then

Delete item (repeatindex()) of myTableData -- deletes empty rows as all valid rows will have a value for column 2
Next Repeat

//ReadTable will insert values for merged cells into the first available column; this duplicates the value into the next column

else if item 3 of CurrentRow is empty then

Log "This is a merged cell."
insert item 2 of CurrentRow after item 2 of CurrentRow

End If

//Creates list of row headers from item 1 of each row
insert item 1 of CurrentRow after item i of myRowHeaders
set i = i + 1

end repeat

put each item of item 1 of myTableData into myColumnHeaders
delete item 1 of myRowHeaders -- insert command above will create an additional item that needs to be deleted

Answer "In- or Out-of-Network" with "Out-of-Network" or "In-Network" title "Network Choice" -- creates answer buttons
Put IT into myNetworkSelection

Answer "Which benefit?" from list ("Annual Routine Physical", "Eye Exam", "Routine Dental", "Foot Care - Routine", "Hearing Exam", "Hearing Aids", "Transportation", "Personal Emergency Response System (PERS)") -- creates answer list
Put IT into myBenefitSelection

Repeat with each item CurrentColumn of myColumnHeaders

If CurrentColumn contains myNetworkSelection then

put RepeatIndex() into myColumnIndex
Exit Repeat

End If

End repeat


Repeat with each item CurrentRow of myRowHeaders

If CurrentRow contains myBenefitSelection then

put RepeatIndex() into myRowIndex
Exit Repeat

End If

End repeat

put item myColumnIndex of item myRowIndex of myTableData into myCalculatedBenefit

Log "The calculated benefit of " && myNetworkSelection && myBenefitSelection && "is" && myCalculatedBenefit
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"lastmodifieddate": 1666972087.7620001,
"lastfoundlocation": [
20,
255,
29,
30
],
"originalcapturelocation": [
20,
953,
29,
30
],
"createddate": 1666971964.9889998,
"lastfounddate": 1666972044.4060001,
"testlocationdata": [
{
"deleted": true,
"properties": {
"CropRectangle": "[0,0,0,0]",
"Rotate": 0,
"Scale": " 1",
"HotSpot": "[14,15]",
"Tolerance": "_1",
"Discrepancy": "_0",
"SearchType": "Precise to Pixel"
},
"sutinfo": {
"Type": "Testplant Screen Image"
},
"name": "dave/TableBL.png",
"connectionname": "screenshot.png",
"type": 1,
"capturerect": [
20,
953,
29,
30
],
"connectiontype": "Screenshot",
"connectionserverid": "C:/ScriptRepositories/Sensetalk-Solutions/02-table-image-validation.suite/Resources/screenshot.png"
}
],
"name": "dave/TableBL"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"lastmodifieddate": 1666972274.6399999,
"lastfoundlocation": [
28,
953,
21,
22
],
"originalcapturelocation": [
20,
953,
29,
30
],
"createddate": 1666972130.793,
"lastfounddate": 1666991440.911,
"testlocationdata": [
{
"properties": {
"CropRectangle": "[0,0,0,0]",
"Rotate": 0,
"Scale": " 1",
"HotSpot": "[14,15]",
"Tolerance": "_1",
"Discrepancy": "_0",
"SearchType": "Precise to Pixel"
},
"sutinfo": {
"Type": "Testplant Screen Image"
},
"name": "dave/TableBL.png",
"connectionname": "screenshot.png",
"type": 1,
"connectionserverid": "C:/ScriptRepositories/Sensetalk-Solutions/02-table-image-validation.suite/Resources/screenshot.png",
"capturerect": [
20,
953,
29,
30
],
"connectiontype": "Screenshot",
"capturedocrtext": "L"
}
],
"name": "dave/TableBL2"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"lastmodifieddate": 1666972312.7639999,
"lastfoundlocation": [
1406,
951,
23,
24
],
"originalcapturelocation": [
1406,
951,
30,
33
],
"createddate": 1666972168.277,
"lastfounddate": 1666991441.1370001,
"testlocationdata": [
{
"properties": {
"CropRectangle": "[0,0,0,0]",
"Rotate": 0,
"Scale": " 1",
"HotSpot": "[15,16]",
"Tolerance": "_1",
"Discrepancy": "_0",
"SearchType": "Precise to Pixel"
},
"sutinfo": {
"Type": "Testplant Screen Image"
},
"name": "dave/TableBR.png",
"connectionname": "screenshot.png",
"type": 1,
"capturerect": [
1406,
951,
30,
33
],
"connectiontype": "Screenshot",
"connectionserverid": "C:/ScriptRepositories/Sensetalk-Solutions/02-table-image-validation.suite/Resources/screenshot.png"
}
],
"name": "dave/TableBR"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"lastmodifieddate": 1666972346.9850001,
"lastfoundlocation": [
1402,
29,
27,
24
],
"originalcapturelocation": [
1402,
20,
35,
33
],
"createddate": 1666971900.2389998,
"lastfounddate": 1666991440.9780002,
"testlocationdata": [
{
"properties": {
"CropRectangle": "[0,0,0,0]",
"Rotate": 0,
"Scale": " 1",
"HotSpot": "[17,16]",
"Tolerance": "_1",
"Discrepancy": "_0",
"SearchType": "Precise to Pixel"
},
"sutinfo": {
"Type": "Testplant Screen Image"
},
"name": "dave/TableUR.png",
"connectionname": "screenshot.png",
"type": 1,
"capturerect": [
1402,
20,
35,
33
],
"connectiontype": "Screenshot",
"connectionserverid": "C:/ScriptRepositories/Sensetalk-Solutions/02-table-image-validation.suite/Resources/screenshot.png"
}
],
"name": "dave/TableUR"
}

0 comments on commit fd147e2

Please sign in to comment.