test(ui): align smoke gate with account manager
Update the real Electron smoke contract for the four-tab, five-hoster account-manager UI and make Electron failures propagate through the outer Node process. This prevents stale selector failures and child-process timeouts from being reported as successful release gates.
This commit is contained in:
parent
cad270dd2c
commit
5079be718a
@ -48,7 +48,10 @@ setTimeout(async () => {
|
||||
console.log('\\n=== Upload View ===');
|
||||
|
||||
const tabCount = await wc.executeJavaScript('document.querySelectorAll(".tab").length');
|
||||
check('3 tabs exist', tabCount === 3);
|
||||
check('4 tabs exist', tabCount === 4);
|
||||
|
||||
const tabLabels = await wc.executeJavaScript('[...document.querySelectorAll(".tab")].map(el => el.textContent.trim()).join("|")');
|
||||
check('Current tab labels present', tabLabels === 'Upload|Accounts|Einstellungen|Verlauf');
|
||||
|
||||
const activeTab = await wc.executeJavaScript('document.querySelector(".tab.active")?.textContent?.trim()');
|
||||
check('Upload tab active by default', activeTab === 'Upload');
|
||||
@ -56,12 +59,9 @@ setTimeout(async () => {
|
||||
const dropVisible = await wc.executeJavaScript('document.getElementById("dropZone")?.style.display !== "none"');
|
||||
check('Drop zone visible (no files)', dropVisible);
|
||||
|
||||
const queueHidden = await wc.executeJavaScript('document.getElementById("queueContainer")?.style.display');
|
||||
const queueHidden = await wc.executeJavaScript('document.getElementById("queueShell")?.style.display');
|
||||
check('Queue hidden (no files)', queueHidden === 'none');
|
||||
|
||||
const chips = await wc.executeJavaScript('document.querySelectorAll(".hoster-chip").length');
|
||||
check('4 hoster chips', chips === 4);
|
||||
|
||||
const startDisabled = await wc.executeJavaScript('document.getElementById("startUploadBtn")?.disabled');
|
||||
check('Start button disabled initially', startDisabled === true);
|
||||
|
||||
@ -74,6 +74,45 @@ setTimeout(async () => {
|
||||
const ctxHidden = await wc.executeJavaScript('document.getElementById("contextMenu")?.style.display');
|
||||
check('Context menu hidden', ctxHidden === 'none');
|
||||
|
||||
console.log('\\n=== Accounts View ===');
|
||||
|
||||
await wc.executeJavaScript('document.querySelector(".tab[data-view=\\'accounts\\']").click()');
|
||||
await new Promise(r => setTimeout(r, 300));
|
||||
|
||||
const accountsActive = await wc.executeJavaScript('document.getElementById("accounts-view")?.classList.contains("active")');
|
||||
check('Accounts tab active', accountsActive);
|
||||
|
||||
const accountListValid = await wc.executeJavaScript('Boolean(document.querySelector("#accountsList .accounts-empty") || document.querySelectorAll("#accountsList .account-hoster-group").length)');
|
||||
check('Account manager list structure rendered', accountListValid);
|
||||
|
||||
const addAccountEnabled = await wc.executeJavaScript('document.getElementById("addAccountBtn")?.disabled === false');
|
||||
check('Add account button enabled', addAccountEnabled);
|
||||
|
||||
await wc.executeJavaScript('document.getElementById("addAccountBtn").click()');
|
||||
await new Promise(r => setTimeout(r, 200));
|
||||
|
||||
const accountModalVisible = await wc.executeJavaScript('document.getElementById("accountModal")?.style.display');
|
||||
check('Account modal opens', accountModalVisible === 'flex');
|
||||
|
||||
const accountModalTitle = await wc.executeJavaScript('document.getElementById("accountModalTitle")?.textContent');
|
||||
check('Account modal is in add mode', accountModalTitle === 'Account hinzufügen');
|
||||
|
||||
const authOptionCount = await wc.executeJavaScript('document.querySelectorAll("#accountHosterSelect option").length');
|
||||
check('7 hoster authentication options exist', authOptionCount === 7);
|
||||
|
||||
const hosterCount = await wc.executeJavaScript('[...new Set([...document.querySelectorAll("#accountHosterSelect option")].map(el => el.value.split(":")[0]))].length');
|
||||
check('5 hosters exist', hosterCount === 5);
|
||||
|
||||
const accountSubmitLabel = await wc.executeJavaScript('document.getElementById("saveAccountBtn")?.textContent');
|
||||
check('Account submit label is Prüfen und anlegen', accountSubmitLabel === 'Prüfen und anlegen');
|
||||
|
||||
const credentialInputs = await wc.executeJavaScript('document.querySelectorAll("#accountCredsFields .key-input").length');
|
||||
check('Credential inputs rendered', credentialInputs === 2);
|
||||
|
||||
await wc.executeJavaScript('document.getElementById("cancelAccountModalBtn").click()');
|
||||
const accountModalHidden = await wc.executeJavaScript('document.getElementById("accountModal")?.style.display');
|
||||
check('Account modal closes', accountModalHidden === 'none');
|
||||
|
||||
console.log('\\n=== Settings View ===');
|
||||
|
||||
await wc.executeJavaScript('document.querySelector(".tab[data-view=\\'settings\\']").click()');
|
||||
@ -82,23 +121,14 @@ setTimeout(async () => {
|
||||
const settingsActive = await wc.executeJavaScript('document.getElementById("settings-view")?.classList.contains("active")');
|
||||
check('Settings tab active', settingsActive);
|
||||
|
||||
const panels = await wc.executeJavaScript('document.querySelectorAll(".hoster-settings-panel").length');
|
||||
check('4 hoster panels', panels === 4);
|
||||
const settingsSubtabs = await wc.executeJavaScript('document.querySelectorAll(".settings-subtab").length');
|
||||
check('6 settings subtabs exist', settingsSubtabs === 6);
|
||||
|
||||
const hsInputCount = await wc.executeJavaScript('document.querySelectorAll(".hs-input").length');
|
||||
check('24 per-hoster inputs (6x4)', hsInputCount === 24);
|
||||
const accountSettingsPointer = await wc.executeJavaScript('document.querySelector(".settings-hoster-pointer")?.textContent');
|
||||
check('Hoster settings point to Accounts tab', accountSettingsPointer && accountSettingsPointer.includes('Accounts'));
|
||||
|
||||
await wc.executeJavaScript('document.querySelector(".hoster-panel-header").click()');
|
||||
await new Promise(r => setTimeout(r, 200));
|
||||
|
||||
const panelBody = await wc.executeJavaScript('document.querySelector(".hoster-panel-body").style.display');
|
||||
check('Panel expands on click', panelBody !== 'none');
|
||||
|
||||
const retries = await wc.executeJavaScript('document.querySelector(".hs-input[data-hs=\\'retries\\']")?.value');
|
||||
check('Retries default 3', retries === '3');
|
||||
|
||||
const parallel = await wc.executeJavaScript('document.querySelector(".hs-input[data-hs=\\'parallelCount\\']")?.value');
|
||||
check('ParallelCount default 2', parallel === '2');
|
||||
const parallel = await wc.executeJavaScript('document.getElementById("parallelUploadCountInput")?.value');
|
||||
check('Global parallel uploads default 0', parallel === '0');
|
||||
|
||||
// Test save
|
||||
await wc.executeJavaScript('document.getElementById("saveSettingsBtn").click()');
|
||||
@ -137,8 +167,7 @@ setTimeout(async () => {
|
||||
results.forEach(r => console.log(r));
|
||||
console.log('\\nTotal: ' + (passed + failed) + ' | Passed: ' + passed + ' | Failed: ' + failed);
|
||||
|
||||
if (failed > 0) process.exitCode = 1;
|
||||
app.quit();
|
||||
app.exit(failed > 0 ? 1 : 0);
|
||||
}, 5000);
|
||||
`;
|
||||
|
||||
@ -166,9 +195,7 @@ try {
|
||||
.join('\n');
|
||||
if (filtered.trim()) console.error(filtered);
|
||||
}
|
||||
if (err.status && err.status !== 0 && !err.killed) {
|
||||
process.exit(err.status);
|
||||
}
|
||||
process.exitCode = Number.isInteger(err.status) && err.status !== 0 ? err.status : 1;
|
||||
} finally {
|
||||
try { fs.unlinkSync(injectPath); } catch {}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user