Skip to content

Commit

Permalink
Started making Bugfix and Test for Issue damies13#241
Browse files Browse the repository at this point in the history
  • Loading branch information
ArekKuczynski committed May 23, 2024
1 parent 5c87a7f commit b0a6e9f
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 3 deletions.
30 changes: 30 additions & 0 deletions Tests/Regression/Manager/GUI_Features.robot
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,36 @@ Verify the Manager Handles Corrupted Scenario Files And Repairs It
... Delete Robot File AND
... Delete Scenario File ${scenario_name}

Verify the Manager Handles Scenario Files With Missing Scripts Files
[Tags] windows-latest ubuntu-latest macos-latest Issue #241
[Setup] Run Keywords
... Set INI Window Size 1200 600 AND
... Open Manager GUI AND
... Set Global Filename And Default Save Path ${robot_data}[0] AND
... Create Robot File name=example.robot file_content=***Test Case***\nExample Test Case\n

${scenario_name}= Set Variable test_scenario_missing_file
${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#241${/}test_scenario_missing_file.rfs
Copy File ${scenariofile} ${global_path}

Click Button runopen
Open Scenario File OS DIALOG ${scenario_name}
Sleep 3
Take A Screenshot
Press key.enter 1 Times
${ini_content}= Get Manager INI Data
${ini_content_list}= Split String ${ini_content} separator=\n
Should Contain ${ini_content_list} scenariofile =${SPACE} msg=Scenariofile ini section is not blank!
${running}= Is Process Running ${process_manager}
IF not ${running}
Fail RFSwarm manager crashed!
END

[Teardown] Run Keywords
... Run Keyword Close Manager GUI ${platform} AND
... Delete Robot File AND
... Delete Scenario File ${scenario_name}

Verify If Manager Saves Inject Sleep From Scenario Wide Settings
[Tags] windows-latest ubuntu-latest macos-latest Issue #174
[Setup] Run Keywords
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[Scenario]
uploadmode = err
scriptcount = 2
graphlist =

[1]
robots = 10
delay = 11
rampup = 12
run = 13
test = Example Test Case
script = example.robot
injectsleepenabled = True
injectsleepminimum = 10
injectsleepmaximum = 15

[2]
robots = 20
delay = 21
rampup = 22
run = 23
test = Me too
script = i_dont_exsist.robot
injectsleepenabled = True
injectsleepminimum = 10
injectsleepmaximum = 15
27 changes: 24 additions & 3 deletions rfswarm_manager/rfswarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,8 +1162,6 @@ def parse_time(self, stime_in):
return int(st.timestamp())

def hash_file(self, file, argrelpath=""):
if not (os.path.exists(file) and os.path.isfile(file)):
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), file)
BLOCKSIZE = 65536

# if len(argrelpath) > 0:
Expand Down Expand Up @@ -2704,7 +2702,8 @@ def OpenFile(self, ScenarioFile):
base.debugmsg(7, "combined:", combined)
scriptname = os.path.abspath(combined)
base.debugmsg(7, "scriptname:", scriptname)
self.sr_file_validate(rowcount, scriptname)
if not self.sr_file_validate(rowcount, scriptname):
break
else:
base.debugmsg(3, "script missing [", istr, "]")
fileok = False
Expand Down Expand Up @@ -3210,6 +3209,28 @@ def sr_file_validate(self, r, *args):
scriptfile = args[0]
else:
scriptfile = ""

if os.path.exists(scriptfile) == False:
if base.args.nogui:
msg = "File:\n"+scriptfile+"\n\nwhich is saved in the scenaro file as a script cannot be found by RFSwarm Manager."
msg += "\n\nScenario dir:\n"+base.config['Plan']['ScenarioDir']
tkm.showwarning("RFSwarm - Warning", msg)
else:
base.debugmsg(0, "File:", scriptfile, "cannot be found in",base.config['Plan']['ScenarioDir'])
base.config['Plan']['ScenarioFile'] = base.inisafevalue("")
base.saveini()
return False
elif os.path.isfile(scriptfile) == False:
if base.args.nogui:
msg = "Path:\n"+scriptfile+"\n\nwhich is saved in the scenaro file as a script is not a file."
msg += "\n\nScenario dir:\n"+base.config['Plan']['ScenarioDir']
tkm.showwarning("RFSwarm - Warning", msg)
else:
base.debugmsg(0, "Path:", scriptfile, "is not a file!")
base.config['Plan']['ScenarioFile'] = base.inisafevalue("")
base.saveini()
return False

base.debugmsg(7, "scriptfile:", scriptfile)
if len(scriptfile) > 0:
base.scriptlist[r]["Script"] = scriptfile
Expand Down

0 comments on commit b0a6e9f

Please sign in to comment.