是否有一种方法可以让sso使用testcafe登录?

问题描述 投票:2回答:1

对于端到端测试,我希望Testcafe使用SSO登录到我们的SaaS应用程序(就像用户会做的那样)。为此,Testcafe需要通过我们的ZScaler代理,然后使用当前登录用户的凭据登录到应用程序。

[每当我使用自己的浏览器执行此操作时,效果都很好,但是由于某种原因,Testcafe试图访问该页面时会卡住。]

我已经尝试使用Testcafe提供的授权选项来使其正常工作,但是似乎都不起作用。

import { Selector, ClientFunction } from 'testcafe';

const getLocation = ClientFunction(() => document.location.href);

fixture("Close ADFS")
    .httpAuth({
      username: 'username',
      password: 'password'
    });

test('My first test', async t => {
  await t
    .navigateTo("url of web application")
    .expect(getLocation()).contains("url of web application")
    .expect(Selector("css selector that is in the application").exists).ok("Application not reached")
});

[每次运行测试时,都会出现以下错误:

× My first test

1) AssertionError: expected 'about:error' to include 'url of web application'

Browser: Chrome 77.0.3865 / Windows 10.0.0

   9 |    });
  10 |
  11 |test('My first test', async t => {
  12 |  await t
  13 |    .navigateTo("url of web application")
> 14 |    .expect(getLocation()).contains("url of web application")
  15 |    .expect(Selector("css selector that is in the application").exists).ok("Application not reached")
  16 |});

at contains (C:\Users\M63G736\Projects\testcafe-adfs\test.js:14:28)
at <anonymous> (C:\Users\M63G736\Projects\testcafe-adfs\test.js:11:1)
at <anonymous> (C:\Users\M63G736\Projects\testcafe-adfs\node_modules\testcafe\src\api\wrap-test-function.js:17:28)
at TestRun._executeTestFn (C:\Users\M63G736\Projects\testcafe-adfs\node_modules\testcafe\src\test-run\index.js:289:19)
at TestRun.start (C:\Users\M63G736\Projects\testcafe-adfs\node_modules\testcafe\src\test-run\index.js:338:24)


2) A request to "url of web application" has failed.
Use quarantine mode to perform additional attempts to execute this test.
You can find troubleshooting information for this issue at "https://go.devexpress.com/TestCafe_FAQ_ARequestHasFailed.aspx".

Error details:
Failed to find a DNS-record for the resource at "url of web application".

Browser: Chrome 77.0.3865 / Windows 10.0.0

有人可以告诉我用Testcafe是否可以做到这一点?如果是这样,您能告诉使用什么配置/代码吗?

对于端到端测试,我希望Testcafe使用SSO登录到我们的SaaS应用程序(就像用户会做的那样)。为此,Testcafe需要通过我们的ZScaler代理,然后登录到...

adfs testcafe zscaler
1个回答
0
投票

这表示浏览器无法加载“ Web应用程序的URL” URL。确保可以从执行测试的计算机上访问Web应用程序。

© www.soinside.com 2019 - 2024. All rights reserved.