UNPKG

@dhlab/e2e-autogen

Version:

Google 스프레드시트 기반 시나리오를 Playwright 테스트 스텁 코드로 자동 생성하고, 테스트 실행 결과를 다시 시트에 업데이트하는 CLI 도구

49 lines (47 loc) 2.52 kB
'use strict'; var _TestScribe_googleSpreadsheets, _TestScribe_targetDir; Object.defineProperty(exports, "__esModule", { value: true }); exports.TestScribe = void 0; const tslib_1 = require("tslib"); const ts_pattern_1 = require("ts-pattern"); const detox_template_1 = require("./detox-template"); const playwright_template_1 = require("./playwright-template"); const scenario_1 = require("./scenario"); const tcsheet_bundle_1 = require("./tcsheet-bundle"); class TestScribe { constructor(googleSpreadsheets, targetDir) { _TestScribe_googleSpreadsheets.set(this, void 0); _TestScribe_targetDir.set(this, void 0); tslib_1.__classPrivateFieldSet(this, _TestScribe_googleSpreadsheets, googleSpreadsheets, "f"); tslib_1.__classPrivateFieldSet(this, _TestScribe_targetDir, targetDir, "f"); } async generateStubFor(framework) { try { console.log("🚀 스텁 생성을 시작합니다..."); // 1. 시트별 로우 데이터 수집 -> Map<TC-x, TRow[]> const tcSheetBundle = new tcsheet_bundle_1.TCSheetBundle(tslib_1.__classPrivateFieldGet(this, _TestScribe_googleSpreadsheets, "f")); const rowsPerPrefix = await tcSheetBundle.rowsPerPrefix(); // 2. 데이터 구조화 -> Map<TC-x, TScenarioData[]> const scenario = new scenario_1.Scenario(tslib_1.__classPrivateFieldGet(this, _TestScribe_googleSpreadsheets, "f")); const scenariosPerPrefix = await scenario.scenariosPerPrefix(rowsPerPrefix); // 3. 스텁 코드 생성 (0, ts_pattern_1.match)(framework) .with("playwright", async () => { const playwrightTemplate = new playwright_template_1.PlaywrightTemplate(scenariosPerPrefix); await playwrightTemplate.write(tslib_1.__classPrivateFieldGet(this, _TestScribe_targetDir, "f")); }) .with("detox", async () => { const detoxTemplate = new detox_template_1.DetoxTemplate(scenariosPerPrefix); await detoxTemplate.write(tslib_1.__classPrivateFieldGet(this, _TestScribe_targetDir, "f")); }) .exhaustive(); console.log("✅ 스텁 생성이 완료되었습니다!"); } catch (error) { console.error("❌ 스텁 생성 실패:", error); throw error; } } } exports.TestScribe = TestScribe; _TestScribe_googleSpreadsheets = new WeakMap(), _TestScribe_targetDir = new WeakMap();