How do I playback a right-click user action in SOAtest?

LegacyForumLegacyForum Posts: 1,669 ✭✭
edited December 2016 in SOAtest
Hello Everyone,

The purpose of this topic is to explain how playback support for a right-click user action can be integrated into web functional scenarios SOAtest.

Here are the steps to follow...

1) With SOAtest closed, navigate to the following directories...

[SOAtest_install_directory]\plugins\com.parasoft.xtest.libs.web_[version]\root\browsers\ie

[SOAtest_install_directory]\plugins\com.parasoft.xtest.libs.web_[version]\root\browsers\ff\extensions\wk@parasoft.com\chrome\content

2) Within each of these directories, open the "UserCustomizableOptions.js" file

3) Add the following code snippet to both of the above files...

CODE
// CODE START
_wk_BrowserDriver.prototype.doContextMenu = function(locator) {
var element = this.findElement(locator);
_wk_HTMLUtil.triggerMouseEvent(element, 'contextmenu', true);
};
// CODE END


4) Save and close both files

5) Open SOAtest and record all web functional tests as normal (including the right-click user action)

Note: A click user action test is generated for the element that appears in the right-click menu.

6) Add a new browser testing tool test before the aforementioned click user action test and configure the test as follows...

Under the "User Action" tab...

i) For "Action", select "Other"

ii) In the "Action" field, type "ContextMenu"

iii) Under the "Element Locator" section, use the element properties for the target element of the right-click user action

Note: If unsure of the element properties, simply switch to the "Pre-Action Browser Contents" tab, right-click the desired element, and select "Modify Other Action to Use [element_name] Element".

7) Save the test

Now the web functional scenario with the right-click user action should playback successfully.

Note: The actual menu that should appear when right-clicking the target element may not appear during playback. However, the right-click user action should be performed anyways and all tests should succeed.

Enjoy!

Regards,
Adam
Tagged:
Sign In or Register to comment.