This commit is contained in:
1 parent
cef362cbc2
commit
61399b1b4c
4 files changed
-117
No files matched your search
-25
@@ -1,25 +0,0 @@
|
||||
const { chromium } = require('playwright');
|
||||
(async () => {
|
||||
const b = await chromium.launch();
|
||||
const p = await b.newPage({ viewport: { width: 1400, height: 900 } });
|
||||
const errs = [];
|
||||
p.on('pageerror', (e) => errs.push(e.message.slice(0, 120)));
|
||||
p.on('console', (m) => { if (m.type() === 'error') errs.push(m.text().slice(0, 120)) });
|
||||
await p.goto('http://127.0.0.1:8792/', { waitUntil: 'load' });
|
||||
await p.waitForTimeout(3000);
|
||||
await p.click('button:has-text("新建画布")').catch(() => {});
|
||||
await p.waitForTimeout(2500);
|
||||
const info = await p.evaluate(() => {
|
||||
const styles = Array.prototype.map.call(document.querySelectorAll('head style'), (s) => ({ id: s.id || s.getAttribute('data-plugin') || '(none)', len: s.textContent.length }));
|
||||
const pluginStyles = styles.filter((x) => x.id !== '(none)' || x.len > 0);
|
||||
return {
|
||||
styleCount: styles.length,
|
||||
nonEmpty: styles.filter((s) => s.len > 0).length,
|
||||
pluginStyles,
|
||||
dockButtons: Array.prototype.map.call(document.querySelectorAll('.iwb-dock-btn'), (b) => b.getAttribute('data-tip') || b.getAttribute('aria-label') || b.textContent.trim()).slice(0, 12),
|
||||
};
|
||||
});
|
||||
console.log(JSON.stringify(info, null, 1).slice(0, 1200));
|
||||
console.log('errors:', JSON.stringify(errs.slice(0, 5)));
|
||||
await b.close();
|
||||
})().catch((e) => { console.error('ERR', e.message); process.exit(1) });
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
const { chromium } = require('playwright');
|
||||
(async () => {
|
||||
const b = await chromium.launch();
|
||||
const p = await b.newPage({ viewport: { width: 1400, height: 900 } });
|
||||
await p.goto('http://127.0.0.1:8793/', { waitUntil: 'load' });
|
||||
await p.waitForTimeout(2500);
|
||||
await p.click('button:has-text("新建画布")').catch(() => {});
|
||||
await p.waitForTimeout(2000);
|
||||
// 打开左侧停靠栏里的「提示词库」面板
|
||||
await p.click('.iwb-dock-btn[data-tip="提示词库"], .iwb-dock-btn[data-tip="风格库"], .iwb-dock-btn[data-tip="浏览器"]').catch((e) => console.log('click err', e.message.slice(0, 60)));
|
||||
await p.waitForTimeout(2500);
|
||||
const info = await p.evaluate(() => {
|
||||
const styles = Array.prototype.map.call(document.querySelectorAll('head style'), (s) => ({ attr: s.getAttribute('data-plugin') || s.id || '', len: s.textContent.length }));
|
||||
const panel = document.querySelector('.iwb-plugin-panel, .iwb-dock.right .iwb-dock-body, .iwb-dock-body');
|
||||
const inner = document.querySelector('.iwb-promptlib, .iwb-plugin-panel-root, .iwb-dock-panel');
|
||||
return {
|
||||
pluginStyleNodes: styles.filter((s) => s.attr).slice(0, 6),
|
||||
totalStyles: styles.length,
|
||||
panelCls: panel ? String(panel.className) : null,
|
||||
panelW: panel ? Math.round(panel.getBoundingClientRect().width) : null,
|
||||
innerTag: inner ? inner.tagName + '.' + String(inner.className).slice(0, 40) : null,
|
||||
dockRightW: (() => { const d = document.querySelector('.iwb-dock.right'); return d ? Math.round(d.getBoundingClientRect().width) : null })(),
|
||||
bootStyleLeft: !!document.getElementById('iwb-boot-static'),
|
||||
};
|
||||
});
|
||||
console.log(JSON.stringify(info, null, 1));
|
||||
await p.screenshot({ path: '/tmp/plugin-panel.png' });
|
||||
await b.close();
|
||||
})().catch((e) => { console.error('ERR', e.message); process.exit(1) });
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
const { chromium } = require('playwright');
|
||||
(async () => {
|
||||
const b = await chromium.launch();
|
||||
const p = await b.newPage({ viewport: { width: 1400, height: 900 } });
|
||||
await p.goto('http://127.0.0.1:8794/', { waitUntil: 'load' });
|
||||
await p.waitForTimeout(2500);
|
||||
await p.click('button:has-text("新建画布")').catch(() => {});
|
||||
await p.waitForTimeout(2000);
|
||||
const buttons = await p.evaluate(() => Array.prototype.map.call(document.querySelectorAll('.iwb-dock-btn, .iwb-dock-head button'), (b) => ({ cls: b.className, tip: b.getAttribute('data-tip'), label: b.getAttribute('aria-label'), text: (b.textContent || '').trim().slice(0, 8) })));
|
||||
console.log('dock buttons:', JSON.stringify(buttons).slice(0, 600));
|
||||
const target = buttons.find((x) => (x.tip || x.label || x.text || '').indexOf('提示词') >= 0);
|
||||
console.log('target:', JSON.stringify(target));
|
||||
if (target) {
|
||||
await p.click('.iwb-dock-btn[data-tip="' + target.tip + '"]').catch((e) => console.log('click2 err', e.message.slice(0, 50)));
|
||||
await p.waitForTimeout(2500);
|
||||
}
|
||||
const info = await p.evaluate(() => {
|
||||
const styles = Array.prototype.map.call(document.querySelectorAll('head style'), (s) => ({ attr: s.getAttribute('data-plugin') || '', len: s.textContent.length }));
|
||||
const body = document.querySelector('.iwb-dock-body');
|
||||
const card = document.querySelector('.iwb-lib-card, .iwb-prompt-item, .iwb-plugin-panel *');
|
||||
return {
|
||||
pluginStyleNodes: styles.filter((s) => s.attr),
|
||||
bodyH: body ? Math.round(body.getBoundingClientRect().height) : null,
|
||||
bodyCls: body ? String(body.className) : null,
|
||||
firstChildCls: body && body.firstElementChild ? String(body.firstElementChild.className).slice(0, 60) : null,
|
||||
cardW: card ? Math.round(card.getBoundingClientRect().width) : null,
|
||||
};
|
||||
});
|
||||
console.log(JSON.stringify(info, null, 1));
|
||||
await p.screenshot({ path: '/tmp/panel2.png' });
|
||||
await b.close();
|
||||
})().catch((e) => { console.error('ERR', e.message); process.exit(1) });
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
const { chromium } = require('playwright');
|
||||
(async () => {
|
||||
const b = await chromium.launch();
|
||||
const p = await b.newPage({ viewport: { width: 1400, height: 900 } });
|
||||
const errs = [];
|
||||
p.on('console', (m) => { if (m.type() === 'error') errs.push(m.text().slice(0, 100)) });
|
||||
await p.goto('http://127.0.0.1:8796/', { waitUntil: 'load' });
|
||||
await p.waitForTimeout(2500);
|
||||
await p.click('button:has-text("新建画布")').catch(() => {});
|
||||
await p.waitForTimeout(2500);
|
||||
const dock = await p.evaluate(() => Array.prototype.map.call(document.querySelectorAll('.iwb-dock-btn'), (b) => ({ label: b.getAttribute('aria-label'), cls: b.className })));
|
||||
console.log('dock:', JSON.stringify(dock));
|
||||
const btn = await p.$('.iwb-dock-btn[aria-label="提示词库"]');
|
||||
if (btn) { await btn.click({ force: true }).catch((e) => console.log('click err', e.message.slice(0, 50))); }
|
||||
await p.waitForTimeout(2500);
|
||||
const info = await p.evaluate(() => {
|
||||
const styles = Array.prototype.map.call(document.querySelectorAll('head style'), (s) => ({ p: s.getAttribute('data-plugin') || '', len: s.textContent.length }));
|
||||
const body = document.querySelector('.iwb-dock.right .iwb-dock-body') || document.querySelector('.iwb-dock-body');
|
||||
return {
|
||||
pluginStyles: styles.filter((s) => s.p),
|
||||
bodyCls: body ? String(body.className) : null,
|
||||
bodyW: body ? Math.round(body.getBoundingClientRect().width) : null,
|
||||
firstChild: body && body.firstElementChild ? String(body.firstElementChild.className).slice(0, 50) : null,
|
||||
dockRightW: (() => { const d = document.querySelector('.iwb-dock.right'); return d ? Math.round(d.getBoundingClientRect().width) : null })(),
|
||||
};
|
||||
});
|
||||
console.log(JSON.stringify(info, null, 1));
|
||||
console.log('errs:', JSON.stringify(errs.slice(0, 4)));
|
||||
await p.screenshot({ path: '/tmp/panel-head.png' });
|
||||
await b.close();
|
||||
})().catch((e) => { console.error('ERR', e.message); process.exit(1) });
|
||||
Reference in new issue
Block a user