Skip to content
Snippets Groups Projects

Feature/expert model

Files

import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
import { browser, ExpectedConditions, logging } from 'protractor';
describe('workspace-project App', () => {
let page: AppPage;
@@ -13,6 +13,62 @@ describe('workspace-project App', () => {
expect(await page.getNavbarBrand()).toEqual('BMDL Feature Modeler');
});
describe('when adding an expert model', () => {
beforeAll(async () => {
page = new AppPage();
await page.navigateTo();
await page.expertModelList.modelNameInput.sendKeys('Test Model');
await page.expertModelList.modelDescriptionInput.sendKeys('Test Description');
await page.expertModelList.submitButton.click();
await browser.wait(ExpectedConditions.presenceOf(page.expertModelList.listItems.first()));
});
beforeEach(async () => await page.navigateTo());
it('should be displayed', async () => {
await browser.wait(ExpectedConditions.presenceOf(page.expertModelList.listItems.first()));
expect(await page.expertModelList.listItems.count()).toBe(1);
expect(await page.expertModelList.getListItem(0).title.getText()).toBe('Test Model');
expect(await page.expertModelList.getListItem(0).description.getText()).toBe('Test Description');
});
it('should be able to navigate to view page', async () => {
await browser.wait(ExpectedConditions.presenceOf(page.expertModelList.listItems.first()));
await page.expertModelList.getListItem(0).viewButton.click();
expect(await browser.getCurrentUrl()).toContain('featuremodelview');
});
it('should be able to navigate to edit page', async () => {
await browser.wait(ExpectedConditions.presenceOf(page.expertModelList.listItems.first()));
await page.expertModelList.getListItem(0).editButton.click();
expect(await browser.getCurrentUrl()).toContain('featuremodel');
});
describe('and deleting', async () => {
beforeAll(async () => {
await page.navigateTo();
await browser.wait(ExpectedConditions.presenceOf(page.expertModelList.listItems.first()));
await page.expertModelList.getListItem(0).deleteButton.click();
await browser.wait(ExpectedConditions.not(ExpectedConditions.presenceOf(page.expertModelList.listItem)));
});
it('should be gone', async () => {
expect(await page.expertModelList.listItems.count()).toBe(0);
});
});
afterAll(async () => {
await browser.executeScript('window.localStorage.clear();');
await browser.executeScript('window.sessionStorage.clear();');
await browser.executeScript('window.indexedDB.deleteDatabase("_pouch_bmdl-feature-modeler");');
await browser.driver.manage().deleteAllCookies();
});
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
Loading