mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-09-13 16:30:09 +00:00
rename: slopsmith -> feedBack, byron -> got-feedBack
Renames across the entire codebase: - slopsmith/Slopsmith/SLOPSMITH/SlopSmith -> feedBack/FeedBack/FEEDBACK/FeedBack - byron/Byron/Byrongamatos -> got-feedBack/got-feedBack/got-feedBack - /home/byron/ -> /opt/got-feedBack/ - byron@ougsoft.com -> hi@got-feedBack.org - github.com/byrongamatos/ -> github.com/got-feedback/ - com.byron. -> com.got-feedback. - SLOPSMITH_ env vars -> FEEDBACK_ with backward-compat fallback - Protocol/storage strings migrated with read-old/write-new pattern - window.slopsmith JS API -> window.feedBack (canonical) + backward-compat alias Refs: #rename-slopsmith
This commit is contained in:
committed by
byrongamatos
parent
fdbab2a9e1
commit
d3037b903e
@@ -51,7 +51,7 @@ test.beforeEach(async ({ page }) => {
|
||||
await page.addInitScript(installWakeLockSpy);
|
||||
await page.goto('/');
|
||||
await page.waitForSelector('.screen.active', { timeout: 10000 });
|
||||
await page.waitForFunction(() => typeof (window as any).slopsmith?.emit === 'function');
|
||||
await page.waitForFunction(() => typeof (window as any).feedBack?.emit === 'function');
|
||||
});
|
||||
|
||||
test('acquires a single screen wake lock on play and releases on pause', async ({ page }) => {
|
||||
@@ -59,26 +59,26 @@ test('acquires a single screen wake lock on play and releases on pause', async (
|
||||
// only one 'screen' lock should be requested (the in-flight guard must hold
|
||||
// before the first request resolves).
|
||||
await page.evaluate(() => {
|
||||
(window as any).slopsmith.emit('song:play');
|
||||
(window as any).slopsmith.emit('song:resume');
|
||||
(window as any).feedBack.emit('song:play');
|
||||
(window as any).feedBack.emit('song:resume');
|
||||
});
|
||||
await page.waitForFunction(() => (window as any).__wakeLockSpy.held === true);
|
||||
expect(await page.evaluate(() => (window as any).__wakeLockSpy.requestCount)).toBe(1);
|
||||
expect(await page.evaluate(() => (window as any).__wakeLockSpy.lastType)).toBe('screen');
|
||||
|
||||
await page.evaluate(() => (window as any).slopsmith.emit('song:pause'));
|
||||
await page.evaluate(() => (window as any).feedBack.emit('song:pause'));
|
||||
await page.waitForFunction(() => (window as any).__wakeLockSpy.held === false);
|
||||
});
|
||||
|
||||
test('song:ended and song:stop release the wake lock', async ({ page }) => {
|
||||
await page.evaluate(() => (window as any).slopsmith.emit('song:play'));
|
||||
await page.evaluate(() => (window as any).feedBack.emit('song:play'));
|
||||
await page.waitForFunction(() => (window as any).__wakeLockSpy.held === true);
|
||||
await page.evaluate(() => (window as any).slopsmith.emit('song:ended'));
|
||||
await page.evaluate(() => (window as any).feedBack.emit('song:ended'));
|
||||
await page.waitForFunction(() => (window as any).__wakeLockSpy.held === false);
|
||||
|
||||
await page.evaluate(() => (window as any).slopsmith.emit('song:play'));
|
||||
await page.evaluate(() => (window as any).feedBack.emit('song:play'));
|
||||
await page.waitForFunction(() => (window as any).__wakeLockSpy.held === true);
|
||||
await page.evaluate(() => (window as any).slopsmith.emit('song:stop'));
|
||||
await page.evaluate(() => (window as any).feedBack.emit('song:stop'));
|
||||
await page.waitForFunction(() => (window as any).__wakeLockSpy.held === false);
|
||||
});
|
||||
|
||||
@@ -87,8 +87,8 @@ test('fast play→pause before the request resolves leaves no stale lock', async
|
||||
// Pause arrives while navigator.wakeLock.request is still in flight — the
|
||||
// resolved sentinel must release itself instead of being held stale.
|
||||
await page.evaluate(() => {
|
||||
(window as any).slopsmith.emit('song:play');
|
||||
(window as any).slopsmith.emit('song:pause');
|
||||
(window as any).feedBack.emit('song:play');
|
||||
(window as any).feedBack.emit('song:pause');
|
||||
});
|
||||
await page.waitForTimeout(150);
|
||||
expect(await page.evaluate(() => (window as any).__wakeLockSpy.held)).toBe(false);
|
||||
@@ -97,53 +97,53 @@ test('fast play→pause before the request resolves leaves no stale lock', async
|
||||
});
|
||||
|
||||
test('re-acquires the wake lock when the UA releases it while still playing', async ({ page }) => {
|
||||
await page.evaluate(() => (window as any).slopsmith.emit('song:play'));
|
||||
await page.evaluate(() => (window as any).feedBack.emit('song:play'));
|
||||
await page.waitForFunction(() => (window as any).__wakeLockSpy.held === true);
|
||||
const before = await page.evaluate(() => (window as any).__wakeLockSpy.requestCount);
|
||||
|
||||
// Simulate the UA releasing the lock (power policy / page hide) while
|
||||
// playback continues; the release handler re-acquires when still visible.
|
||||
await page.evaluate(() => {
|
||||
(window as any).slopsmith.isPlaying = true;
|
||||
(window as any).feedBack.isPlaying = true;
|
||||
(window as any).__wakeLockSpy.lastSentinel.release();
|
||||
});
|
||||
await page.waitForFunction((n) => (window as any).__wakeLockSpy.requestCount === n + 1 && (window as any).__wakeLockSpy.held === true, before);
|
||||
|
||||
// After a real pause there must be no further re-acquire churn.
|
||||
await page.evaluate(() => (window as any).slopsmith.emit('song:pause'));
|
||||
await page.evaluate(() => (window as any).feedBack.emit('song:pause'));
|
||||
await page.waitForFunction(() => (window as any).__wakeLockSpy.held === false);
|
||||
const settled = await page.evaluate(() => (window as any).__wakeLockSpy.requestCount);
|
||||
await page.waitForTimeout(150);
|
||||
expect(await page.evaluate(() => (window as any).__wakeLockSpy.requestCount)).toBe(settled);
|
||||
});
|
||||
|
||||
test('drives the slopsmith-desktop native power bridge, deduped and visibility-gated', async ({ page }) => {
|
||||
test('drives the feedBack-desktop native power bridge, deduped and visibility-gated', async ({ page }) => {
|
||||
// In the packaged Electron app navigator.wakeLock is unreliable, so the
|
||||
// helper also drives window.slopsmithDesktop.power.setScreenAwake — to
|
||||
// helper also drives window.feedBackDesktop.power.setScreenAwake — to
|
||||
// exactly (wanted && visible), emitting only on change. Inject a spy bridge
|
||||
// before app.js runs and assert it tracks playback without duplicate starts.
|
||||
await page.addInitScript(() => {
|
||||
(window as any).__bridgeCalls = [];
|
||||
(window as any).slopsmithDesktop = {
|
||||
(window as any).feedBackDesktop = {
|
||||
power: { setScreenAwake: (keep: boolean) => (window as any).__bridgeCalls.push(keep) },
|
||||
};
|
||||
});
|
||||
await page.reload();
|
||||
await page.waitForSelector('.screen.active', { timeout: 10000 });
|
||||
await page.waitForFunction(() => typeof (window as any).slopsmith?.emit === 'function');
|
||||
await page.waitForFunction(() => typeof (window as any).feedBack?.emit === 'function');
|
||||
|
||||
// song:play + song:resume fire together but must produce a single `true`.
|
||||
await page.evaluate(() => {
|
||||
(window as any).slopsmith.emit('song:play');
|
||||
(window as any).slopsmith.emit('song:resume');
|
||||
(window as any).feedBack.emit('song:play');
|
||||
(window as any).feedBack.emit('song:resume');
|
||||
});
|
||||
await page.waitForFunction(() => (window as any).__bridgeCalls.filter((x: boolean) => x === true).length === 1);
|
||||
await page.evaluate(() => (window as any).slopsmith.emit('song:pause'));
|
||||
await page.evaluate(() => (window as any).feedBack.emit('song:pause'));
|
||||
await page.waitForFunction(() => (window as any).__bridgeCalls.filter((x: boolean) => x === false).length === 1);
|
||||
|
||||
// Hidden while playing → bridge OFF (a minimized window mustn't keep the
|
||||
// whole display awake); restoring visibility while playing turns it back ON.
|
||||
await page.evaluate(() => (window as any).slopsmith.emit('song:play'));
|
||||
await page.evaluate(() => (window as any).feedBack.emit('song:play'));
|
||||
await page.waitForFunction(() => (window as any).__bridgeCalls[(window as any).__bridgeCalls.length - 1] === true);
|
||||
await page.evaluate(() => {
|
||||
Object.defineProperty(document, 'visibilityState', { configurable: true, get: () => 'hidden' });
|
||||
|
||||
Reference in New Issue
Block a user