const {chromium} = require('playwright'); const assert = require('node:assert/strict'); (async()=>{ const browser=await chromium.launch({headless:true,...(process.env.TEST_CHROME?{executablePath:process.env.TEST_CHROME}:{})}); try { for(const mobile of [false,true]) { const page=await browser.newPage({viewport:mobile?{width:390,height:844}:{width:1440,height:1000},isMobile:mobile,hasTouch:mobile}); const errors=[]; page.on('pageerror', e=>errors.push(e.message)); await page.goto('http://127.0.0.1:7868'); await page.getByRole('tab',{name:'Illustrious',exact:true}).click(); await page.getByRole('button',{name:'JujoHotaruのLoRAサンプル・使い方はこちら'}).click(); const area=page.locator('.jujo-samples:visible'); assert.equal(await area.locator('.jb-pony-badge').count(),0); await area.locator('.jb-search').fill('Pony用'); assert.match(await area.locator('.jb-count').innerText(),/^17件/); assert.equal(await area.locator('.jb-pony-badge').count(),mobile?4:8); await area.locator('.jb-search').fill('hotarueye_xl_comic02_v10'); await area.locator('.jb-card').click(); assert.match(await area.locator('.jb-code').innerText(),/Type 2 \/ Pony/); assert.match(await area.locator('.jb-compatibility-warning').innerText(),/Pony用・ILL未検証/); assert.match(await area.locator('.jb-sample-note').innerText(),/ILLでの再現は未確認/); await area.locator('.jb-target').selectOption('3'); await area.locator('.jb-apply-button').click(); await area.locator('.jb-message').filter({hasText:'LoRA 3に設定して有効化しました。'}).waitFor(); if(mobile) await area.locator('.jb-close').click(); await page.getByRole('button',{name:'LoRA設定・追加モデル(最大5つ)'}).click(); const warning=page.locator('.pony-selection-warning:visible').first(); await warning.filter({hasText:'hotarueye_xl_comic02_v10.safetensors'}).waitFor(); assert.match(await warning.innerText(),/再現性は未検証/); assert.deepEqual(errors,[]); await page.close(); } console.log('Pony labels, sample notices and slot selection warnings: desktop/mobile PASS'); } finally { await browser.close(); } })().catch(e=>{console.error(e);process.exit(1);});