A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
feat(playable): preview creatives in local mock containers
yhh606a72ed7316
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 61e8660e6..bcd2460b7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,8 @@ published separately; it ships inside the editor.### Added+- **Playable creatives have a local container preview.** A CLI server simulates MRAID, Mintegral and page-visibility callbacks, records store gestures without opening a store, and switches portrait/landscape viewports. It opens no browser and preserves the delivered HTML; export-report hashes prevent mixing records from different builds. Logs remain marked as local mocks rather than network approval.+- **Playable exports report static checks and pending acceptance.** Export results and the editor package dialog show actual HTML/delivery hashes, network size limits, literal resource references and orientation config checks. Mandatory network SDK scripts are allowed explicitly. CTA, lifecycle, dynamic requests and device/network acceptance remain pending runtime evidence, including when static checks pass.### Fixeddiff --git a/docs/astro/src/content/docs/publishing/overview.mdx b/docs/astro/src/content/docs/publishing/overview.mdxindex c805a8af4..98efa5b64 100644--- a/docs/astro/src/content/docs/publishing/overview.mdx+++ b/docs/astro/src/content/docs/publishing/overview.mdx@@ -126,6 +126,8 @@ MRAID store buttons must pass a destination with `playableCta(storeUrl)` or usePlayable exports include `playableCheck` in their result; the package dialog displays it and the CLI can save it with `--json report.json`. Checks measure the actual delivered file, identify HTML/CSS resource references and validate required orientation config. Exact mandatory host SDK scripts are allowed by the selected profile. File hashes tie the findings to this export. CTA, host lifecycle, dynamic requests and device/network acceptance remain pending runtime verification. The report does not claim that a bridge declaration proves a successful store click.+Use `pnpm preview:playable path/to/index.html --report export-result.json` from the engine repository for a local container mock. It prints a loopback URL and does not open a browser. Ready, Show and Hide simulate host callbacks; the viewport selector changes aspect ratio, and Save Log records store calls with the original HTML hash. MRAID can use `--store-url` for your destination. The served copy substitutes mandatory SDK scripts and blocks external requests; the delivered HTML stays unchanged. These mock records do not replace official SDK or device acceptance.+### A network we don't shipDefine it yourself — the built-in networks are written against this exact contract,diff --git a/docs/astro/src/content/docs/zh-cn/publishing/overview.mdx b/docs/astro/src/content/docs/zh-cn/publishing/overview.mdxindex a43e27b83..472df1b74 100644--- a/docs/astro/src/content/docs/zh-cn/publishing/overview.mdx+++ b/docs/astro/src/content/docs/zh-cn/publishing/overview.mdx@@ -110,6 +110,8 @@ MRAID 安装按钮须通过 `playableCta(storeUrl)` 传入目标地址,或由试玩导出结果包含 `playableCheck`,打包窗口可查看,命令行可通过 `--json report.json` 保存。报告测量实际交付文件,检查 HTML/CSS 资源引用及必需的方向配置;只按所选 profile 放行指定的宿主 SDK 脚本。文件哈希将检查结果对应到本次导出。CTA、宿主生命周期、动态请求和设备/平台验收保持待运行验证,不把接口声明算作商店跳转成功。+在引擎仓库执行 `pnpm preview:playable path/to/index.html --report export-result.json` 可启动本地容器模拟,只打印回环地址,不自动打开浏览器。Ready、Show、Hide 模拟宿主回调,可切换横竖屏;Save Log 保存商店调用及原 HTML 哈希。MRAID 可通过 `--store-url` 配置商店地址。预览副本替换必需 SDK 并阻止外部请求,原导出 HTML 不变;模拟记录不代替官方 SDK 或真机验收。+### 我们没内置的平台自己定义就行——内置的那几家写的就是这份契约,没有做不到的事。**打包项目 → 新建平台** 可以diff --git a/examples/playable-ad/README.md b/examples/playable-ad/README.mdindex 044488751..9b61da7f3 100644--- a/examples/playable-ad/README.md+++ b/examples/playable-ad/README.md@@ -46,3 +46,33 @@ or inspect it in the editor’s package result. It records HTML/delivery hashes,network budgets, literal resource references and required orientation config.CTA, host lifecycle, dynamic requests and network/device acceptance remain markedfor runtime verification; a static pass does not imply ad approval.++## Local container preview++After exporting, run from the engine repository:++```sh+pnpm preview:playable output/preview-mintegral/index.html --report output/preview-mintegral.json+pnpm preview:playable output/preview-unity/index.html --report output/preview-unity.json --store-url https://example.com/your-store-url+```++The command prints a loopback URL and opens no browser. Open the URL yourself when+wanted. The source HTML is read once, remains unchanged, and is identified by its+SHA256; restart the command after exporting a new build. `--report` verifies the+file hash and derives the network from the export result. Without a report, choose+`--network mintegral`, `mraid`, `unity`, `applovin`, `tiktok`, `pangle`, `google`,+`meta`, or `generic` explicitly.++For MRAID, Ready releases the host-loading state, then Show makes the ad viewable.+Mintegral announces Creative Ready after resources load; Show calls gameStart and+Hide calls gameClose. Completion and close stay separate. The creative's Try Again+button calls gameRetry; reloading the iframe restarts the whole scene. TikTok/Pangle+mock their mandatory SDK and observe page visibility. Google/Meta expose their+store hooks; their lifecycle still needs the real network container.++The viewport selector checks portrait and landscape. Store calls are logged rather+than opened; enter your own store destination for MRAID. Save Log downloads a JSON+record marked `local-mock`, with the original HTML hash. External requests are+blocked in this preview and recorded as violations, so this is a controlled mock,+not proof of the original package's behavior in the real SDK. Official previews+and physical devices remain separate acceptance steps.diff --git a/package.json b/package.jsonindex a6692800f..9bcd1f9a9 100644--- a/package.json+++ b/package.json@@ -41,7 +41,8 @@"verify:glx": "node tools/verify-glx-fallback.mjs","verify:remote-capture": "node tools/verify-remote-capture.mjs --platform web && node tools/verify-remote-capture.mjs --platform wechat","verify:hotupdate": "node tools/with-env.mjs ESTELLA_HOTUPDATE_FIXTURE=1 -- pnpm --filter @estella/pipeline exec vitest run tests/hotupdate-verify-fixture.test.ts && node tools/run-electron.mjs tools/launchers/headless-hotupdate-verify.mjs",- "verify:cache-budget": "node tools/run-electron.mjs tools/launchers/cache-budget-render-verify.mjs"+ "verify:cache-budget": "node tools/run-electron.mjs tools/launchers/cache-budget-render-verify.mjs",+ "preview:playable": "node tools/playable-preview.mjs"},"dependencies": {"chalk": "^5.3.0",diff --git a/tools/playable-preview.mjs b/tools/playable-preview.mjsnew file mode 100644index 000000000..b08785d14--- /dev/null+++ b/tools/playable-preview.mjs@@ -0,0 +1,150 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+import { createServer } from 'node:http';+import { readFile } from 'node:fs/promises';+import { createHash } from 'node:crypto';+import path from 'node:path';+import { fileURLToPath } from 'node:url';++const NETWORKS = ['generic', 'mraid', 'unity', 'applovin', 'mintegral', 'tiktok', 'pangle', 'google', 'meta'];+const SDKS = [+ 'https://sf16-muse-va.ibytedtos.com/obj/union-fe-nc-i18n/playable/sdk/playable-sdk.js',+ 'https://tpc.googlesyndication.com/pagead/gadgets/html5/api/exitapi.js',+];+const safeJson = value => JSON.stringify(value).replace(/</g, '\\u003c');++/** The mocked host runs before creative scripts; it never opens a store. */+function installHost(config) {+ const source = 'estella-playable-preview', origin = location.origin;+ const events = new Map();+ let ready = false, visible = false, state = 'loading';+ const emit = (name, data = {}) => parent.postMessage({ source, type: 'event', name, data,+ gesture: !!navigator.userActivation?.isActive }, origin);+ const fire = (name, ...args) => events.get(name)?.forEach(fn => fn(...args));+ const visibility = value => {+ visible = value;+ if (ready) state = value ? 'default' : 'hidden';+ fire('viewableChange', value);+ document.dispatchEvent(new Event('visibilitychange'));+ };+ const warn = console.warn;+ console.warn = (...args) => { warn.apply(console, args); emit('console-warning', { message: args.map(String).join(' ') }); };+ window.__PLAYABLE_PREVIEW_EMIT__ = emit;+ if (config.storeUrl) window.clickTag = config.storeUrl;+ if (['mraid', 'unity', 'applovin'].includes(config.network)) {+ window.mraid = {+ getVersion: () => '3.0', getState: () => state, isViewable: () => visible,+ supports: () => false,+ addEventListener(name, fn) { if (!events.has(name)) events.set(name, new Set()); events.get(name).add(fn); emit('listener-added', { name }); },+ removeEventListener(name, fn) { events.get(name)?.delete(fn); },+ open: url => emit('store-click', { url }),+ };+ }+ if (config.network === 'mintegral') {+ window.install = () => emit('store-click');+ window.gameReady = () => { ready = true; emit('creative-ready'); };+ window.gameEnd = () => emit('game-end');+ window.gameRetry = () => { emit('game-retry'); window.gameStart?.(); };+ }+ if (['tiktok', 'pangle'].includes(config.network)) {+ Object.defineProperty(document, 'hidden', { configurable: true, get: () => !visible });+ window.openAppStore = () => emit('store-click');+ }+ if (config.network === 'meta') window.FbPlayableAd = { onCTAClick: () => emit('store-click') };+ if (config.network === 'google') window.ExitApi = { exit: () => emit('store-click') };+ window.addEventListener('error', event => emit('page-error', { message: event.message }));+ window.addEventListener('unhandledrejection', event => emit('page-error', { message: String(event.reason) }));+ document.addEventListener('securitypolicyviolation', event => emit('blocked-request', { url: event.blockedURI }));+ window.addEventListener('message', event => {+ if (event.source !== parent || event.origin !== origin || event.data?.source !== source || event.data.type !== 'command') return;+ const command = event.data.command;+ if (command === 'ready') {+ if (config.network === 'mintegral') { emit('notice', { message: 'Mintegral announces readiness from the creative.' }); return; }+ ready = true; state = 'default'; fire('ready');+ } else if (command === 'show') { visibility(true); if (config.network === 'mintegral') window.gameStart?.(); }+ else if (command === 'hide') { visibility(false); if (config.network === 'mintegral') window.gameClose?.(); }+ emit('host-command', { command, ready, visible });+ });+ emit('mock-installed', { network: config.network });+}++function viewer(config) {+ return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">+<title>Playable container preview</title><style>+body{margin:0;background:#141923;color:#e8edf6;font:14px system-ui}main{max-width:1160px;margin:24px auto;padding:0 20px}+h1{font-size:22px;margin:0 0 8px}.note{color:#bbc5d5;line-height:1.5}.controls{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:16px 0}+button,input,select{font:inherit;border:1px solid #61718a;border-radius:6px;padding:8px;background:#232d3e;color:inherit}button{cursor:pointer}button:hover{background:#34445d}input{min-width:280px;flex:1}+.layout{display:flex;gap:20px;align-items:flex-start;flex-wrap:wrap}iframe{border:1px solid #61718a;background:#0b1019;display:block;max-width:100%}+.events{flex:1;min-width:260px;max-width:700px}#events{padding-left:20px;max-height:500px;overflow:auto;overflow-wrap:anywhere;line-height:1.6}.identity{font-size:12px;color:#bbc5d5;overflow-wrap:anywhere}+</style></head><body><main><h1>Local playable container / 本地试玩容器</h1>+<p class="note">Mock host callbacks only. Store clicks are recorded, not opened. This is not network approval or device acceptance.<br>仅模拟宿主回调,记录商店点击,不打开商店;不代表平台审核或真机验收。</p>+<div class="identity" id="identity"></div><div class="controls">+<button data-command="ready">Ready / 准备</button><button data-command="show">Show / 显示</button><button data-command="hide">Hide / 隐藏</button>+<label>Viewport / 视口 <select id="viewport"><option value="360,640">360 × 640</option><option value="800,400">800 × 400</option></select></label>+<input id="store-url" aria-label="Store URL" placeholder="MRAID store URL / 商店地址"><button id="reload">Reload / 重载</button><button id="save">Save log / 保存记录</button></div>+<div class="layout"><iframe id="creative" title="Playable creative" width="360" height="640"></iframe><section class="events"><h2>Host events / 宿主事件</h2><ol id="events"></ol></section></div></main>+<script>+const config=${safeJson(config)},source='estella-playable-preview',frame=document.getElementById('creative'),events=[];+window.previewEvents=events;document.getElementById('identity').textContent=config.network+' · HTML SHA256 '+config.htmlSha256;+document.getElementById('store-url').value=config.storeUrl||'';+const load=()=>{frame.src='/creative?store='+encodeURIComponent(document.getElementById('store-url').value);};+document.querySelectorAll('[data-command]').forEach(button=>button.onclick=()=>frame.contentWindow.postMessage({source,type:'command',command:button.dataset.command},location.origin));+document.getElementById('reload').onclick=load;+document.getElementById('viewport').onchange=event=>{const [w,h]=event.target.value.split(',');frame.width=w;frame.height=h;};+window.addEventListener('message',event=>{if(event.source!==frame.contentWindow||event.origin!==location.origin||event.data?.source!==source||event.data.type!=='event')return;+const record={...event.data,timeMs:Math.round(performance.now())};events.push(record);if(events.length>1000)events.shift();const item=document.createElement('li');item.textContent=record.name+' '+JSON.stringify(record.data)+(record.gesture?' [gesture]':'');document.getElementById('events').append(item);if(document.getElementById('events').children.length>1000)document.getElementById('events').firstChild.remove();});+document.getElementById('save').onclick=()=>{const blob=new Blob([JSON.stringify({mode:'local-mock',network:config.network,htmlSha256:config.htmlSha256,events},null,2)],{type:'application/json'});const url=URL.createObjectURL(blob);const link=document.createElement('a');link.href=url;link.download='playable-preview-log.json';link.click();setTimeout(()=>URL.revokeObjectURL(url),1000);};load();+</script></body></html>`;+}++export async function createPlayablePreview({ htmlFile, network, storeUrl = '', reportFile, port = 0 }) {+ const html = await readFile(htmlFile);+ const htmlSha256 = createHash('sha256').update(html).digest('hex');+ if (reportFile) {+ const result = JSON.parse(await readFile(reportFile, 'utf8'));+ const report = result.playableCheck ?? result;+ if (report.htmlSha256 !== htmlSha256) throw new Error('The report does not describe this HTML file. Export it again.');+ if (network && network !== report.network) throw new Error('The selected network differs from the export report.');+ network = report.network;+ }+ if (!NETWORKS.includes(network)) throw new Error(`Choose --network ${NETWORKS.join('|')} or supply --report export-result.json.`);+ if (!Number.isInteger(port) || port < 0 || port > 65535) throw new Error('Port must be an integer from 0 to 65535.');+ if (!/<head\b[^>]*>/i.test(html.toString('utf8'))) throw new Error('The creative needs an explicit HTML head.');+ const config = { network, storeUrl, htmlSha256 };+ const server = createServer((request, response) => {+ const url = new URL(request.url, 'http://127.0.0.1');+ response.setHeader('Cache-Control', 'no-store');+ response.setHeader('Content-Security-Policy', "default-src 'self' data: blob:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:; style-src 'self' 'unsafe-inline'; connect-src 'self' blob:; img-src 'self' data: blob:");+ if (request.method !== 'GET') { response.writeHead(405); response.end(); return; }+ if (url.pathname === '/') { response.setHeader('Content-Type', 'text/html; charset=utf-8'); response.end(viewer(config)); }+ else if (url.pathname === '/creative') {+ const creativeConfig = { ...config, storeUrl: url.searchParams.get('store') ?? storeUrl };+ let document = html.toString('utf8');+ for (const sdk of SDKS) document = document.replaceAll(sdk, '/host-sdk.js');+ document = document.replace(/<head\b[^>]*>/i, match => `${match}<script>(${installHost.toString()})(${safeJson(creativeConfig)});</script>`);+ response.setHeader('Content-Type', 'text/html; charset=utf-8'); response.end(document);+ } else if (url.pathname === '/host-sdk.js') {+ response.setHeader('Content-Type', 'text/javascript; charset=utf-8');+ response.end('window.openAppStore=function(){window.__PLAYABLE_PREVIEW_EMIT__("store-click")};window.ExitApi={exit:window.openAppStore};');+ } else if (url.pathname === '/favicon.ico') { response.writeHead(204); response.end(); }+ else { response.writeHead(404); response.end('Not found'); }+ });+ await new Promise((resolve, reject) => { server.once('error', reject); server.listen(port, '127.0.0.1', resolve); });+ return { server, url: `http://127.0.0.1:${server.address().port}/`, htmlSha256,+ close: () => new Promise(resolve => { server.close(resolve); server.closeAllConnections?.(); }) };+}++if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {+ const args = process.argv.slice(2);+ const option = name => { const index = args.indexOf(`--${name}`); return index < 0 ? undefined : args[index + 1]; };+ if (!args[0] || args.includes('--help')) {+ console.log('node tools/playable-preview.mjs <index.html> --network <id> [--store-url <url>] [--report <export-result.json>] [--port <number>]\nStarts a local mock only; does not open a browser or modify the creative.');+ } else {+ createPlayablePreview({ htmlFile: path.resolve(args[0]), network: option('network'), storeUrl: option('store-url'),+ reportFile: option('report'), port: Number(option('port') ?? 0) }).then(preview => {+ console.log(`Local mock: ${preview.url}\nHTML SHA256: ${preview.htmlSha256}\nNo browser opened. Press Ctrl+C to stop.`);+ process.once('SIGINT', () => preview.close().then(() => process.exit(0)));+ process.once('SIGTERM', () => preview.close().then(() => process.exit(0)));+ }).catch(error => { console.error(error.message); process.exitCode = 1; });+ }+}diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex 83159b2f7..7f2911c43 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -34,6 +34,8 @@ export const NOTED = {{ note: 'Small nine-slice visuals keep borders inside their box.' },'fix(docs): escape playable size limits in MDX':{ internal: 'escapes a less-than sign in both translations so the existing size-limit text compiles as MDX and the release website can deploy' },+ 'feat(playable): preview creatives in local mock containers':+ { note: 'Playable creatives have a local container preview.' },'feat(playable): report export checks and pending acceptance':{ note: 'Playable exports report static checks and pending acceptance.' },'feat(editor): show playable export checks in package results':diff --git a/tools/tests/playable-preview.test.ts b/tools/tests/playable-preview.test.tsnew file mode 100644index 000000000..3adc68309--- /dev/null+++ b/tools/tests/playable-preview.test.ts@@ -0,0 +1,86 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+import { describe, it, expect } from 'vitest';+import { mkdtemp, writeFile, readFile, rm } from 'node:fs/promises';+import { tmpdir } from 'node:os';+import path from 'node:path';+import { runInNewContext } from 'node:vm';+import { createPlayablePreview } from '../playable-preview.mjs';++async function fixture(network: string, run: (preview: any, file: string) => Promise<void>) {+ const root = await mkdtemp(path.join(tmpdir(), 'estella-playable-preview-'));+ const file = path.join(root, 'index.html');+ const html = '<!doctype html><html><head><script src="https://sf16-muse-va.ibytedtos.com/obj/union-fe-nc-i18n/playable/sdk/playable-sdk.js"></script></head><body>Creative</body></html>';+ await writeFile(file, html);+ let preview: any;+ try { preview = await createPlayablePreview({ htmlFile: file, network }); await run(preview, file); }+ finally {+ await preview?.close();+ const target = path.resolve(root), temp = path.resolve(tmpdir());+ if (!target.startsWith(temp + path.sep) || !path.basename(target).startsWith('estella-playable-preview-')) throw new Error('Unexpected fixture cleanup path');+ await rm(target, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });+ }+}++describe('local playable mock', () => {+ it('serves an instrumented copy without changing the delivered file or exposing arbitrary files', async () => {+ await fixture('pangle', async (preview, file) => {+ const original = await readFile(file, 'utf8');+ const home = await (await fetch(preview.url)).text();+ expect(home).toContain('Mock host callbacks only');+ expect(home).toContain(preview.htmlSha256);+ const response = await fetch(preview.url + 'creative');+ expect(response.headers.get('content-security-policy')).toContain("connect-src 'self'");+ const creative = await response.text();+ expect(creative).toContain('installHost'); expect(creative).toContain('src="/host-sdk.js"');+ expect(await readFile(file, 'utf8')).toBe(original);+ expect((await fetch(preview.url + '../package.json')).status).toBe(404);+ });+ });++ it('refuses mismatched artifact identity and network before starting a server', async () => {+ await fixture('mraid', async (preview, file) => {+ const reportFile = path.join(path.dirname(file), 'report.json');+ await writeFile(reportFile, JSON.stringify({ playableCheck: { network: 'mraid', htmlSha256: 'stale' } }));+ await expect(createPlayablePreview({ htmlFile: file, reportFile })).rejects.toThrow(/does not describe/);+ await writeFile(reportFile, JSON.stringify({ network: 'mraid', htmlSha256: preview.htmlSha256 }));+ await expect(createPlayablePreview({ htmlFile: file, reportFile, network: 'mintegral' })).rejects.toThrow(/differs/);+ });+ });++ it('keeps completion independent of close and reports creative-owned readiness', async () => {+ await fixture('mintegral', async preview => {+ const creative = await (await fetch(preview.url + 'creative')).text();+ const source = /<script>([\s\S]*?)<\/script>/.exec(creative)![1];+ const messages: any[] = []; let closes = 0, starts = 0;+ const window: any = { addEventListener() {}, gameClose: () => closes++, gameStart: () => starts++ };+ runInNewContext(source, { window, document: { addEventListener() {}, dispatchEvent() {} }, parent: { postMessage: (value: any) => messages.push(value) }, location: { origin: 'http://local' }, navigator: {}, console: { warn() {} }, Event, URL });+ window.gameReady(); window.gameEnd(); expect(closes).toBe(0);+ expect(messages.map(message => message.name)).toContain('creative-ready');+ expect(messages.map(message => message.name)).toContain('game-end');+ window.gameRetry(); expect(starts).toBe(1);+ });+ });++ it('emits genuine mock callbacks and ignores commands from an unrelated frame', async () => {+ await fixture('mraid', async preview => {+ const creative = await (await fetch(preview.url + 'creative?store=https%3A%2F%2Fexample.com%2Fstore')).text();+ const source = /<script>([\s\S]*?)<\/script>/.exec(creative)![1];+ const messages: any[] = [], handlers: Record<string, Function> = {};+ const parent = { postMessage: (value: any) => messages.push(value) };+ const window: any = { addEventListener: (name: string, fn: Function) => { handlers[name] = fn; } };+ const document = { addEventListener() {}, dispatchEvent() {} };+ runInNewContext(source, { window, document, parent, location: { origin: 'http://local' }, navigator: { userActivation: { isActive: false } }, console: { warn() {} }, Event, URL });+ const ready = () => messages.push({ readyCallback: true }); window.mraid.addEventListener('ready', ready);+ const command = (name: string, owner = parent) => handlers.message({ source: owner, origin: 'http://local', data: { source: 'estella-playable-preview', type: 'command', command: name } });+ command('ready', {}); expect(window.mraid.getState()).toBe('loading');+ command('ready'); expect(messages.some(message => message.readyCallback)).toBe(true);+ expect(window.mraid.getState()).toBe('default'); expect(window.mraid.isViewable()).toBe(false);+ command('show'); expect(window.mraid.isViewable()).toBe(true);+ command('hide'); expect(window.mraid.isViewable()).toBe(false);+ window.mraid.open(window.clickTag);+ expect(messages.find(message => message.name === 'store-click').data.url).toBe('https://example.com/store');+ window.mraid.removeEventListener('ready', ready);+ });+ });+});