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

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

Eduard Frankford's avatar
Eduard Frankford committed
import { LikesComponentsPage, LikesUpdatePage } from './likes.page-object';
Eduard Frankford's avatar
Eduard Frankford committed

const expect = chai.expect;

describe('Likes e2e test', () => {
  let navBarPage: NavBarPage;
  let signInPage: SignInPage;
  let likesComponentsPage: LikesComponentsPage;
  let likesUpdatePage: LikesUpdatePage;
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

  before(async () => {
    await browser.get('/');
Eduard Frankford's avatar
Eduard Frankford committed
    await browser.sleep(2000);
Eduard Frankford's avatar
Eduard Frankford committed
    navBarPage = new NavBarPage();
    signInPage = await navBarPage.getSignInPage();
Eduard Frankford's avatar
Eduard Frankford committed
    await signInPage.autoSignInUsing(username, password);
Eduard Frankford's avatar
Eduard Frankford committed
    await browser.wait(ec.visibilityOf(navBarPage.entityMenu), 5000);
Eduard Frankford's avatar
Eduard Frankford committed
    await browser.sleep(1000);
Eduard Frankford's avatar
Eduard Frankford committed
  });

  it('should load Likes', async () => {
    await navBarPage.goToEntity('likes');
    likesComponentsPage = new LikesComponentsPage();
    await browser.wait(ec.visibilityOf(likesComponentsPage.title), 5000);
    expect(await likesComponentsPage.getTitle()).to.eq('gitsearchApp.likes.home.title');
    await browser.wait(ec.or(ec.visibilityOf(likesComponentsPage.entities), ec.visibilityOf(likesComponentsPage.noResult)), 10000);
Eduard Frankford's avatar
Eduard Frankford committed
  });

  it('should load create Likes page', async () => {
    await likesComponentsPage.clickOnCreateButton();
    likesUpdatePage = new LikesUpdatePage();
    expect(await likesUpdatePage.getPageTitle()).to.eq('gitsearchApp.likes.home.createOrEditLabel');
    await likesUpdatePage.cancel();
  });

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