useRole:纱线开始=通过,纱线建立=失败

时间:2020-03-04 09:47:03

标签: testing automation automated-tests e2e-testing testcafe

import { Role } from 'testcafe';

const admin = Role('http://localhost:3000' ,async t => {    // port: 5000 when yarn build
  await t
      .typeText('#login', 'admin')
      .typeText('#password', '923878')
      .click('#submit-button')
}
 , { preserveUrl: true }
); 

fixture `Test for profile`;

test('Test for user name', async t => {
    await t
      .useRole(admin)
      .click('#avatar')
      .expect('#user-name').eql('admin');
  }); 

如果我使用“ yarn start”,则此测试:

  1. 打开页面。
  2. 已授权。
  3. 刷新页面。
  4. 逐步走动。

如果我使用“ yarn build”,请执行以下测试:

  1. 打开页面。
  2. 已授权。
  3. 刷新页面。
  4. 显示主页。
  5. 用户尚未登录。

0 个答案:

没有答案