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

Skip to content
Snippets Groups Projects
administration.spec.ts 2.44 KiB
Newer Older
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed
import { browser, element, by, ExpectedConditions as ec } from 'protractor';

import { NavBarPage, SignInPage } from '../page-objects/jhi-page-objects';

const expect = chai.expect;

describe('administration', () => {
  let navBarPage: NavBarPage;
  let signInPage: SignInPage;
Michael Breu's avatar
Michael Breu committed
  const username = process.env.E2E_USERNAME ?? 'admin';
  const password = process.env.E2E_PASSWORD ?? 'admin';
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed

  before(async () => {
    await browser.get('/');
    navBarPage = new NavBarPage(true);
    signInPage = await navBarPage.getSignInPage();
    await signInPage.autoSignInUsing(username, password);
    await browser.wait(ec.visibilityOf(navBarPage.adminMenu), 5000);
  });

  beforeEach(async () => {
    await navBarPage.clickOnAdminMenu();
  });

  it('should load user management', async () => {
    await navBarPage.clickOnAdmin('user-management');
    const expect1 = 'userManagement.home.title';
    const value1 = await element(by.id('user-management-page-heading')).getAttribute('jhiTranslate');
    expect(value1).to.eq(expect1);
  });

  it('should load metrics', async () => {
    await navBarPage.clickOnAdmin('metrics');
Michael Breu's avatar
Michael Breu committed
    const heading = element(by.id('metrics-page-heading'));
    await browser.wait(ec.visibilityOf(heading), 10000);
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed
    const expect1 = 'metrics.title';
Michael Breu's avatar
Michael Breu committed
    const value1 = await heading.getAttribute('jhiTranslate');
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed
    expect(value1).to.eq(expect1);
  });

  it('should load health', async () => {
    await navBarPage.clickOnAdmin('health');
Michael Breu's avatar
Michael Breu committed
    const heading = element(by.id('health-page-heading'));
    await browser.wait(ec.visibilityOf(heading), 10000);
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed
    const expect1 = 'health.title';
Michael Breu's avatar
Michael Breu committed
    const value1 = await heading.getAttribute('jhiTranslate');
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed
    expect(value1).to.eq(expect1);
  });

  it('should load configuration', async () => {
    await navBarPage.clickOnAdmin('configuration');
Michael Breu's avatar
Michael Breu committed
    const heading = element(by.id('configuration-page-heading'));
    await browser.wait(ec.visibilityOf(heading), 10000);
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed
    const expect1 = 'configuration.title';
Michael Breu's avatar
Michael Breu committed
    const value1 = await heading.getAttribute('jhiTranslate');
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed
    expect(value1).to.eq(expect1);
  });

  it('should load logs', async () => {
    await navBarPage.clickOnAdmin('logs');
Michael Breu's avatar
Michael Breu committed
    const heading = element(by.id('logs-page-heading'));
    await browser.wait(ec.visibilityOf(heading), 10000);
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed
    const expect1 = 'logs.title';
Michael Breu's avatar
Michael Breu committed
    const value1 = await heading.getAttribute('jhiTranslate');
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed
    expect(value1).to.eq(expect1);
  });

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