UNPKG

@theia-extension-tester/tests

Version:

Tests for theia-extension-tester package.

173 lines 8.82 kB
"use strict"; 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('Input', function () { this.timeout(40000); let input; beforeEach(function () { return __awaiter(this, void 0, void 0, function* () { yield new page_objects_1.TitleBar().select('View', 'Find Command...'); input = yield page_objects_1.Input.create(); }); }); it('Input.create', function () { return __awaiter(this, void 0, void 0, function* () { yield input.cancel(); yield new page_objects_1.TitleBar().select('View', 'Find Command...'); input = yield page_objects_1.Input.create(); chai_1.expect(yield input.isDisplayed()).to.be.true; }); }); afterEach(function () { return __awaiter(this, void 0, void 0, function* () { yield input.cancel(); }); }); it('Input.cancel', function () { return __awaiter(this, void 0, void 0, function* () { this.timeout(80000); yield input.setText('>Paste'); yield input.cancel(); chai_1.expect(yield input.isDisplayed()).to.be.false; }); }); it('Complex setText', function () { return __awaiter(this, void 0, void 0, function* () { const values = ['Hello', 'World', 'azazaza', 'experiment', 'lorem ipsum lorem']; yield input.clear(); let previousValue = ''; for (const value of values) { chai_1.expect(yield input.getText()).equals(previousValue); yield input.setText(value); previousValue = value; chai_1.expect(yield input.getText()).equals(value); } }); }); it('Input.findQuickPick', function () { return __awaiter(this, void 0, void 0, function* () { const pick = yield input.findQuickPick('Paste'); chai_1.expect(pick).not.to.be.undefined; chai_1.expect(yield pick.getLabel()).to.equal('Paste'); }); }); it('Input.findQuickPick - index', function () { return __awaiter(this, void 0, void 0, function* () { let pick = yield input.findQuickPick(100); chai_1.expect(pick).not.to.be.undefined; chai_1.expect(yield pick.getIndex()).to.equal(100); pick = yield input.findQuickPick(30); chai_1.expect(pick).not.to.be.undefined; chai_1.expect(yield pick.getIndex()).to.equal(30); }); }); it('Input.selectQuickPick', function () { return __awaiter(this, void 0, void 0, function* () { yield input.selectQuickPick('Cut'); }); }); it('Input.getPlaceHolder', function () { return __awaiter(this, void 0, void 0, function* () { yield input.clear(); chai_1.expect(yield input.getPlaceHolder()).equals("File name to search (append : to go to line). (Press Ctrl+P to show/hide ignored files)"); }); }); it('Input.hasProgress', function () { return __awaiter(this, void 0, void 0, function* () { yield input.getDriver().wait(() => __awaiter(this, void 0, void 0, function* () { return (yield input.hasProgress()) === false; }), this.timeout() - 2000); }); }); it('Input.getQuickPicks', function () { return __awaiter(this, void 0, void 0, function* () { chai_1.expect(yield input.getQuickPicks()).not.empty; }); }); it('Input.setText', function () { return __awaiter(this, void 0, void 0, function* () { yield input.setText('Hello world'); }); }); it('Input.getText', function () { return __awaiter(this, void 0, void 0, function* () { yield input.setText('Hello world'); chai_1.expect(yield input.getText()).to.equal('Hello world'); }); }); it('Input.clear', function () { return __awaiter(this, void 0, void 0, function* () { yield input.setText('Hello world'); yield input.clear(); chai_1.expect(yield input.getText()).to.be.empty; }); }); it('Input.confirm', function () { return __awaiter(this, void 0, void 0, function* () { yield input.setText('>Paste'); yield input.confirm(); yield input.getDriver().wait(page_objects_1.until.elementIsNotVisible(input), this.timeout() - 2000); }); }); it.skip('Input.getTitle', function () { return __awaiter(this, void 0, void 0, function* () { this.timeout(120000); yield new page_objects_1.Workbench().executeCommand('Quarkus: Generate a Quarkus project'); yield input.getDriver().wait(() => __awaiter(this, void 0, void 0, function* () { return (yield input.getPlaceHolder()) === 'Pick build tool'; }), this.timeout() - 2000); chai_1.expect(yield input.getTitle()).equals('Quarkus Tools (1/8)'); }); }); it.skip('Input.back', function () { return __awaiter(this, void 0, void 0, function* () { this.timeout(80000); yield new page_objects_1.Workbench().executeCommand('Quarkus: Generate a Quarkus project'); yield input.getDriver().wait(() => __awaiter(this, void 0, void 0, function* () { return (yield input.getPlaceHolder()) === 'Pick build tool'; }), this.timeout() - 2000); yield input.confirm(); yield input.getDriver().wait(() => __awaiter(this, void 0, void 0, function* () { return (yield input.getTitle()) === 'Quarkus Tools (2/8)'; }), this.timeout() - 2000); yield input.back(); yield input.getDriver().wait(() => __awaiter(this, void 0, void 0, function* () { return (yield input.getTitle()) === 'Quarkus Tools (1/8)'; }), this.timeout() - 2000); }); }); it.skip('Input.hasError', function () { return __awaiter(this, void 0, void 0, function* () { this.timeout(80000); yield new page_objects_1.Workbench().executeCommand('Quarkus: Generate a Quarkus project'); yield input.getDriver().wait(() => __awaiter(this, void 0, void 0, function* () { return (yield input.getPlaceHolder()) === 'Pick build tool'; }), this.timeout() - 2000); yield input.setText('Maven'); yield input.confirm(); yield input.getDriver().wait(() => __awaiter(this, void 0, void 0, function* () { return (yield input.getTitle()) === 'Quarkus Tools (2/8)'; }), this.timeout() - 2000); chai_1.expect(yield input.hasError()).to.be.false; yield input.setText('/'); yield input.getDriver().wait(() => __awaiter(this, void 0, void 0, function* () { return yield input.hasError(); }), this.timeout() - 2000); }); }); it.skip('Input.getMessage', function () { return __awaiter(this, void 0, void 0, function* () { this.timeout(80000); yield new page_objects_1.Workbench().executeCommand('Quarkus: Generate a Quarkus project'); yield input.getDriver().wait(() => __awaiter(this, void 0, void 0, function* () { return (yield input.getPlaceHolder()) === 'Pick build tool'; }), this.timeout() - 2000); yield input.setText('Maven'); yield input.confirm(); try { yield input.getDriver().wait(() => __awaiter(this, void 0, void 0, function* () { return (yield input.getMessage()) === "Your project groupId (Press 'Enter' to confirm or 'Escape' to cancel)"; }), this.timeout() - 10000); } catch (_a) { chai_1.expect(yield input.getMessage()).equals("Your project groupId (Press 'Enter' to confirm or 'Escape' to cancel)"); } }); }); it.skip('Input.isPassword', function () { return __awaiter(this, void 0, void 0, function* () { this.timeout(80000); }); }); }); //# sourceMappingURL=Input.test.js.map