lib-e2e-cypress-for-dummys-ts 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/index.cjs +241 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +241 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -273,6 +273,13 @@ cypress/ ← select this folder
|
|
|
273
273
|
4. Interceptors are automatically wrapped in a `beforeEach()`
|
|
274
274
|
5. Alternatively, click **✏️ Editar manualmente** to open a full diff editor with save support
|
|
275
275
|
|
|
276
|
+
**Sidebar toolbar:**
|
|
277
|
+
|
|
278
|
+
| Button | Action |
|
|
279
|
+
|---|---|
|
|
280
|
+
| **+ Nuevo archivo** | Creates a new `.cy.ts` file with a basic `describe/it` scaffold in `cypress/e2e/`. Type the name (no extension needed) and press Enter or click **Crear**. |
|
|
281
|
+
| **↻ Actualizar** | Rescans the `cypress/e2e/` directory. Useful after a `git pull`, a drag-and-drop into the folder, or any external file change. |
|
|
282
|
+
|
|
276
283
|
> The File System Access API is supported in Chromium-based browsers (Chrome, Edge, Opera). Firefox and Safari do not support it.
|
|
277
284
|
|
|
278
285
|
---
|
package/dist/index.cjs
CHANGED
|
@@ -666,7 +666,12 @@ var I18N_ES = {
|
|
|
666
666
|
COPY_ICP_BTN: "\u{1F4CB} Copiar interceptores",
|
|
667
667
|
INSERT_BTN: "\u{1F4BE} Insertar en archivo",
|
|
668
668
|
EDIT_MANUAL_BTN: "\u270F\uFE0F Editar manualmente",
|
|
669
|
-
CLOSE_BTN: "\u2715 Cerrar"
|
|
669
|
+
CLOSE_BTN: "\u2715 Cerrar",
|
|
670
|
+
NEW_FILE_BTN: "+ Nuevo archivo",
|
|
671
|
+
REFRESH_BTN: "\u21BB Actualizar",
|
|
672
|
+
NEW_FILE_PLACEHOLDER: "nombre-del-test",
|
|
673
|
+
NEW_FILE_CONFIRM: "Crear",
|
|
674
|
+
NEW_FILE_CANCEL: "Cancelar"
|
|
670
675
|
},
|
|
671
676
|
FILE_PREVIEW: {
|
|
672
677
|
NO_FILE: "Sin archivo",
|
|
@@ -823,7 +828,12 @@ var I18N_EN = {
|
|
|
823
828
|
COPY_ICP_BTN: "\u{1F4CB} Copy interceptors",
|
|
824
829
|
INSERT_BTN: "\u{1F4BE} Insert into file",
|
|
825
830
|
EDIT_MANUAL_BTN: "\u270F\uFE0F Edit manually",
|
|
826
|
-
CLOSE_BTN: "\u2715 Close"
|
|
831
|
+
CLOSE_BTN: "\u2715 Close",
|
|
832
|
+
NEW_FILE_BTN: "+ New file",
|
|
833
|
+
REFRESH_BTN: "\u21BB Refresh",
|
|
834
|
+
NEW_FILE_PLACEHOLDER: "test-name",
|
|
835
|
+
NEW_FILE_CONFIRM: "Create",
|
|
836
|
+
NEW_FILE_CANCEL: "Cancel"
|
|
827
837
|
},
|
|
828
838
|
FILE_PREVIEW: {
|
|
829
839
|
NO_FILE: "No file",
|
|
@@ -980,7 +990,12 @@ var I18N_FR = {
|
|
|
980
990
|
COPY_ICP_BTN: "\u{1F4CB} Copier les intercepteurs",
|
|
981
991
|
INSERT_BTN: "\u{1F4BE} Ins\xE9rer dans le fichier",
|
|
982
992
|
EDIT_MANUAL_BTN: "\u270F\uFE0F \xC9diter manuellement",
|
|
983
|
-
CLOSE_BTN: "\u2715 Fermer"
|
|
993
|
+
CLOSE_BTN: "\u2715 Fermer",
|
|
994
|
+
NEW_FILE_BTN: "+ Nouveau fichier",
|
|
995
|
+
REFRESH_BTN: "\u21BB Actualiser",
|
|
996
|
+
NEW_FILE_PLACEHOLDER: "nom-du-test",
|
|
997
|
+
NEW_FILE_CONFIRM: "Cr\xE9er",
|
|
998
|
+
NEW_FILE_CANCEL: "Annuler"
|
|
984
999
|
},
|
|
985
1000
|
FILE_PREVIEW: {
|
|
986
1001
|
NO_FILE: "Sans fichier",
|
|
@@ -1137,7 +1152,12 @@ var I18N_IT = {
|
|
|
1137
1152
|
COPY_ICP_BTN: "\u{1F4CB} Copia interceptor",
|
|
1138
1153
|
INSERT_BTN: "\u{1F4BE} Inserisci nel file",
|
|
1139
1154
|
EDIT_MANUAL_BTN: "\u270F\uFE0F Modifica manualmente",
|
|
1140
|
-
CLOSE_BTN: "\u2715 Chiudi"
|
|
1155
|
+
CLOSE_BTN: "\u2715 Chiudi",
|
|
1156
|
+
NEW_FILE_BTN: "+ Nuovo file",
|
|
1157
|
+
REFRESH_BTN: "\u21BB Aggiorna",
|
|
1158
|
+
NEW_FILE_PLACEHOLDER: "nome-del-test",
|
|
1159
|
+
NEW_FILE_CONFIRM: "Crea",
|
|
1160
|
+
NEW_FILE_CANCEL: "Annulla"
|
|
1141
1161
|
},
|
|
1142
1162
|
FILE_PREVIEW: {
|
|
1143
1163
|
NO_FILE: "Nessun file",
|
|
@@ -1294,7 +1314,12 @@ var I18N_DE = {
|
|
|
1294
1314
|
COPY_ICP_BTN: "\u{1F4CB} Interceptors kopieren",
|
|
1295
1315
|
INSERT_BTN: "\u{1F4BE} In Datei einf\xFCgen",
|
|
1296
1316
|
EDIT_MANUAL_BTN: "\u270F\uFE0F Manuell bearbeiten",
|
|
1297
|
-
CLOSE_BTN: "\u2715 Schlie\xDFen"
|
|
1317
|
+
CLOSE_BTN: "\u2715 Schlie\xDFen",
|
|
1318
|
+
NEW_FILE_BTN: "+ Neue Datei",
|
|
1319
|
+
REFRESH_BTN: "\u21BB Aktualisieren",
|
|
1320
|
+
NEW_FILE_PLACEHOLDER: "test-name",
|
|
1321
|
+
NEW_FILE_CONFIRM: "Erstellen",
|
|
1322
|
+
NEW_FILE_CANCEL: "Abbrechen"
|
|
1298
1323
|
},
|
|
1299
1324
|
FILE_PREVIEW: {
|
|
1300
1325
|
NO_FILE: "Keine Datei",
|
|
@@ -3434,26 +3459,38 @@ var ADVANCED_TEST_EDITOR_STYLES = `
|
|
|
3434
3459
|
* { box-sizing: border-box; }
|
|
3435
3460
|
.layout { display: flex; flex: 1; min-height: 0; }
|
|
3436
3461
|
.sidebar {
|
|
3437
|
-
|
|
3438
|
-
|
|
3462
|
+
border-right: none; display: flex; flex-direction: column;
|
|
3463
|
+
background: #0d1117; flex-shrink: 0; min-width: 140px; max-width: 500px;
|
|
3464
|
+
}
|
|
3465
|
+
.tree-scroll {
|
|
3466
|
+
flex: 1; overflow-y: auto; padding: 6px 4px;
|
|
3439
3467
|
scrollbar-width: thin; scrollbar-color: #30363d transparent;
|
|
3440
3468
|
}
|
|
3441
|
-
.
|
|
3442
|
-
.
|
|
3443
|
-
.
|
|
3469
|
+
.tree-scroll::-webkit-scrollbar { width: 4px; }
|
|
3470
|
+
.tree-scroll::-webkit-scrollbar-thumb { background: #30363d; border-radius: 2px; }
|
|
3471
|
+
.resize-handle {
|
|
3472
|
+
width: 4px; background: #21262d; cursor: col-resize; flex-shrink: 0;
|
|
3473
|
+
transition: background 0.15s;
|
|
3474
|
+
}
|
|
3475
|
+
.resize-handle:hover, .resize-handle.dragging { background: #2f81f7; }
|
|
3476
|
+
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #161b22; min-width: 0; }
|
|
3444
3477
|
.no-perm {
|
|
3445
3478
|
padding: 28px; color: #484f58; font-size: 13px; text-align: center;
|
|
3446
3479
|
display: flex; flex-direction: column; align-items: center; gap: 12px; line-height: 1.6;
|
|
3447
3480
|
}
|
|
3448
3481
|
.tree-item {
|
|
3449
|
-
padding:
|
|
3482
|
+
padding: 4px 6px; border-radius: 4px; cursor: pointer;
|
|
3450
3483
|
font-size: 12px; color: #8b949e; white-space: nowrap;
|
|
3451
3484
|
overflow: hidden; text-overflow: ellipsis;
|
|
3452
3485
|
transition: background 0.12s, color 0.12s;
|
|
3486
|
+
display: flex; align-items: center; gap: 4px; user-select: none;
|
|
3453
3487
|
}
|
|
3454
3488
|
.tree-item:hover { background: #161b22; color: #c9d1d9; }
|
|
3455
3489
|
.tree-item.selected { background: rgba(47,129,247,0.12); color: #2f81f7; }
|
|
3456
3490
|
.tree-item.dir { color: #e3b341; font-weight: 600; }
|
|
3491
|
+
.tree-item.dir:hover { background: rgba(227,179,65,0.08); color: #f0c040; }
|
|
3492
|
+
.dir-arrow { font-size: 8px; color: #484f58; width: 10px; flex-shrink: 0; line-height: 1; }
|
|
3493
|
+
.tree-connector { display: block; width: 1px; background: #21262d; margin-left: 13px; height: 100%; }
|
|
3457
3494
|
.content-area {
|
|
3458
3495
|
flex: 1; padding: 12px 14px; overflow-y: auto;
|
|
3459
3496
|
scrollbar-width: thin; scrollbar-color: #30363d transparent;
|
|
@@ -3491,6 +3528,34 @@ var ADVANCED_TEST_EDITOR_STYLES = `
|
|
|
3491
3528
|
transition: background 0.12s, color 0.12s; white-space: nowrap; flex-shrink: 0;
|
|
3492
3529
|
}
|
|
3493
3530
|
.btn-copy:hover { background: #30363d; color: #e6edf3; }
|
|
3531
|
+
.sidebar-toolbar {
|
|
3532
|
+
display: flex; gap: 4px; padding: 6px 6px 4px;
|
|
3533
|
+
border-bottom: 1px solid #21262d; flex-shrink: 0; background: #0d1117;
|
|
3534
|
+
}
|
|
3535
|
+
.btn-toolbar {
|
|
3536
|
+
flex: 1; padding: 4px 6px; border: 1px solid #30363d; border-radius: 5px; cursor: pointer;
|
|
3537
|
+
font-size: 10px; font-weight: 500; background: #161b22; color: #8b949e;
|
|
3538
|
+
transition: background 0.12s, color 0.12s; white-space: nowrap; overflow: hidden;
|
|
3539
|
+
text-overflow: ellipsis;
|
|
3540
|
+
}
|
|
3541
|
+
.btn-toolbar:hover { background: #30363d; color: #e6edf3; }
|
|
3542
|
+
.btn-toolbar.btn-new { color: #3fb950; border-color: #238636; }
|
|
3543
|
+
.btn-toolbar.btn-new:hover { background: #238636; color: #fff; }
|
|
3544
|
+
.new-file-form {
|
|
3545
|
+
padding: 6px; border-bottom: 1px solid #21262d; display: flex; flex-direction: column; gap: 4px;
|
|
3546
|
+
}
|
|
3547
|
+
.new-file-form input {
|
|
3548
|
+
width: 100%; padding: 4px 7px; background: #0d1117; border: 1px solid #30363d;
|
|
3549
|
+
border-radius: 5px; color: #e6edf3; font-size: 11px; font-family: monospace;
|
|
3550
|
+
outline: none;
|
|
3551
|
+
}
|
|
3552
|
+
.new-file-form input:focus { border-color: #2f81f7; }
|
|
3553
|
+
.new-file-form .ext { font-size: 9px; color: #484f58; padding: 0 2px; }
|
|
3554
|
+
.new-file-actions { display: flex; gap: 4px; }
|
|
3555
|
+
.btn-confirm { flex: 1; padding: 3px 6px; border: 1px solid #238636; border-radius: 5px; cursor: pointer; font-size: 10px; font-weight: 500; background: #238636; color: #fff; transition: background 0.12s; }
|
|
3556
|
+
.btn-confirm:hover { background: #2ea043; }
|
|
3557
|
+
.btn-cancel-form { flex: 1; padding: 3px 6px; border: 1px solid #30363d; border-radius: 5px; cursor: pointer; font-size: 10px; font-weight: 500; background: #21262d; color: #8b949e; transition: background 0.12s; }
|
|
3558
|
+
.btn-cancel-form:hover { background: #30363d; color: #e6edf3; }
|
|
3494
3559
|
`;
|
|
3495
3560
|
|
|
3496
3561
|
// src/components/advanced-test-editor/advanced-test-editor.template.ts
|
|
@@ -3509,8 +3574,8 @@ function renderNoPermission(needsReauth, t) {
|
|
|
3509
3574
|
</div>`;
|
|
3510
3575
|
}
|
|
3511
3576
|
function renderAdvancedEditor(state, t) {
|
|
3512
|
-
const { e2eTree, selectedFile, selectedFileContent, testItBlock, interceptorsBlock, saveButtonEnabled } = state;
|
|
3513
|
-
const treeHtml = e2eTree.length ? renderTree(e2eTree, selectedFile) : `<div class="tree-item" style="color:#6c7a99">${t("ADVANCED_EDITOR.NO_FILES")}</div>`;
|
|
3577
|
+
const { e2eTree, selectedFile, selectedFileContent, testItBlock, interceptorsBlock, saveButtonEnabled, isCreatingFile, collapsedDirs, sidebarWidth } = state;
|
|
3578
|
+
const treeHtml = e2eTree.length ? renderTree(e2eTree, selectedFile, collapsedDirs) : `<div class="tree-item" style="color:#6c7a99">${t("ADVANCED_EDITOR.NO_FILES")}</div>`;
|
|
3514
3579
|
const contentHtml = selectedFileContent ? `<div class="file-name">\u{1F4C4} ${escHtml(selectedFile?.name ?? "")}</div>
|
|
3515
3580
|
<pre>${escHtml(selectedFileContent.slice(0, 4e3))}${selectedFileContent.length > 4e3 ? "\n..." : ""}</pre>` : `<div class="placeholder">${t("ADVANCED_EDITOR.SELECT_FILE")}</div>`;
|
|
3516
3581
|
const itHtml = testItBlock ? `<div style="margin-top:10px">
|
|
@@ -3527,9 +3592,27 @@ function renderAdvancedEditor(state, t) {
|
|
|
3527
3592
|
</div>
|
|
3528
3593
|
<pre style="max-height:120px;font-size:10.5px;color:#3fb950">${escHtml(interceptorsBlock.slice(0, 500))}</pre>
|
|
3529
3594
|
</div>` : "";
|
|
3595
|
+
const newFileForm = isCreatingFile ? `<div class="new-file-form">
|
|
3596
|
+
<input id="input-new-file" type="text" placeholder="${escHtml(t("ADVANCED_EDITOR.NEW_FILE_PLACEHOLDER"))}" autocomplete="off" />
|
|
3597
|
+
<span class="ext">.cy.ts</span>
|
|
3598
|
+
<div class="new-file-actions">
|
|
3599
|
+
<button id="btn-new-file-confirm" class="btn-confirm">${t("ADVANCED_EDITOR.NEW_FILE_CONFIRM")}</button>
|
|
3600
|
+
<button id="btn-new-file-cancel" class="btn-cancel-form">${t("ADVANCED_EDITOR.NEW_FILE_CANCEL")}</button>
|
|
3601
|
+
</div>
|
|
3602
|
+
</div>` : "";
|
|
3603
|
+
const toolbar = `
|
|
3604
|
+
<div class="sidebar-toolbar">
|
|
3605
|
+
<button id="btn-new-file" class="btn-toolbar btn-new">${t("ADVANCED_EDITOR.NEW_FILE_BTN")}</button>
|
|
3606
|
+
<button id="btn-refresh" class="btn-toolbar">${t("ADVANCED_EDITOR.REFRESH_BTN")}</button>
|
|
3607
|
+
</div>`;
|
|
3530
3608
|
return `
|
|
3531
3609
|
<div class="layout">
|
|
3532
|
-
<div class="sidebar"
|
|
3610
|
+
<div class="sidebar" style="width:${sidebarWidth}px">
|
|
3611
|
+
${toolbar}
|
|
3612
|
+
${newFileForm}
|
|
3613
|
+
<div class="tree-scroll">${treeHtml}</div>
|
|
3614
|
+
</div>
|
|
3615
|
+
<div id="resize-handle" class="resize-handle"></div>
|
|
3533
3616
|
<div class="main">
|
|
3534
3617
|
<div class="content-area">${contentHtml}${itHtml}${interceptorsHtml}</div>
|
|
3535
3618
|
<div class="footer">
|
|
@@ -3545,16 +3628,24 @@ function renderAdvancedEditor(state, t) {
|
|
|
3545
3628
|
</div>
|
|
3546
3629
|
</div>`;
|
|
3547
3630
|
}
|
|
3548
|
-
function renderTree(nodes, selected, indent = 0) {
|
|
3631
|
+
function renderTree(nodes, selected, collapsedDirs, indent = 0, parentPath = "") {
|
|
3549
3632
|
return nodes.map((n) => {
|
|
3633
|
+
const currentPath = parentPath ? `${parentPath}/${n.name}` : n.name;
|
|
3550
3634
|
const isFile = n.kind === "file";
|
|
3551
|
-
const
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3635
|
+
const pad = `padding-left:${6 + indent * 14}px`;
|
|
3636
|
+
if (!isFile) {
|
|
3637
|
+
const dir = n;
|
|
3638
|
+
const hasChildren = (dir.children?.length ?? 0) > 0;
|
|
3639
|
+
const isCollapsed = collapsedDirs.has(currentPath);
|
|
3640
|
+
const arrow = hasChildren ? isCollapsed ? "\u25B6" : "\u25BC" : "\xB7";
|
|
3641
|
+
const dirHtml = `<div class="tree-item dir" style="${pad}" data-dir-path="${escAttr(currentPath)}">
|
|
3642
|
+
<span class="dir-arrow">${arrow}</span>\u{1F4C1} ${escHtml(n.name)}
|
|
3643
|
+
</div>`;
|
|
3644
|
+
if (!hasChildren || isCollapsed) return dirHtml;
|
|
3645
|
+
return dirHtml + renderTree(dir.children, selected, collapsedDirs, indent + 1, currentPath);
|
|
3557
3646
|
}
|
|
3647
|
+
const isSel = selected?.name === n.name;
|
|
3648
|
+
const cls = `tree-item${isSel ? " selected" : ""}`;
|
|
3558
3649
|
const data = JSON.stringify({ kind: n.kind, name: n.name }).replace(/"/g, """);
|
|
3559
3650
|
return `<div class="${cls}" style="${pad}" data-file="${data}">\u{1F4C4} ${escHtml(n.name)}</div>`;
|
|
3560
3651
|
}).join("");
|
|
@@ -3587,9 +3678,13 @@ var AdvancedTestEditorElement = class extends HTMLElement {
|
|
|
3587
3678
|
isPreviewMode = false;
|
|
3588
3679
|
previewFileName = null;
|
|
3589
3680
|
previewFileContent = null;
|
|
3681
|
+
isCreatingFile = false;
|
|
3682
|
+
collapsedDirs = /* @__PURE__ */ new Set();
|
|
3683
|
+
sidebarWidth = 220;
|
|
3590
3684
|
hasPermission = false;
|
|
3591
3685
|
needsReauth = false;
|
|
3592
3686
|
_dirHandle = null;
|
|
3687
|
+
_e2eHandle = null;
|
|
3593
3688
|
constructor() {
|
|
3594
3689
|
super();
|
|
3595
3690
|
this.shadow = this.attachShadow({ mode: "open" });
|
|
@@ -3631,7 +3726,8 @@ var AdvancedTestEditorElement = class extends HTMLElement {
|
|
|
3631
3726
|
try {
|
|
3632
3727
|
for await (const entry of this._dirHandle.values()) {
|
|
3633
3728
|
if (entry.kind === "directory" && entry.name === "e2e") {
|
|
3634
|
-
|
|
3729
|
+
this._e2eHandle = entry;
|
|
3730
|
+
const tree = await this.transformationService.scanDirectory(this._e2eHandle);
|
|
3635
3731
|
this.e2eTree = tree.children ?? [];
|
|
3636
3732
|
this.render();
|
|
3637
3733
|
return;
|
|
@@ -3640,6 +3736,32 @@ var AdvancedTestEditorElement = class extends HTMLElement {
|
|
|
3640
3736
|
} catch {
|
|
3641
3737
|
}
|
|
3642
3738
|
}
|
|
3739
|
+
async createNewFile(rawName) {
|
|
3740
|
+
if (!this._e2eHandle) return;
|
|
3741
|
+
const name = rawName.trim().replace(/\.cy\.ts$/, "");
|
|
3742
|
+
if (!name) return;
|
|
3743
|
+
const fileName = `${name}.cy.ts`;
|
|
3744
|
+
const template = `describe('${name}', () => {
|
|
3745
|
+
|
|
3746
|
+
it('should ', () => {
|
|
3747
|
+
|
|
3748
|
+
});
|
|
3749
|
+
|
|
3750
|
+
});
|
|
3751
|
+
`;
|
|
3752
|
+
try {
|
|
3753
|
+
const fileHandle = await this._e2eHandle.getFileHandle(fileName, { create: true });
|
|
3754
|
+
const writable = await fileHandle.createWritable();
|
|
3755
|
+
await writable.write(template);
|
|
3756
|
+
await writable.close();
|
|
3757
|
+
} catch {
|
|
3758
|
+
}
|
|
3759
|
+
this.isCreatingFile = false;
|
|
3760
|
+
await this.getFoldersData();
|
|
3761
|
+
}
|
|
3762
|
+
async refreshTree() {
|
|
3763
|
+
await this.getFoldersData();
|
|
3764
|
+
}
|
|
3643
3765
|
async saveCommandsToFile() {
|
|
3644
3766
|
if (!this.selectedFileHandle || !this.selectedFileContent || !this.testItBlock) return;
|
|
3645
3767
|
let content = this.selectedFileContent;
|
|
@@ -3697,6 +3819,44 @@ var AdvancedTestEditorElement = class extends HTMLElement {
|
|
|
3697
3819
|
composed: true
|
|
3698
3820
|
}));
|
|
3699
3821
|
}
|
|
3822
|
+
toggleDir(path) {
|
|
3823
|
+
if (this.collapsedDirs.has(path)) {
|
|
3824
|
+
this.collapsedDirs.delete(path);
|
|
3825
|
+
} else {
|
|
3826
|
+
this.collapsedDirs.add(path);
|
|
3827
|
+
}
|
|
3828
|
+
this.render();
|
|
3829
|
+
}
|
|
3830
|
+
setupResizeHandle() {
|
|
3831
|
+
const handle = this.shadow.getElementById("resize-handle");
|
|
3832
|
+
const sidebar = this.shadow.querySelector(".sidebar");
|
|
3833
|
+
if (!handle || !sidebar) return;
|
|
3834
|
+
let startX = 0;
|
|
3835
|
+
let startWidth = 0;
|
|
3836
|
+
const onMouseMove = (e) => {
|
|
3837
|
+
const delta = e.clientX - startX;
|
|
3838
|
+
const newWidth = Math.max(140, Math.min(500, startWidth + delta));
|
|
3839
|
+
this.sidebarWidth = newWidth;
|
|
3840
|
+
sidebar.style.width = `${newWidth}px`;
|
|
3841
|
+
};
|
|
3842
|
+
const onMouseUp = () => {
|
|
3843
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
3844
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
3845
|
+
document.body.style.cursor = "";
|
|
3846
|
+
document.body.style.userSelect = "";
|
|
3847
|
+
handle.classList.remove("dragging");
|
|
3848
|
+
};
|
|
3849
|
+
handle.addEventListener("mousedown", (e) => {
|
|
3850
|
+
startX = e.clientX;
|
|
3851
|
+
startWidth = sidebar.offsetWidth;
|
|
3852
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
3853
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
3854
|
+
document.body.style.cursor = "col-resize";
|
|
3855
|
+
document.body.style.userSelect = "none";
|
|
3856
|
+
handle.classList.add("dragging");
|
|
3857
|
+
e.preventDefault();
|
|
3858
|
+
});
|
|
3859
|
+
}
|
|
3700
3860
|
closePreview() {
|
|
3701
3861
|
this.isPreviewMode = false;
|
|
3702
3862
|
this.previewFileName = null;
|
|
@@ -3727,7 +3887,10 @@ var AdvancedTestEditorElement = class extends HTMLElement {
|
|
|
3727
3887
|
selectedFileContent: this.selectedFileContent,
|
|
3728
3888
|
testItBlock: this.testItBlock,
|
|
3729
3889
|
interceptorsBlock: this.interceptorsBlock,
|
|
3730
|
-
saveButtonEnabled: this.saveButtonEnabled
|
|
3890
|
+
saveButtonEnabled: this.saveButtonEnabled,
|
|
3891
|
+
isCreatingFile: this.isCreatingFile,
|
|
3892
|
+
collapsedDirs: this.collapsedDirs,
|
|
3893
|
+
sidebarWidth: this.sidebarWidth
|
|
3731
3894
|
}, this.t.bind(this))}`;
|
|
3732
3895
|
this.shadow.querySelectorAll("[data-file]").forEach((el) => {
|
|
3733
3896
|
el.addEventListener("click", () => {
|
|
@@ -3735,11 +3898,41 @@ var AdvancedTestEditorElement = class extends HTMLElement {
|
|
|
3735
3898
|
if (data) this.onFileClick(JSON.parse(data));
|
|
3736
3899
|
});
|
|
3737
3900
|
});
|
|
3901
|
+
this.shadow.querySelectorAll("[data-dir-path]").forEach((el) => {
|
|
3902
|
+
el.addEventListener("click", () => {
|
|
3903
|
+
const path = el.dataset["dirPath"];
|
|
3904
|
+
if (path) this.toggleDir(path);
|
|
3905
|
+
});
|
|
3906
|
+
});
|
|
3907
|
+
this.setupResizeHandle();
|
|
3738
3908
|
this.shadow.getElementById("btn-save")?.addEventListener("click", () => this.saveCommandsToFile());
|
|
3739
3909
|
this.shadow.getElementById("btn-edit")?.addEventListener("click", () => this.openEditManually());
|
|
3740
3910
|
this.shadow.getElementById("btn-copy-it")?.addEventListener("click", () => this.copyToClipboard(this.testItBlock));
|
|
3741
3911
|
this.shadow.getElementById("btn-copy-interceptors")?.addEventListener("click", () => this.copyToClipboard(this.interceptorsBlock));
|
|
3742
3912
|
this.shadow.getElementById("btn-close")?.addEventListener("click", () => this.closePreview());
|
|
3913
|
+
this.shadow.getElementById("btn-new-file")?.addEventListener("click", () => {
|
|
3914
|
+
this.isCreatingFile = !this.isCreatingFile;
|
|
3915
|
+
this.render();
|
|
3916
|
+
if (this.isCreatingFile) this.shadow.getElementById("input-new-file")?.focus();
|
|
3917
|
+
});
|
|
3918
|
+
this.shadow.getElementById("btn-refresh")?.addEventListener("click", () => this.refreshTree());
|
|
3919
|
+
this.shadow.getElementById("btn-new-file-confirm")?.addEventListener("click", () => {
|
|
3920
|
+
const input2 = this.shadow.getElementById("input-new-file");
|
|
3921
|
+
this.createNewFile(input2?.value ?? "");
|
|
3922
|
+
});
|
|
3923
|
+
this.shadow.getElementById("btn-new-file-cancel")?.addEventListener("click", () => {
|
|
3924
|
+
this.isCreatingFile = false;
|
|
3925
|
+
this.render();
|
|
3926
|
+
});
|
|
3927
|
+
const input = this.shadow.getElementById("input-new-file");
|
|
3928
|
+
input?.addEventListener("keydown", (e) => {
|
|
3929
|
+
if (e.key === "Enter") {
|
|
3930
|
+
this.createNewFile(input.value);
|
|
3931
|
+
} else if (e.key === "Escape") {
|
|
3932
|
+
this.isCreatingFile = false;
|
|
3933
|
+
this.render();
|
|
3934
|
+
}
|
|
3935
|
+
});
|
|
3743
3936
|
}
|
|
3744
3937
|
};
|
|
3745
3938
|
if (!customElements.get("advanced-test-editor")) {
|
|
@@ -4247,6 +4440,7 @@ function renderRecorderWidget(rec, paused, t) {
|
|
|
4247
4440
|
// src/components/lib-e2e-recorder/lib-e2e-recorder.ts
|
|
4248
4441
|
var LibE2eRecorderElement = class extends HTMLElement {
|
|
4249
4442
|
shadow;
|
|
4443
|
+
_isDisabled = false;
|
|
4250
4444
|
keydownHandler;
|
|
4251
4445
|
recordingUnsub;
|
|
4252
4446
|
commandsUnsub;
|
|
@@ -4274,6 +4468,10 @@ var LibE2eRecorderElement = class extends HTMLElement {
|
|
|
4274
4468
|
this.shadow = this.attachShadow({ mode: "open" });
|
|
4275
4469
|
}
|
|
4276
4470
|
connectedCallback() {
|
|
4471
|
+
if ("Cypress" in window) {
|
|
4472
|
+
this._isDisabled = true;
|
|
4473
|
+
return;
|
|
4474
|
+
}
|
|
4277
4475
|
if (!this.getAttribute("data-cy")) {
|
|
4278
4476
|
this.setAttribute("data-cy", "lib-e2e-cypress-for-dummys");
|
|
4279
4477
|
}
|
|
@@ -4294,6 +4492,7 @@ var LibE2eRecorderElement = class extends HTMLElement {
|
|
|
4294
4492
|
window.addEventListener("keydown", this.keydownHandler);
|
|
4295
4493
|
}
|
|
4296
4494
|
disconnectedCallback() {
|
|
4495
|
+
if (this._isDisabled) return;
|
|
4297
4496
|
window.removeEventListener("keydown", this.keydownHandler);
|
|
4298
4497
|
this.recordingUnsub?.();
|
|
4299
4498
|
this.commandsUnsub?.();
|
|
@@ -4674,7 +4873,7 @@ cypress/ <span style="color:#484f58">${this.translation.translate("RECOR
|
|
|
4674
4873
|
this.toggleModal("isAdvancedEditorDialogOpen", () => {
|
|
4675
4874
|
import_sweetalert2.default.fire({
|
|
4676
4875
|
title: this.translation.translate("MAIN_FRAME.SHOW_ADVANCED_EDITOR"),
|
|
4677
|
-
html: '<div id="advanced-editor-modal-content" style="min-height:
|
|
4876
|
+
html: '<div id="advanced-editor-modal-content" style="flex:1;min-height:0;display:flex;flex-direction:column;padding:0"></div>',
|
|
4678
4877
|
showCloseButton: true,
|
|
4679
4878
|
showConfirmButton: false,
|
|
4680
4879
|
allowOutsideClick: false,
|
|
@@ -4683,6 +4882,20 @@ cypress/ <span style="color:#484f58">${this.translation.translate("RECOR
|
|
|
4683
4882
|
didOpen: () => {
|
|
4684
4883
|
makeSwalDraggable();
|
|
4685
4884
|
setSwal2DataCyAttribute();
|
|
4885
|
+
const popup = import_sweetalert2.default.getPopup();
|
|
4886
|
+
if (popup) {
|
|
4887
|
+
popup.style.height = "600px";
|
|
4888
|
+
const htmlContainer = popup.querySelector(".swal2-html-container");
|
|
4889
|
+
if (htmlContainer) {
|
|
4890
|
+
htmlContainer.style.flex = "1";
|
|
4891
|
+
htmlContainer.style.minHeight = "0";
|
|
4892
|
+
htmlContainer.style.overflow = "hidden";
|
|
4893
|
+
htmlContainer.style.padding = "0";
|
|
4894
|
+
htmlContainer.style.margin = "0";
|
|
4895
|
+
htmlContainer.style.display = "flex";
|
|
4896
|
+
htmlContainer.style.flexDirection = "column";
|
|
4897
|
+
}
|
|
4898
|
+
}
|
|
4686
4899
|
const container = document.getElementById("advanced-editor-modal-content");
|
|
4687
4900
|
if (!container) return;
|
|
4688
4901
|
const child = document.createElement("advanced-test-editor");
|
|
@@ -4710,7 +4923,10 @@ cypress/ <span style="color:#484f58">${this.translation.translate("RECOR
|
|
|
4710
4923
|
this.isAdvancedEditorDialogOpen = false;
|
|
4711
4924
|
}
|
|
4712
4925
|
});
|
|
4713
|
-
|
|
4926
|
+
setTimeout(() => {
|
|
4927
|
+
const popup = import_sweetalert2.default.getPopup();
|
|
4928
|
+
if (popup) makeModalResizable(popup, { minWidth: 400, minHeight: 0 });
|
|
4929
|
+
}, 0);
|
|
4714
4930
|
});
|
|
4715
4931
|
}
|
|
4716
4932
|
showFileEditorDialog(handle, content, fileName, testId, itBlock = "", interceptorsBlock = "") {
|