From b9f74b6985fe7052805289f2de0ff5bb1a76edea Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Fri, 13 Nov 2026 08:51:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=B9=BF=E5=9C=BA=E8=A7=86=E9=A2=91=E6=8C=89=E7=A7=92=E8=AE=A1?= =?UTF-8?q?=E8=B4=B9=E6=A0=87=E7=AD=BE=E4=B8=8E=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modelPlaza/PlazaModelPricingTable.vue | 16 +-- .../PlazaModelPricingTable.video.spec.ts | 114 ++++++++++++++++++ frontend/src/i18n/locales/en/dashboard.ts | 2 + frontend/src/i18n/locales/zh/dashboard.ts | 2 + 4 files changed, 127 insertions(+), 7 deletions(-) create mode 100644 frontend/src/components/modelPlaza/__tests__/PlazaModelPricingTable.video.spec.ts diff --git a/frontend/src/components/modelPlaza/PlazaModelPricingTable.vue b/frontend/src/components/modelPlaza/PlazaModelPricingTable.vue index 6daf1194e85e..27778e424131 100644 --- a/frontend/src/components/modelPlaza/PlazaModelPricingTable.vue +++ b/frontend/src/components/modelPlaza/PlazaModelPricingTable.vue @@ -402,9 +402,10 @@ function billingMode(m: PlazaModel): BillingMode { } function billingModeLabel(m: PlazaModel): string { - return billingMode(m) === BILLING_MODE_IMAGE - ? t('modelPlaza.table.perImage') - : t('modelPlaza.table.perRequest') + const mode = billingMode(m) + if (mode === BILLING_MODE_IMAGE) return t('modelPlaza.table.perImage') + if (mode === BILLING_MODE_VIDEO) return t('modelPlaza.table.perSecond') + return t('modelPlaza.table.perRequest') } /** 价格统一保底 2 位小数,更长的有效小数原样保留。 */ @@ -469,11 +470,12 @@ function official(value: number | null | undefined): string { return formatScaled(value, PER_MILLION, MIN_DECIMALS) } -/** 非 token 计费的单位后缀:按图片 → “/ 张”,按次 → “/ 次”。 */ +/** 非 token 计费的单位后缀:按图片 → “/ 张”,按视频 → “/ 秒”,按次 → “/ 次”。 */ function perUnitSuffix(m: PlazaModel): string { - return billingMode(m) === BILLING_MODE_IMAGE - ? t('modelPlaza.table.perUnitImage') - : t('modelPlaza.table.perUnitRequest') + const mode = billingMode(m) + if (mode === BILLING_MODE_IMAGE) return t('modelPlaza.table.perUnitImage') + if (mode === BILLING_MODE_VIDEO) return t('modelPlaza.table.perUnitSecond') + return t('modelPlaza.table.perUnitRequest') } function hasCachePricing(m: PlazaModel): boolean { diff --git a/frontend/src/components/modelPlaza/__tests__/PlazaModelPricingTable.video.spec.ts b/frontend/src/components/modelPlaza/__tests__/PlazaModelPricingTable.video.spec.ts new file mode 100644 index 000000000000..347a013bf6fc --- /dev/null +++ b/frontend/src/components/modelPlaza/__tests__/PlazaModelPricingTable.video.spec.ts @@ -0,0 +1,114 @@ +import { afterEach, describe, expect, it } from 'vitest' +import { enableAutoUnmount, mount } from '@vue/test-utils' +import { createI18n } from 'vue-i18n' +import PlazaModelPricingTable from '../PlazaModelPricingTable.vue' +import zh from '@/i18n/locales/zh/dashboard' +import en from '@/i18n/locales/en/dashboard' +import type { PlazaModel } from '@/api/modelPlaza' + +enableAutoUnmount(afterEach) + +function mediaModel(mode: 'video' | 'image' | 'per_request', tiers = false): PlazaModel { + return { + name: `${mode}-demo`, + platform: 'openai', + official_pricing: null, + pricing: { + billing_mode: mode, + input_price: null, + output_price: null, + cache_write_price: null, + cache_read_price: null, + image_input_price: null, + image_output_price: null, + per_request_price: 0.54, + intervals: tiers ? [0.54, 1.08].map((price, index) => ({ + min_tokens: 0, + max_tokens: null, + tier_label: index === 0 ? '480p' : '720p', + input_price: null, + output_price: null, + cache_write_price: null, + cache_read_price: null, + per_request_price: price + })) : [] + } + } +} + +describe.each([ + { locale: 'zh', label: '按秒计费', suffix: '/ 秒', requestLabel: '按次计费', requestSuffix: '/ 次', imageLabel: '按图片计费', imageSuffix: '/ 张' }, + { locale: 'en', label: 'Per second', suffix: '/ second', requestLabel: 'Per request', requestSuffix: '/ request', imageLabel: 'Per image', imageSuffix: '/ image' } +])('PlazaModelPricingTable video units ($locale)', (language) => { + function render(model: PlazaModel, extraProps = {}) { + return mount(PlazaModelPricingTable, { + props: { models: [model], rateMultiplier: 0.5, ...extraProps }, + global: { + plugins: [createI18n({ legacy: false, locale: language.locale, messages: { zh, en } })] + } + }) + } + + it.each([ + { name: 'base price', tiers: false, props: {}, prices: ['$0.27'], rate: '0.5x' }, + { name: 'user discount', tiers: false, props: { userRateMultiplier: 0.25 }, prices: ['$0.135'], rate: '0.25x' }, + { name: 'independent video rate', tiers: false, props: { userRateMultiplier: 0.25, videoRateIndependent: true, videoRateMultiplier: 2 }, prices: ['$1.08'], rate: '2x' }, + { name: 'resolution prices with user discount', tiers: true, props: { userRateMultiplier: 0.25 }, prices: ['$0.135', '$0.27'], rate: '0.25x' }, + { name: 'resolution prices with independent rate', tiers: true, props: { userRateMultiplier: 0.25, videoRateIndependent: true, videoRateMultiplier: 2 }, prices: ['$1.08', '$2.16'], rate: '2x' } + ])('shows seconds and preserves $name', ({ tiers, props, prices, rate }) => { + const wrapper = render(mediaModel('video', tiers), { + imageRateIndependent: true, + imageRateMultiplier: 9, + ...props + }) + const cells = wrapper.findAll('tbody td') + expect(cells[0].text()).toContain(language.label) + expect(cells[0].text()).not.toContain(language.requestLabel) + expect(cells[1].attributes('colspan')).toBe('3') + expect(cells[1].text()).not.toContain(language.requestSuffix) + const units = cells[1].findAll('span').filter(span => span.text() === language.suffix) + expect(units).toHaveLength(prices.length) + if (tiers) { + const chips = cells[1].findAll('div > span') + expect(chips).toHaveLength(2) + chips.forEach((chip, index) => { + expect(chip.text()).toContain(index === 0 ? '480p' : '720p') + expect(chip.text()).toContain(prices[index]) + expect(chip.text()).toContain(language.suffix) + }) + } else { + expect(cells[1].text()).toContain(prices[0]) + } + expect(cells.at(-1)!.text()).toContain(rate) + expect(cells.slice(2, 5).map(cell => cell.text())).toEqual(['-', '-', '-']) + expect(wrapper.text()).not.toContain('modelPlaza.table.') + }) + + it.each(['image', 'per_request'] as const)('preserves %s labels, units and prices', (mode) => { + const cells = render(mediaModel(mode)).findAll('tbody td') + expect(cells[0].text()).toContain(mode === 'image' ? language.imageLabel : language.requestLabel) + expect(cells[1].text()).toContain(mode === 'image' ? language.imageSuffix : language.requestSuffix) + expect(cells[1].text()).toContain('$0.27') + expect(cells[1].text()).not.toContain(language.suffix) + expect(cells.at(-1)!.text()).toBe('0.5x') + }) + + it('preserves token columns, per-million prices and custom discounts', () => { + const model = mediaModel('video') + model.pricing = { + ...model.pricing!, billing_mode: 'token', input_price: 2e-6, output_price: 8e-6, + cache_write_price: 4e-6, cache_read_price: 1e-6, per_request_price: null + } + const wrapper = render(model, { userRateMultiplier: 0.25 }) + const cells = wrapper.findAll('tbody td') + expect(cells).toHaveLength(8) + expect(cells[0].text()).toBe(model.name) + expect(cells[1].text()).toBe('$0.50') + expect(cells[2].text()).toBe('$2.00') + expect(cells[3].text()).toContain('$1.00') + expect(cells[3].text()).toContain('$0.25') + expect(wrapper.find('thead').text()).toContain(language.locale === 'zh' ? '$ / 1M token' : '$ / 1M tokens') + expect(wrapper.find('tbody').text()).not.toContain(language.suffix) + expect(cells[7].text()).toContain('0.25x') + }) +}) diff --git a/frontend/src/i18n/locales/en/dashboard.ts b/frontend/src/i18n/locales/en/dashboard.ts index deb9d7e8640a..1d488abe1ed2 100644 --- a/frontend/src/i18n/locales/en/dashboard.ts +++ b/frontend/src/i18n/locales/en/dashboard.ts @@ -823,7 +823,9 @@ export default { unitPerMillion: '$ / 1M tokens', perUnitRequest: '/ request', perUnitImage: '/ image', + perUnitSecond: '/ second', perRequest: 'Per request', + perSecond: 'Per second', perImage: 'Per image' }, nav: { diff --git a/frontend/src/i18n/locales/zh/dashboard.ts b/frontend/src/i18n/locales/zh/dashboard.ts index 3740cb80fb76..4dcfcde70762 100644 --- a/frontend/src/i18n/locales/zh/dashboard.ts +++ b/frontend/src/i18n/locales/zh/dashboard.ts @@ -827,7 +827,9 @@ export default { unitPerMillion: '$ / 1M token', perUnitRequest: '/ 次', perUnitImage: '/ 张', + perUnitSecond: '/ 秒', perRequest: '按次计费', + perSecond: '按秒计费', perImage: '按图片计费' }, nav: { From 670f33b3facf7779be23779e19da50e783be4ab2 Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Fri, 13 Nov 2026 08:54:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?test:=20=E5=9C=A8=E8=BF=9C=E7=A8=8B=20CI=20?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E8=A7=86=E9=A2=91=E4=BB=B7=E5=8D=A1=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E4=B8=8E=E7=9C=9F=E5=AE=9E=20CSS=20=E5=89=8D=E5=90=8E?= =?UTF-8?q?=E6=88=AA=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../issue825-video-pricing-fixture.mjs | 53 ++++++++ .../issue825-video-pricing-screenshot.mjs | 100 +++++++++++++++ .github/workflows/issue825-video-pricing.yml | 120 ++++++++++++++++++ 3 files changed, 273 insertions(+) create mode 100644 .github/scripts/issue825-video-pricing-fixture.mjs create mode 100644 .github/scripts/issue825-video-pricing-screenshot.mjs create mode 100644 .github/workflows/issue825-video-pricing.yml diff --git a/.github/scripts/issue825-video-pricing-fixture.mjs b/.github/scripts/issue825-video-pricing-fixture.mjs new file mode 100644 index 000000000000..d87fa1c456d7 --- /dev/null +++ b/.github/scripts/issue825-video-pricing-fixture.mjs @@ -0,0 +1,53 @@ +// Synthetic data only; both source trees use this identical component harness. +import { createApp, h } from 'vue' +import { createI18n } from 'vue-i18n' +import Table from './src/components/modelPlaza/PlazaModelPricingTable.vue' +import zh from './src/i18n/locales/zh/dashboard.ts' +import en from './src/i18n/locales/en/dashboard.ts' +import './src/style.css' + +const locale = new URLSearchParams(location.search).get('lang') || 'zh' +document.documentElement.lang = locale +const price = (billing_mode, per_request_price) => ({ + billing_mode, per_request_price, input_price: null, output_price: null, + cache_write_price: null, cache_read_price: null, image_input_price: null, + image_output_price: null, intervals: [] +}) +const model = (name, pricing) => ({ name, platform: 'openai', pricing, official_pricing: null }) +const models = [ + model('demo-video-base', price('video', 0.54)), + model('demo-video-resolution', { + ...price('video', 0.54), + intervals: [0.54, 1.08].map((value, index) => ({ + ...price('video', value), min_tokens: 0, max_tokens: null, + tier_label: index === 0 ? '480p' : '720p' + })) + }), + model('demo-image', price('image', 0.2)), + model('demo-request', price('per_request', 0.04)), + model('demo-token', { + ...price('token', null), input_price: 2e-6, output_price: 8e-6, + cache_write_price: 4e-6, cache_read_price: 1e-6 + }) +] +const groups = [ + { id: 'group', title: 'Synthetic group rate 0.5', props: {} }, + { id: 'user', title: 'Synthetic user rate 0.25', props: { userRateMultiplier: 0.25 } }, + { id: 'independent', title: 'Synthetic video rate 2 / image rate 3', props: { + userRateMultiplier: 0.25, videoRateIndependent: true, videoRateMultiplier: 2, + imageRateIndependent: true, imageRateMultiplier: 3 + } } +] +const app = createApp({ + render: () => h('main', { class: 'min-h-screen bg-white p-6 text-gray-900 dark:bg-dark-900 dark:text-white' }, [ + h('h1', { class: 'mb-2 text-xl font-bold' }, `Model Plaza · ${locale} · synthetic component preview`), + h('p', { class: 'mb-4 text-sm text-gray-500' }, 'Actual Vue component, locale and application CSS. No API calls.'), + ...groups.map(group => h('section', { 'data-scenario': group.id, class: 'mb-5' }, [ + h('h2', { class: 'mb-2 font-semibold' }, group.title), + h(Table, { models, platform: 'openai', rateMultiplier: 0.5, ...group.props }) + ])) + ]) +}) +app.use(createI18n({ legacy: false, locale, messages: { zh, en } })) +app.mount('#app') +window.__issue825Ready = true diff --git a/.github/scripts/issue825-video-pricing-screenshot.mjs b/.github/scripts/issue825-video-pricing-screenshot.mjs new file mode 100644 index 000000000000..e66f2b4b8268 --- /dev/null +++ b/.github/scripts/issue825-video-pricing-screenshot.mjs @@ -0,0 +1,100 @@ +// Remote-only: same full-tree / actual CSS rendering pattern as upstream-v0221-screenshot.mjs. +import assert from 'node:assert/strict' +import { execFileSync } from 'node:child_process' +import { createHash } from 'node:crypto' +import { mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs' +import { createRequire } from 'node:module' +import { join, resolve } from 'node:path' +import { pathToFileURL } from 'node:url' + +const output = process.env.SCREENSHOT_DIR +assert.ok(output && process.env.SOURCE_BASE && process.env.BASELINE_ROOT && process.env.PLAYWRIGHT_ROOT) +const head = execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8' }).trim() +assert.equal(head, process.env.EXPECTED_HEAD_SHA) +mkdirSync(output, { recursive: true }) +const digest = path => createHash('sha256').update(readFileSync(path)).digest('hex') +const manifest = { + baseline: process.env.SOURCE_BASE, candidate: head, + boundary: 'Full baseline archive and exact candidate; actual Vue component, locales, style.css and original Tailwind. Identical synthetic props, no API calls or production data. Component preview only.', + screenshots: [], observations: [], sources: [], errors: [] +} +const { chromium } = await import(pathToFileURL(join(process.env.PLAYWRIGHT_ROOT, 'index.mjs')).href) +const browser = await chromium.launch({ headless: true }) +try { + for (const mode of ['before', 'after']) { + const root = resolve(mode === 'before' ? process.env.BASELINE_ROOT : 'frontend') + const require = createRequire(join(root, 'package.json')) + const { build, preview } = await import(pathToFileURL(join(root, 'node_modules/vite/dist/node/index.js')).href) + const vue = (await import(pathToFileURL(require.resolve('@vitejs/plugin-vue')).href)).default + const tailwind = (await import(pathToFileURL(join(root, 'tailwind.config.js')).href)).default + const tag = '.ci-issue825-' + process.pid + const paths = [join(root, tag + '.html'), join(root, tag + '.mjs')] + writeFileSync(paths[0], `
`) + writeFileSync(paths[1], readFileSync('.github/scripts/issue825-video-pricing-fixture.mjs')) + const sourcePaths = ['src/components/modelPlaza/PlazaModelPricingTable.vue', 'src/style.css', 'tailwind.config.js', 'src/i18n/locales/zh/dashboard.ts', 'src/i18n/locales/en/dashboard.ts'] + manifest.sources.push({ mode, sha: mode === 'before' ? process.env.SOURCE_BASE : head, files: sourcePaths.map(path => ({ path, sha256: digest(join(root, path)) })) }) + const buildDir = join(output, mode + '-build') + let server + try { + await build({ + root, configFile: false, cacheDir: join(output, mode + '-cache'), plugins: [vue()], + resolve: { alias: { '@': join(root, 'src'), 'vue-i18n': require.resolve('vue-i18n/dist/vue-i18n.runtime.esm-bundler.js') } }, + define: { __INTLIFY_JIT_COMPILATION__: true }, + css: { postcss: { plugins: [require('tailwindcss')({ ...tailwind, content: [...paths, join(root, 'src/**/*.{vue,js,ts}')] }), require('autoprefixer')()] } }, + build: { outDir: buildDir, emptyOutDir: true, minify: false, target: 'esnext', rollupOptions: { input: paths[0] } } + }) + server = await preview({ root, configFile: false, build: { outDir: buildDir }, preview: { host: '127.0.0.1', port: 4199, strictPort: true } }) + for (const lang of ['zh', 'en']) { + const page = await browser.newPage({ viewport: { width: 1440, height: 1100 }, locale: lang === 'zh' ? 'zh-CN' : 'en-US', timezoneId: 'UTC' }) + page.on('pageerror', error => manifest.errors.push(`${mode}/${lang}: ${error.message}`)) + await page.route('**/*', route => new URL(route.request().url()).origin === 'http://127.0.0.1:4199' ? route.continue() : route.abort()) + try { + await page.goto(`http://127.0.0.1:4199/${tag}.html?lang=${lang}`) + await page.waitForFunction(() => window.__issue825Ready) + await page.evaluate(async () => { await document.fonts.ready; await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve))) }) + const observed = await page.locator('section').evaluateAll(sections => sections.map(section => ({ + scenario: section.dataset.scenario, + rows: [...section.querySelectorAll('tbody tr')].map(row => [...row.querySelectorAll('td')].map(cell => cell.innerText.trim())) + }))) + const label = lang === 'zh' ? (mode === 'before' ? '按次计费' : '按秒计费') : (mode === 'before' ? 'Per request' : 'Per second') + const suffix = lang === 'zh' ? (mode === 'before' ? '/ 次' : '/ 秒') : (mode === 'before' ? '/ request' : '/ second') + const prices = { group: ['$0.27', '$0.54'], user: ['$0.135', '$0.27'], independent: ['$1.08', '$2.16'] } + for (const section of observed) { + const videos = section.rows.filter(row => row[0].startsWith('demo-video')) + assert.equal(videos.length, 2) + for (const row of videos) { + assert.ok(row[0].includes(label), JSON.stringify(row)) + assert.ok(row[1].includes(suffix), JSON.stringify(row)) + assert.ok(row[1].includes(prices[section.scenario][0]), JSON.stringify(row)) + if (row[0].startsWith('demo-video-resolution')) { + assert.ok(row[1].includes('480p') && row[1].includes('720p')) + assert.ok(row[1].includes(prices[section.scenario][1])) + } + } + } + const css = await page.locator('table').first().evaluate(table => ({ fontSize: getComputedStyle(table).fontSize, minWidth: getComputedStyle(table).minWidth, borderCollapse: getComputedStyle(table).borderCollapse })) + assert.equal(css.minWidth, '1000px') + assert.equal(css.fontSize, '14px') + manifest.observations.push({ mode, lang, css, sections: observed }) + for (const theme of ['light', 'dark']) { + await page.evaluate(value => document.documentElement.classList.toggle('dark', value === 'dark'), theme) + await page.evaluate(() => new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)))) + const name = `${mode}-${lang}-${theme}.png` + await page.screenshot({ path: join(output, name), fullPage: true, animations: 'disabled' }) + manifest.screenshots.push({ name, sha: mode === 'before' ? process.env.SOURCE_BASE : head, sha256: digest(join(output, name)) }) + } + console.log(JSON.stringify({ mode, lang, label, suffix, css, scenarios: observed.length })) + } finally { await page.close() } + } + } finally { + if (server) await new Promise(resolve => server.httpServer.close(resolve)) + paths.forEach(path => rmSync(path, { force: true })) + rmSync(buildDir, { recursive: true, force: true }) + rmSync(join(output, mode + '-cache'), { recursive: true, force: true }) + } + } + assert.deepEqual(manifest.errors, []) +} finally { + writeFileSync(join(output, 'manifest.json'), JSON.stringify(manifest, null, 2) + '\n') + await browser.close() +} diff --git a/.github/workflows/issue825-video-pricing.yml b/.github/workflows/issue825-video-pricing.yml new file mode 100644 index 000000000000..2a9de6b2a57f --- /dev/null +++ b/.github/workflows/issue825-video-pricing.yml @@ -0,0 +1,120 @@ +name: Issue825 video pricing units +on: + push: + branches: [fix/issue825-video-pricing-unit] + pull_request: + branches: [production] +permissions: + contents: read +env: + EXPECTED_HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + SOURCE_BASE: c424f8217da12cd4fb8d10aeaf1c4f2592c3f286 +jobs: + regression: + if: github.head_ref == 'fix/issue825-video-pricing-unit' || github.ref_name == 'fix/issue825-video-pricing-unit' + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + persist-credentials: false + - name: Assert exact candidate + run: test "$(git rev-parse HEAD)" = "$EXPECTED_HEAD_SHA" + - uses: pnpm/action-setup@v6 + with: + version: 9 + - uses: actions/setup-node@v6 + with: + node-version: '22' + cache: pnpm + cache-dependency-path: frontend/pnpm-lock.yaml + - run: pnpm --dir frontend install --frozen-lockfile + - name: Real pricing components and locale completeness (GREEN) + run: | + set -euo pipefail + mkdir -p "$RUNNER_TEMP/issue825-tests" + pnpm --dir frontend exec vitest run src/components/modelPlaza/__tests__/PlazaModelPricingTable.spec.ts src/components/modelPlaza/__tests__/PlazaModelPricingTable.video.spec.ts src/i18n/__tests__/localeKeyCompleteness.spec.ts --reporter=verbose 2>&1 | tee "$RUNNER_TEMP/issue825-tests/green.log" + - name: Same localized component regression against fixed defective source (RED) + env: + EVIDENCE_DIR: ${{ runner.temp }}/issue825-tests + run: | + set -euo pipefail + for file in frontend/src/components/modelPlaza/PlazaModelPricingTable.vue frontend/src/i18n/locales/zh/dashboard.ts frontend/src/i18n/locales/en/dashboard.ts; do + git show "$SOURCE_BASE:$file" > "$file" + done + set +e + pnpm --dir frontend exec vitest run src/components/modelPlaza/__tests__/PlazaModelPricingTable.video.spec.ts --reporter=verbose --reporter=json --outputFile="$EVIDENCE_DIR/red.json" > "$EVIDENCE_DIR/red.log" 2>&1 + result=$? + set -e + cat "$EVIDENCE_DIR/red.log" + test "$result" -ne 0 + node --input-type=module <<'JS' + import assert from 'node:assert/strict' + import { readFileSync } from 'node:fs' + const report = JSON.parse(readFileSync(`${process.env.EVIDENCE_DIR}/red.json`, 'utf8')) + assert.equal(report.numFailedTests, 10) + assert.equal(report.numPassedTests, 6) + const failures = report.testResults.flatMap(file => file.assertionResults).filter(test => test.status === 'failed') + assert.equal(failures.length, 10) + for (const test of failures) { + assert.ok(test.fullName.includes('shows seconds and preserves')) + assert.ok(test.failureMessages.join('\n').includes('to contain')) + } + console.log('RED confirmed: 10 video label assertions fail; 6 image/request/token controls pass') + JS + - uses: actions/upload-artifact@v7 + if: always() + with: + name: issue825-tests-${{ github.event_name }}-${{ github.event.pull_request.head.sha || github.sha }} + path: ${{ runner.temp }}/issue825-tests + if-no-files-found: error + rendered: + if: github.head_ref == 'fix/issue825-video-pricing-unit' || github.ref_name == 'fix/issue825-video-pricing-unit' + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + persist-credentials: false + - name: Assert exact candidate + run: test "$(git rev-parse HEAD)" = "$EXPECTED_HEAD_SHA" + - uses: pnpm/action-setup@v6 + with: + version: 9 + - uses: actions/setup-node@v6 + with: + node-version: '22' + cache: pnpm + cache-dependency-path: frontend/pnpm-lock.yaml + - run: pnpm --dir frontend install --frozen-lockfile + - name: Preserve complete baseline archive + run: | + set -euo pipefail + mkdir -p "$RUNNER_TEMP/issue825-baseline" + git archive "$SOURCE_BASE" | tar -x -C "$RUNNER_TEMP/issue825-baseline" + cmp frontend/package.json "$RUNNER_TEMP/issue825-baseline/frontend/package.json" + cmp frontend/pnpm-lock.yaml "$RUNNER_TEMP/issue825-baseline/frontend/pnpm-lock.yaml" + ln -s "$GITHUB_WORKSPACE/frontend/node_modules" "$RUNNER_TEMP/issue825-baseline/frontend/node_modules" + - name: Install isolated browser remotely + run: | + npm install --prefix "$RUNNER_TEMP/issue825-browser" --no-save --ignore-scripts playwright@1.56.1 + "$RUNNER_TEMP/issue825-browser/node_modules/.bin/playwright" install --with-deps chromium + - name: Render actual baseline and candidate components with real CSS + env: + BASELINE_ROOT: ${{ runner.temp }}/issue825-baseline/frontend + PLAYWRIGHT_ROOT: ${{ runner.temp }}/issue825-browser/node_modules/playwright + SCREENSHOT_DIR: ${{ runner.temp }}/issue825-ui + run: | + set -euo pipefail + mkdir -p "$SCREENSHOT_DIR" + node .github/scripts/issue825-video-pricing-screenshot.mjs 2>&1 | tee "$SCREENSHOT_DIR/render.log" + - uses: actions/upload-artifact@v7 + if: always() + with: + name: issue825-ui-${{ github.event_name }}-${{ github.event.pull_request.head.sha || github.sha }} + path: ${{ runner.temp }}/issue825-ui + if-no-files-found: error