Follow the new order and review screens in development browser checks
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// Read only through actual UI clicks; inspect its normal HTTP response.
|
||||
const fs = require('node:fs');
|
||||
const { readTechnicalData } = require('./review-data.cjs');
|
||||
const path = require('node:path');
|
||||
const assert = require('node:assert/strict');
|
||||
const { chromium } = require('../../web/node_modules/playwright');
|
||||
@@ -31,15 +32,15 @@ function privateJson(file) {
|
||||
await page.getByLabel('Kunde', { exact: true }).selectOption(expected.tenant_id);
|
||||
assert.equal(await page.getByLabel('Kunde', { exact: true }).inputValue(), expected.tenant_id);
|
||||
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
|
||||
await page.getByRole('button', { name: expected.operation_id, exact: true }).click();
|
||||
const op = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Antrag / Ausführung ' + expected.operation_id, exact: true }) });
|
||||
await page.locator('tr[data-operation-id="' + expected.operation_id + '"]').getByRole('button').click();
|
||||
const op = page.locator('section[data-operation-id="' + expected.operation_id + '"]');
|
||||
const response = page.waitForResponse(r => new URL(r.url()).pathname === `/api/v1/tenants/${expected.tenant_id}/jobs/${expected.job_id}` && r.status() === 200);
|
||||
await op.getByRole('button', { name: 'Job ' + expected.job_id + ' · succeeded', exact: true }).click();
|
||||
await op.locator('button[data-job-id="' + expected.job_id + '"]').click();
|
||||
const http = await (await response).json();
|
||||
const detail = page.locator('article').filter({ has: page.getByRole('heading', { name: 'Job ' + expected.job_id, exact: true }) });
|
||||
await detail.locator('pre').waitFor();
|
||||
const rendered = JSON.parse(await detail.locator('pre').innerText());
|
||||
assert.deepEqual(http, expected.result); assert.deepEqual(rendered, expected.result);
|
||||
const detail = page.locator('article[data-job-id="' + expected.job_id + '"]');
|
||||
|
||||
const rendered = await readTechnicalData(detail, 'Technische Ausführungsdaten');
|
||||
assert.equal(http.state, 'succeeded'); assert.deepEqual(http, expected.result); assert.deepEqual(rendered, expected.result);
|
||||
const observation = JSON.parse(Buffer.from(rendered.result.stdout).toString('utf8'));
|
||||
assert.equal(observation.data.unit, 'rmm-mvp-test.service'); assert.equal(observation.data.json_lines.length, 4);
|
||||
fs.writeFileSync(path.join(path.dirname(file), 'read-evidence.json'), JSON.stringify({ verified: true, http, rendered }), { mode: 0o600, flag: 'wx' });
|
||||
|
||||
Reference in New Issue
Block a user