def load_steps(self): for script_path_name in self.step_files: step = Step() self.steps.append(step) step.script_path_name = script_path_name with open(script_path_name, "r") as f: step.script = f.read()
def new_step(step_uid, **kwargs): step = Step() step.uid = step_uid if step.uid == StepUids.NULL_STEP: step.script = "alert ('nullStep');" return step elif step.uid == StepUids.TEST_STEP: step.default_args_dict = { "isOk": True, "numLines": 4, "portion": 0.1234567890, "portion2": 1, "none": None, "hello": "HelloWorld", "hasReturn": True } step.script = """ var step_result = args args.hello = "byeBye!!" alert ('testStep'); """ return step elif step.uid == StepUids.FROM_JSX: if "script_path_name" in kwargs.keys(): step_pool = Facade.getInstance().retrieveProxy( StepPoolProxy.NAME).__get_step_pool() step = step_pool.get_step( file_path_name=kwargs["script_path_name"]) return step else: print("StepFactory.new_step no step with such uid") return StepFactory.new_step(StepUids.NULL_STEP)
def get_step(self, step_uid): step = self.__get_step_pool().get_step(script_path_name=step_uid) if not step: step = Step() return step