-
Notifications
You must be signed in to change notification settings - Fork 569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Steps { and } should not be used for step / code blocks #26
Comments
Reclassifying more appropriately as a bug because v1.8 may break the original design of users who have used { and } to mean traditional JavaScript code blocks. |
Thinking through, it seems that there is probably no existing use case which will encounter an issue with the above auto-replacement to casper context blocks. This is because lines in the automation flows are already by default in casper context. Developers wanting to add custom functions would have to define them in tagui_header.js. Unless they manually close the casper context, define them, and reopen casper context. In that case using js step to explicitly declare as JavaScript code would work. Readme should officially include js step. This should be a good balance between pro-developers flexibility and quick prototyping convenience. |
Closing and changing to enhancement category - adding js step officially to readme documentation. |
- improve code block and loop handling. to process { and } into casper blocks if the lines start with { or }. otherwise will cause many valid javascript code to throw error. such as when using chrome_step or setting api_config. with this change, the js step is not needed to avoid those errors. add more error checking for loops to show error at parsing if { is written on the same line. this will guide users to type { on the next line to be auto-parsed into casperjs blocks. - updated details for steps that are not relevant/supported in live mode, add support for live mode navigate to url when running chrome browser. for phantomjs, set window.location.href or using casper.thenOpen will not work when event loop is not yet passed back to main 'thread'. also checked that recent changes to steps have been mirrored to live mode. - add code in positive test to auto-cleanse local folder path instead of manually searching and replacing
- fixed bug that can mess up complicated flows with multiple loop calls - frame and popup previously don’t work in for loop. now it can be used in for loop. however, no code blocks for frame / popup. just call multiple times in the for loop. can become very messy and harder for user to debug issues if try to implement that now. frame name step a frame name step b
ISSUE - In release v1.8, steps { and } are introduced to define steps and code blocks. This adds convenience and powerful automation when used with if/for/while/popup/frame.
The idea is replacing { with
And replacing } with
The above replacements and some tracking logic will automatically take care of CasperJS code blocks formatting. However, as { and } can also be used in JavaScript to define code blocks, there can be situations where developers want to define custom functions or events which above auto-replacement will break their code. Unless they use js step to explicitly tell TagUI to treat that line as pure JavaScript and not to parse it as a TagUI step.
There should be a better way so that developers do not have to type js { or js } to explicitly treat the line as JavaScript, and normal users can define step/code blocks easily. Maybe checking [ and ] instead as the single character on the line as markers for start and end of step/code block.
The text was updated successfully, but these errors were encountered: