Newer
Older

Michael Breu
committed
import { browser, ExpectedConditions as ec, promise } from 'protractor';
import { NavBarPage, SignInPage } from '../../page-objects/jhi-page-objects';
import { StatisticsComponentsPage, StatisticsDeleteDialog, 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;
let statisticsDeleteDialog: StatisticsDeleteDialog;
const username = process.env.E2E_USERNAME ?? 'admin';
const password = process.env.E2E_PASSWORD ?? 'search@admin';

Michael Breu
committed
before(async () => {
await browser.get('/');
navBarPage = new NavBarPage();
signInPage = await navBarPage.getSignInPage();

Michael Breu
committed
await browser.wait(ec.visibilityOf(navBarPage.entityMenu), 5000);
// await navBarPage.clickOnEntityMenu();

Michael Breu
committed
});
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();
});
// it('should create and save Statistics', async () => {
// const nbButtonsBeforeCreate = await statisticsComponentsPage.countDeleteButtons();

Michael Breu
committed
// await statisticsComponentsPage.clickOnCreateButton();

Michael Breu
committed
// await promise.all([
// statisticsUpdatePage.setViewsInput('5'),
// statisticsUpdatePage.setDownloadsInput('5'),
// statisticsUpdatePage.setExerciseIDInput('5'),
// ]);

Michael Breu
committed
// expect(await statisticsUpdatePage.getViewsInput()).to.eq('5', 'Expected views value to be equals to 5');
// expect(await statisticsUpdatePage.getDownloadsInput()).to.eq('5', 'Expected downloads value to be equals to 5');
// expect(await statisticsUpdatePage.getExerciseIDInput()).to.eq('5', 'Expected exerciseID value to be equals to 5');

Michael Breu
committed
// await statisticsUpdatePage.save();
// expect(await statisticsUpdatePage.getSaveButton().isPresent(), 'Expected save button disappear').to.be.false;

Michael Breu
committed
// expect(await statisticsComponentsPage.countDeleteButtons()).to.eq(nbButtonsBeforeCreate + 1, 'Expected one more entry in the table');
// });

Michael Breu
committed
// it('should delete last Statistics', async () => {
// const nbButtonsBeforeDelete = await statisticsComponentsPage.countDeleteButtons();
// browser.executeScript('window.scrollTo(0,document.body.scrollHeight)');
// await statisticsComponentsPage.clickOnLastDeleteButton();

Michael Breu
committed
// statisticsDeleteDialog = new StatisticsDeleteDialog();
// expect(await statisticsDeleteDialog.getDialogTitle()).to.eq('gitsearchApp.statistics.delete.question');
// await statisticsDeleteDialog.clickOnConfirmButton();

Michael Breu
committed
// expect(await statisticsComponentsPage.countDeleteButtons()).to.eq(nbButtonsBeforeDelete - 1);
// });

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