@theia-extension-tester/tests
Version:
Tests for theia-extension-tester package.
119 lines • 5.79 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const page_objects_1 = require("@theia-extension-tester/page-objects");
const che_browser_1 = require("@theia-extension-tester/che-browser");
describe('ActivityBar', function () {
this.timeout(40000);
let bar;
let viewControl;
let menu;
beforeEach(function () {
return __awaiter(this, void 0, void 0, function* () {
bar = new page_objects_1.ActivityBar();
yield (viewControl === null || viewControl === void 0 ? void 0 : viewControl.closeView());
yield (menu === null || menu === void 0 ? void 0 : menu.close());
viewControl = undefined;
menu = undefined;
});
});
after(function () {
return __awaiter(this, void 0, void 0, function* () {
yield (viewControl === null || viewControl === void 0 ? void 0 : viewControl.closeView());
yield (menu === null || menu === void 0 ? void 0 : menu.close());
});
});
it('getViewControl', function () {
return __awaiter(this, void 0, void 0, function* () {
viewControl = yield bar.getViewControl('Explorer');
chai_1.expect(yield viewControl.getTitle()).includes('Explorer');
const view = yield viewControl.openView();
chai_1.expect(yield view.isDisplayed()).to.be.true;
const titlePart = view.getTitlePart();
chai_1.expect(yield titlePart.isDisplayed()).to.be.true;
chai_1.expect(yield titlePart.getTitle()).includes('Explorer');
});
});
it('getViewControls', function () {
return __awaiter(this, void 0, void 0, function* () {
const controls = yield bar.getViewControls();
const titles = yield Promise.all(controls.map((control => control.getTitle())));
chai_1.expect(titles).to.include.members(['Search: Search', 'Debug']);
});
});
it('getGlobalAction', function () {
return __awaiter(this, void 0, void 0, function* () {
if (page_objects_1.SeleniumBrowser.instance instanceof che_browser_1.CheTheiaBrowser) {
const action = yield bar.getGlobalAction('Accounts');
menu = (yield action.openContextMenu());
chai_1.expect(yield menu.getItems()).length(1);
}
else {
const action = yield bar.getGlobalAction('Settings');
chai_1.expect(yield action.getTitle()).equals('Settings');
}
});
});
it('getGlobalActions', function () {
return __awaiter(this, void 0, void 0, function* () {
const actions = yield bar.getGlobalActions();
const titles = yield Promise.all(actions.map((action => action.getTitle())));
let expectedTitles = [];
if (page_objects_1.SeleniumBrowser.instance instanceof che_browser_1.CheTheiaBrowser) {
expectedTitles = ['Accounts', 'Settings'];
}
else {
expectedTitles = ['Settings'];
}
chai_1.expect(titles).to.include.members(expectedTitles);
});
});
it('openContextMenu', function () {
return __awaiter(this, void 0, void 0, function* () {
chai_1.expect(() => bar.openContextMenu()).throws();
});
});
describe('ViewControl', function () {
this.timeout(40000);
it('openView', function () {
return __awaiter(this, void 0, void 0, function* () {
viewControl = yield bar.getViewControl('Debug');
const view = yield viewControl.openView();
chai_1.expect(yield view.getTitlePart().getTitle()).equals('Debug');
});
});
it('closeView', function () {
return __awaiter(this, void 0, void 0, function* () {
viewControl = yield bar.getViewControl('Debug');
yield viewControl.openView();
chai_1.expect(yield page_objects_1.SideBarView.isOpen()).equals(true);
yield viewControl.closeView();
chai_1.expect(yield page_objects_1.SideBarView.isOpen()).equals(false);
});
});
it('getTitle', function () {
return __awaiter(this, void 0, void 0, function* () {
viewControl = yield bar.getViewControl('Explorer');
chai_1.expect(yield viewControl.getTitle()).includes('Explorer');
});
});
it('openContextMenu', function () {
return __awaiter(this, void 0, void 0, function* () {
viewControl = yield bar.getViewControl('Explorer');
menu = (yield viewControl.openContextMenu());
const items = yield Promise.all((yield menu.getItems()).map((item) => item.getLabel()));
chai_1.expect(items).include.members(['Close', 'Close Others', 'Close All', 'Collapse']);
});
});
});
});
//# sourceMappingURL=ActivityBar.test.js.map