我正在尝试根据 https://devexpress.github.io/testcafe/documentation/test-api/authentication/user-roles.html 在 TC 中使用使用角色
在我看来,一切都很好,但我收到了 错误指定的全局模式与任何文件都不匹配或默认测试目录为空。
我不明白为什么。有人能指出错误在哪里吗?
> import { ClientFunction } from 'testcafe';
> // take url import config from './Config/config';
> import loginPage from './POM_LoginPage';
> import Elements from './POM_Elements';
>import {Role} from 'testcafe'
>
>
> let l1 = require('./support/global').log[1];
>
> const SuperUser = Role(`${config.baseUrl}`, async t => {
> //Log in as superuser
>
> await loginPage.logIn(l1.username, l1.password)
>
> });
>
> ixture`SanityTests`
> .beforeEach(async t => {
> await t.maximizeWindow() })
> .page`${config.baseUrl}`;
>
>
> test('Navigation to the Users components', async t => {
>
> //Log in
>
> await t.useRole(SuperUser);
>
> //Go to the "other page"
>
> await t.click(Elements.navDropdown);
> await t.click(Elements.usersButton);
>
> const users= ClientFunction(() => window.location.href)
> await
> t.expect(users()).contains(`${config.Url}`);
> })
最佳答案
此问题与 Roles 无关特征。错误消息表明您为执行的测试指定了错误的全局路径模式。检查指定的路径值是否与任何测试匹配。 欲了解更多信息,请参阅Runner.src方法说明。
关于automated-tests - TestCafe:用户角色 - 错误指定的 glob 模式与任何文件都不匹配或默认测试目录为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59307565/