@theia-extension-tester/tests
Version:
Tests for theia-extension-tester package.
89 lines • 3.77 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");
describe('ViewSection', function () {
this.timeout(40000);
let workbench;
let view;
let content;
let control;
let section;
const title = 'Watch';
before(function () {
return __awaiter(this, void 0, void 0, function* () {
workbench = new page_objects_1.Workbench();
control = (yield workbench.getActivityBar().getViewControl('Debug'));
view = yield control.openView();
content = view.getContent();
section = yield content.getSection(title);
});
});
beforeEach(function () {
return __awaiter(this, void 0, void 0, function* () {
yield section.expand();
});
});
after(function () {
return __awaiter(this, void 0, void 0, function* () {
yield control.closeView();
});
});
it('getTitle', function () {
return __awaiter(this, void 0, void 0, function* () {
chai_1.expect(yield section.getTitle()).equals(title);
});
});
it('expand', function () {
return __awaiter(this, void 0, void 0, function* () {
yield section.collapse();
chai_1.expect(yield section.isExpanded()).to.be.false;
yield section.expand();
chai_1.expect(yield section.isExpanded()).to.be.true;
yield section.collapse();
chai_1.expect(yield section.isExpanded()).to.be.false;
});
});
it('collapse', function () {
return __awaiter(this, void 0, void 0, function* () {
yield section.expand();
chai_1.expect(yield section.isExpanded()).to.be.true;
yield section.collapse();
chai_1.expect(yield section.isExpanded()).to.be.false;
});
});
it('isExpanded', function () {
return __awaiter(this, void 0, void 0, function* () {
yield section.expand();
chai_1.expect(yield section.isExpanded()).to.be.true;
yield section.collapse();
chai_1.expect(yield section.isExpanded()).to.be.false;
});
});
it('getActions', function () {
return __awaiter(this, void 0, void 0, function* () {
yield section.expand();
yield section.getAction('Collapse All');
const actions = yield section.getActions();
const titles = yield Promise.all(actions.map(action => action.getLabel()));
chai_1.expect(titles).include.members(['Add Expression', 'Collapse All', 'Remove All Expressions']);
});
});
it('getAction', function () {
return __awaiter(this, void 0, void 0, function* () {
yield section.expand();
const action = yield section.getAction('Collapse All');
chai_1.expect(yield action.getLabel()).equals('Collapse All');
});
});
});
//# sourceMappingURL=ViewSection.test.js.map