Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ide_script [2020/06/01 15:21] – [Code Assist] admin | ide_script [2024/01/02 19:49] (current) – [User Script] admin | ||
---|---|---|---|
Line 25: | Line 25: | ||
==== Code Assist ==== | ==== Code Assist ==== | ||
- | Code assist is supported on [[https:// | + | Code assist is supported on [[https:// |
Code assist can be opened with // | Code assist can be opened with // | ||
Line 42: | Line 42: | ||
---- | ---- | ||
==== Plugins ==== | ==== Plugins ==== | ||
- | //Plugins// extends the capability of // | + | //Plugins// extends the capability of // |
- | {{ wiki: | ||
- | |||
- | Activated plugins will automatically added to code assist (Ctrl-Space). | ||
- | |||
- | More info can be found at [[Plugins]] and [[http:// | ||
---- | ---- | ||
Line 110: | Line 105: | ||
=== Create Page Objects === | === Create Page Objects === | ||
Use the following script to create a new page object: | Use the following script to create a new page object: | ||
- | page1 = $SYS.addPage(' | + | page1 = $PAGE.addPage(' |
- | page1 = $SYS.getPageMgr().addPage(' | + | |
Line 119: | Line 113: | ||
Use the following script to add a page action to a page: | Use the following script to add a page action to a page: | ||
| | ||
- | $SYS.log(' | + | $EXEC.log(' |
- | $SELENIUM.getWebDriver().findElement(By.tagName(' | + | $VAR.webdriver.findElement(By.tagName(' |
}) | }) | ||
+ | |||
+ | assuming that $VAR.webdriver has been assigned to WebDriver object that you have created. | ||
=== Add Page Elements === | === Add Page Elements === | ||
Line 129: | Line 125: | ||
Use the following script to add a page element to a page: | Use the following script to add a page element to a page: | ||
| | ||
- | |||
| | ||
=== Add Element Actions === | === Add Element Actions === | ||
Line 137: | Line 132: | ||
Use the following script to add an element action to an element: | Use the following script to add an element action to an element: | ||
| | ||
- | $SYS.log(' | + | $EXEC.log(' |
- | $SELENIUM.getWebDriver().findElement(elem.getLocator()).click(); | + | $VAR.webdriver.findElement(elem.getLocator()).click(); |
}) | }) | ||
Line 145: | Line 140: | ||
| | ||
def ' | def ' | ||
- | $SYS.log(' | + | $EXEC.log(' |
- | $SYS.page(' | + | $PAGE.page(' |
} | } | ||
Line 165: | Line 160: | ||
//Steps// are annotated groovy functions as follows: | //Steps// are annotated groovy functions as follows: | ||
- | | ||
- | def setBrowserType (String browserType) { | ||
- | $SELENIUM.setBrowserType(browserType); | ||
- | } | ||
- | |||
| | ||
def gotoURL (String url) { | def gotoURL (String url) { | ||
- | $SELENIUM.getWebDriver().get(url); | + | $VAR.webdriver.get(url); |
} | } | ||
| | ||
def loginAs (String userid, String password) { | def loginAs (String userid, String password) { | ||
- | $SELENIUM.getWebDriver().findElement(By.id(' | + | $VAR.webdriver.findElement(By.id(' |
- | $SELENIUM.getWebDriver().findElement(By.id(' | + | $VAR.webdriver.findElement(By.id(' |
} | } | ||
Line 188: | Line 178: | ||
//MCASE Script// is where //MCase// are defined. | //MCASE Script// is where //MCase// are defined. | ||
- | // | + | Often times you may have a set of specific test scenarios you want to make sure are covered to complement the system generated test cases. |
Consider your model as a map to //GPS//, //MCase// is just a set of way points you want to visit. When you execute //MCase//, a sequence | Consider your model as a map to //GPS//, //MCase// is just a set of way points you want to visit. When you execute //MCase//, a sequence | ||
- | $SYS.getMCaseMgr().addMCase(' | + | $MCASE.addMCase(' |
- | $SYS.getMCaseMgr().addMCase(' | + | $MCASE.addMCase(' |
In additional to follow through path and execute the automation script (// | In additional to follow through path and execute the automation script (// | ||
Line 201: | Line 191: | ||
---- | ---- | ||
==== User Script ==== | ==== User Script ==== | ||
- | Besides [[#TRIGGER Script]], [[#PAGES Sript]] | + | Besides [[#TRIGGER Script]], [[#PAGES Sript]], [[# |
To create a user script, click on " | To create a user script, click on " | ||
Line 217: | Line 207: | ||
| | ||
def ' | def ' | ||
- | $SYS.log(' | + | $EXEC.log(' |
- | $SYS.log(' | + | $EXEC.log(' |
} | } | ||
+ | |||
+ | ---- | ||
+ | ==== Include File ==== | ||
+ | You may include script file into your TRIGGER script. | ||
+ | | ||
+ | |||
+ | The above script will literally inject the content of the included file into current script before TRIGGER script is executed. | ||
+ | |||
+ | The side effect of using this INCLUDE_FILE is that the injected scripts will mess up the script line # reported on errors. | ||
---- | ---- |