This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
statistics.spec.ts 1.73 KiB
Newer Older
Eduard Frankford's avatar
Eduard Frankford committed
import { browser, ExpectedConditions as ec } from 'protractor';
import { NavBarPage, SignInPage } from '../../page-objects/jhi-page-objects';

Eduard Frankford's avatar
Eduard Frankford committed
import { StatisticsComponentsPage, StatisticsUpdatePage } from './statistics.page-object';

const expect = chai.expect;

describe('Statistics e2e test', () => {
  let navBarPage: NavBarPage;
  let signInPage: SignInPage;
  let statisticsComponentsPage: StatisticsComponentsPage;
  let statisticsUpdatePage: StatisticsUpdatePage;
Eduard Frankford's avatar
Eduard Frankford committed
  const username = process.env.E2E_USERNAME ?? 'admin';
  const password = process.env.E2E_PASSWORD ?? 'search@admin';
Eduard Frankford's avatar
Eduard Frankford committed
    await browser.sleep(2000);
    navBarPage = new NavBarPage();
    signInPage = await navBarPage.getSignInPage();
Eduard Frankford's avatar
Eduard Frankford committed
    await signInPage.autoSignInUsing(username, password);
    await browser.wait(ec.visibilityOf(navBarPage.entityMenu), 5000);
  });

  it('should load Statistics', async () => {
    await navBarPage.goToEntity('statistics');
    statisticsComponentsPage = new StatisticsComponentsPage();
    await browser.wait(ec.visibilityOf(statisticsComponentsPage.title), 5000);
    expect(await statisticsComponentsPage.getTitle()).to.eq('gitsearchApp.statistics.home.title');
    await browser.wait(ec.or(ec.visibilityOf(statisticsComponentsPage.entities), ec.visibilityOf(statisticsComponentsPage.noResult)), 1000);
  });

  it('should load create Statistics page', async () => {
    await statisticsComponentsPage.clickOnCreateButton();
    statisticsUpdatePage = new StatisticsUpdatePage();
    expect(await statisticsUpdatePage.getPageTitle()).to.eq('gitsearchApp.statistics.home.createOrEditLabel');
    await statisticsUpdatePage.cancel();
  });

  after(async () => {
    await navBarPage.autoSignOut();
  });
});