简体   繁体   English

使用编码的UI自动执行针对角度SPA(单页应用程序)的UI测试时,单击主页上的图标不起作用

[英]While automating UI tests for angular SPA (Single Page Application) using Coded UI, clicking icons on home page does not work

I am working to automate UI/acceptance tests for an angular SPA (Single Page Application) using Coded UI. 我正在使用编码的UI自动执行角度SPA(单页应用程序)的UI /接受测试。

The client side is completely developed on Angular and Bootstrap. 客户端是完全在Angular和Bootstrap上开发的。 We also use kendo controls like kendo grid. 我们还使用剑道网格之类的剑道控件。 We use the 'UI-Router' framework built in Angular for routing. 我们使用Angular中内置的“ UI-Router”框架进行路由。

To automate a sample test case - “Open DataTable app from Home page” using Coded UI, following are the steps: 1) Open IE and go to WebConsole home page 2) Identify DataTable icon. 要自动化示例测试用例-使用编码的UI“从主页打开DataTable应用程序”,请执行以下步骤:1)打开IE并转到WebConsole主页2)识别DataTable图标。 3) Click on the icon. 3)点击图标。 4) Validate DataTable app. 4)验证DataTable应用。

I am able to automate steps 1-3, but after clicking on the DataTable icon, the DataTable app is not being displayed. 我能够自动执行第1-3步,但是在单击DataTable图标后,不会显示DataTable应用。 The UI still shows the Home page. UI仍显示主页。

We tried clicking the DataTable icon manually during the test run to see whether the click is working and it did not work. 我们尝试在测试运行期间手动单击“数据表”图标,以查看该单击是否有效和无效。

I tried searching on web about this but could not find anything useful. 我尝试在网上搜索有关此内容的信息,但找不到任何有用的信息。

Any pointer in this regard will be helpful. 在这方面的任何指针都将有所帮助。

Potential options I use for finicky controls 我用于挑剔控件的潜在选项

using mshtml;
var htmlHtmlElement = yourControl.NativeElement as HTMLHtmlElement;
if (htmlHtmlElement != null)
{
     htmlHtmlElement.click();
}

Or 要么

control.RunScript("arguments[0].click();");
// Extension class
private static object RunScript(this HtmlControl control, string script)
{
    var bw = control.TopParent as BrowserWindow;
    return bw.ExecuteScript(script, control);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM