当测试用例的断言失败时,跳过测试用例

时间:2020-07-13 08:38:07

标签: protractor

当期望之一失败时如何跳过测试用例1,并继续运行测试用例2和3。我尝试了量角器快速失败,但是当期望失败时它不会跳过测试用例1。

下面是我的示例代码:

fdescribe('New Theme Component Module', () => {
  let loginPage: LoginPage;
  let dashboardPage: DashboardPage;    
  let themePage: ThemePage;
  let themeNewPage: ThemeNewPage;
  const configurationManagementCredential = configurationManagement.loginCredential;
  const newTheme = configurationManagement;

  beforeAll(() => {
    loginPage = new LoginPage();
    dashboardPage = new DashboardPage();
    themePage = new ThemePage();
    themeNewPage = new ThemeNewPage();
    browser.waitForAngularEnabled(false);
    browser.manage().window().maximize();
    loginPage.navigateTo();
    loginPage.login(configurationManagementCredential.userId, configurationManagementCredential.userPass);
    browser.wait(ExpectedConditions.urlContains('http://localhost:4200/dashboard'));
    dashboardPage.clickThemeTab();
    browser.wait(ExpectedConditions.urlContains('http://localhost:4200/configuration/theme'));
  });

  it('test case 1', async () => {
    themePage.clickNewThemeButton();
    expect(await themeNewPage.isThemeNewDisplayed()).toBe(true, 'expect content of new Theme page to be displayed but it is not');
    expect(themeNewPage.isConfirmButtonEnabled()).toBe(false, 'expect Confirm button is disabled but it is not');
    themeNewPage.enterNewThemeName(newTheme.newThemeForm.themeName);
    ...
    browser.refresh();
  });

  it('test case 2', async () => {
    ...
  });

  it('test case 3', async () => {
    ...
  });
});

0 个答案:

没有答案