Tests are composed of a list of actions - commands to tell the browser what to do and assertions to check for. For example, a simple test may say:
This test is composed of 3 actions. If this test succeeds, you can by nature assert these things: The page exists and works, an element exists, and a link exists and can be clicked.
Most actions can be executed within the extension, but due to Chrome extension limitations, some actions can only be "automated" by running the generated Selenium code (iFrames, window context switching, drag and drop).
If an action turns "yellow" in the extension, it means that it is a Selenium only action and will need to be manually executed in the extension.
Currently, when you toggle the timeout between custom and global, it applies the global to the custom value afterwards.
It's possible to restore the old value, but you'll have to remember what you put before and input it manually.
This shouldn't be an issue if you're setting the custom timeout once.
A few uses cases for custom timeouts are:
SnapTest strives to give its users the ability to generate entire projects in various frameworks, which should just work without requiring you to adjust your tests for other frameworks.
In order to do this, project/code generators must meet the Generator Action Contract so that the Selenium playback matches the extension playback. For a generator to be considered a "Full-project generator", it must fulfill the following action specifications at 100%:
Each action is defined by a JSON array entry. Each action has:
Action: | Type: | Spec: | Variables: | Automated in: |
---|---|---|---|---|
Load Page | FULL_PAGELOAD | Perform a GET request at the url value and sets window dimensions to width & height . |
| Snaptest/Selenium |
Back | BACK | Performs a "back" operation, same as clicking the back button in a browser. | None | Snaptest/Selenium |
Forward | FORWARD | Performs a "forward" operation, same as clicking the foward button in a browser. | None | Snaptest/Selenium |
Refresh | REFRESH | Performs a soft "refresh" operation, meaning no cache's are getting cleared. | None | Snaptest/Selenium |
Focus window | CHANGE_WINDOW | Changes the test "focus" or "context" to index value . Initial tab/window is 0, and any additional windows are incrementally numbered by the order they're opened. |
| Selenium-only |
Action: | Type: | Spec: | Variables: | Automated in: |
---|---|---|---|---|
Click element | MOUSEDOWN | 1. Check that an element at selector exists. Retry every second for total amount of timeout ms.2. performs a full click on that element. |
| Snaptest/Selenium |
Press key... | KEYDOWN | 1. Check that an element at selector exists. Retry every second for total amount of timeout ms.2. Sends a key press signal to an element with the keyValue keycode. |
| Selenium-only |
Change input... | INPUT | 1. Check that an element at selector exists. Retry every second for total amount of timeout ms.2. Fully replace the element's value with value . |
| Snaptest/Selenium |
Form submit | SUBMIT | 1. Check that an element at selector exists. Retry every second for total amount of timeout ms.2. Triggers the form submit functionality on a form. Can be triggered via JS or focusing and clicking "Enter". |
| Snaptest/Selenium |
Mouse over | MOUSEOVER | 1. Check that an element at selector exists. Retry every second for total amount of timeout ms.2. Simulate a user mousing over the element. |
| Selenium-only |
Focus | FOCUS | 1. Check that an element at selector exists. Retry every second for total amount of timeout ms.2. Perform a focus on the element. |
| Snaptest/Selenium |
Blur | BLUR | 1. Check that an element at selector exists. Retry every second for total amount of timeout ms.2. Perform a blur off of the element. |
| Snaptest/Selenium |
Pause | PAUSE | Pause test execution for value amount of milliseconds. |
| Snaptest/Selenium |
Execute script | EXECUTE_SCRIPT | Inject and execute the script string in the page. May return true or false for asserting. If returns false , it should fail as an assertion. |
| Snaptest/Selenium |
Clear cookies | CLEAR_COOKIES | Clear the cookies at domain value . value must be a fully qualified url with protocol. |
| Snaptest/Selenium |
Action: | Type: | Spec: | Variables: | Automated in: |
---|---|---|---|---|
Scroll win(dow) to... | SCROLL_WINDOW | Scroll the window to the x and y coordinates. Should trigger "onscroll" events. |
| Snaptest/Selenium |
Scroll win(dow) to el(ement)... | SCROLL_WINDOW_ELEMENT | 1. Check that an element at selector exists. Retry every second for total amount of timeout ms.2. Scroll the window to the element. |
| Snaptest/Selenium |
Scroll el(ement) to... | SCROLL_ELEMENT | 1. Check that an element at selector exists. Retry every second for total amount of timeout ms.2. Scroll an element to the x / y position. |
| Snaptest/Selenium |
Action: | Type: | Spec: | Variables: | Automated in: |
---|---|---|---|---|
El is present | EL_PRESENT_ASSERT | 1. Check that an element at selector exists. Retry every second for total amount of timeout ms. |
| Snaptest/Selenium |
El isn't present | EL_NOT_PRESENT_ASSERT | 1. Check that an element at selector doesn't exist. Retry every second for total amount of timeout ms. |
| Snaptest/Selenium |
El text is... | TEXT_ASSERT | 1. Check that an element at selector exists. Retry every second for total amount of timeout ms.2. If regex is false , then check for the element's text to equal value . retry every second for the remaining timeout value.3. If regex is true , then check for the element's text to test positive against the regex (/value /g). |
| Snaptest/Selenium |
Input value is... | VALUE_ASSERT | 1. Check that an element at selector exists. Retry every second for total amount of timeout ms.2. If regex is false , then check for the inputs's value to equal value . retry every second for the remaining timeout value.3. If regex is true , then check for the input's value to test positive against the regex (/value /g). |
| Snaptest/Selenium |
Path is... | PATH_ASSERT | Note: "Path" refers "/hello" in "https://www.wowow.com/hello?cool=neat#awesome" 1. DOM is ready. Retry every second for total amount of timeout ms.2. If regex is false , then check for the path's value to equal value . retry every second for the remaining timeout value.3. If regex is true , then check for the path's value to test positive against the regex (/value /g). |
| Snaptest/Selenium |
Action: | Type: | Spec: | Variables: | Automated in: |
---|---|---|---|---|
Component | COMPONENT | Call the component of componentId from the component pool. When calling the component, pass in the variable array as the method arguments. |
| Snaptest/Selenium |
Url change indicator | URL_CHANGE_INDICATOR | A non-functional "flag" that helps in the generation of code and visual clarity in the snaptest tool. |
| Snaptest/Selenium |
Take screenshot | SCREENSHOT | Take a screenshot and save it with the filename value in the default/configured location. |
| Selenium-only |