Test paused-source confirmation through reader UI
This commit is contained in:
1 parent
b96ab42add
commit
0d51f214d5
1 file changed
+26
-1
+26
-1
@@ -18,7 +18,13 @@ if (peerGatewayQa) {
|
||||
if (process.platform === 'win32' && !process.env.OPENSSL_BIN) process.env.OPENSSL_BIN = 'C:\\Program Files\\Git\\usr\\bin\\openssl.exe';
|
||||
new PeeringState(peerData).generateIdentity('ComposeQA');
|
||||
}
|
||||
fs.writeFileSync(path.join(data, 'scraper', 'queue.json'), JSON.stringify({ paused: true, queue: [], settings: { autoUpdateEnabled: false } }));
|
||||
const pausedConfirmQa = process.argv.includes('--paused-confirm');
|
||||
fs.writeFileSync(path.join(data, 'scraper', 'queue.json'), JSON.stringify({ paused: true,
|
||||
sourcePaused: pausedConfirmQa ? { weebcentral: true } : {},
|
||||
queue: pausedConfirmQa ? [{ id: 'ready-fixture', source: 'weebcentral',
|
||||
url: 'https://weebcentral.com/series/01J76XYAWYDTD62TB8GEBFTARZ/Fixture',
|
||||
seriesId: '01J76XYAWYDTD62TB8GEBFTARZ', title: 'Fixture', sourceTitle: 'Fixture',
|
||||
kind: 'inspection', status: 'ready' }] : [], settings: { autoUpdateEnabled: false } }));
|
||||
fs.writeFileSync(tokenFile, crypto.randomBytes(32).toString('hex'), { mode: 0o600 });
|
||||
const png = new Canvas(180, 270, [60, 90, 140]).png();
|
||||
for (const [index, name] of ['Moon Garden', 'Before the Rain', 'Iron Harbor'].entries()) {
|
||||
@@ -82,6 +88,25 @@ let keep = false;
|
||||
assert.equal((await cleanup.json()).cleared, 0);
|
||||
assert.ok(state.libraryStatus);
|
||||
await until(async () => { state = await (await api('/api/admin/scraper')).json(); return state.libraryStatus?.ready && state.library.length === 3; }, 'Background scraper inventory missing');
|
||||
if (pausedConfirmQa) {
|
||||
const { chromium } = require('playwright');
|
||||
const browser = await chromium.launch({ channel: 'msedge', headless: true });
|
||||
try {
|
||||
const context = await browser.newContext();
|
||||
const [name, ...values] = cookie.split('=');
|
||||
await context.addCookies([{ name, value: values.join('='), url }]);
|
||||
const page = await context.newPage();
|
||||
await page.goto(url + '/settings.html#admin/scraper');
|
||||
const row = page.locator('[data-scraper-tab=activity] .scraper-item').filter({ hasText: 'Fixture' });
|
||||
await row.getByRole('button', { name: 'Confirm download' }).click();
|
||||
await row.getByText('Confirmed · waiting for source access review').waitFor();
|
||||
state = await (await api('/api/admin/scraper')).json();
|
||||
assert.equal(state.sourcePaused.weebcentral, true);
|
||||
assert.equal(state.queue.find(item => item.id === 'ready-fixture').status, 'queued');
|
||||
assert.equal(state.queue.find(item => item.id === 'ready-fixture').kind, 'download');
|
||||
console.log('PASS: paused-source confirmation returns success and queues without source traffic');
|
||||
} finally { await browser.close(); }
|
||||
}
|
||||
const settingsJs = await (await fetch(url + '/settings.js')).text();
|
||||
assert.ok(!settingsJs.includes('Start it with: npm run start:scraper'));
|
||||
await until(async () => { const h = await (await api('/api/admin/health')).json(); return h.sentinel.services?.reader && h.sentinel.services?.scraper; }, 'Internal Sentinel networking failed');
|
||||
|
||||
Reference in new issue
Block a user