Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: drive Suno Advanced song creation with current form controls (#9474)
[._.]/ Adam Eivyda76c6a526ea
diff --git a/server/services/musicVideo/autonomousSuno.js b/server/services/musicVideo/autonomousSuno.jsindex 70a6c89b31..43b0484513 100644--- a/server/services/musicVideo/autonomousSuno.js+++ b/server/services/musicVideo/autonomousSuno.js@@ -48,31 +48,42 @@ const songLinks = (page) => page.evaluate(() => [...document.querySelectorAll('a*/async function submitSunoSong(page, fields, { sleep = defaultSleep } = {}) {await step(LABEL, 'open the create page', () => page.goto(SUNO_CREATE_URL, { waitUntil: 'domcontentloaded', timeout: T }));- await sleep(4000);+ await page.locator('textarea').first().waitFor({ state: 'visible', timeout: T }).catch(() => {});// A signed-out visitor is bounced to a sign-in page or sees no create form.const url = typeof page.url === 'function' ? page.url() : '';const hasForm = await page.locator('textarea').count();if (/sign-?in|login|accounts\./i.test(url) || !hasForm) throw loginRequired(LABEL, SUNO_CREATE_URL);await step(LABEL, 'switch to custom mode', async () => {+ // Current Suno calls custom mode Advanced and exposes it as a tab.+ // Keep the former Custom button for installations seeing the older UI.+ const advanced = page.getByRole('tab', { name: /^advanced$/i });const custom = page.getByRole('button', { name: /^custom$/i });- if (await custom.count()) await custom.first().click({ timeout: T });+ if (await advanced.count()) await advanced.first().click({ timeout: T });+ else if (await custom.count()) await custom.first().click({ timeout: T });});await step(LABEL, 'fill the lyrics', async () => {- const box = page.locator('textarea[placeholder*="lyrics" i]').first();- if (fields.instrumental || !fields.lyrics) return;- await box.fill(fields.lyrics, { timeout: T });+ const box = page.locator('[role="textbox"][aria-label="Lyrics editor"],textarea[placeholder*="lyrics" i]').first();+ // Clear stored lyrics too: a previous form draft must not turn an+ // instrumental request into a vocal song.+ await box.fill(fields.instrumental ? '' : fields.lyrics || '', { timeout: T });});await step(LABEL, 'fill the style', async () => {- await page.locator('textarea[placeholder*="style" i]').first().fill(fields.style, { timeout: T });+ // Advanced's Styles textarea uses rotating style examples as its+ // placeholder. Cowriter, Speech and Sounds are separate editors.+ const modern = await page.locator('[role="textbox"][aria-label="Lyrics editor"]').count();+ const styles = modern ? page.locator('textarea:not([aria-label]):not([placeholder="Describe the sound you want"])') : page.locator('textarea[placeholder*="style" i]');+ await styles.first().fill(fields.style, { timeout: T });});await step(LABEL, 'fill the title', async () => {- const title = page.locator('input[placeholder*="title" i]').first();+ const title = page.locator('input[placeholder*="title" i]:visible').first();if (await title.count()) await title.fill(fields.title, { timeout: T });});if (fields.instrumental) {await step(LABEL, 'turn instrumental on', async () => {- await page.getByRole('button', { name: /^instrumental$/i }).first().click({ timeout: T });+ const instrumental = page.getByRole('button', { name: /^instrumental$/i });+ // Advanced uses an empty lyrics editor for instrumental music.+ if (await instrumental.count()) await instrumental.first().click({ timeout: T });});}diff --git a/server/services/musicVideo/autonomousSuno.test.js b/server/services/musicVideo/autonomousSuno.test.jsindex ff4061b595..f8f55e9766 100644--- a/server/services/musicVideo/autonomousSuno.test.js+++ b/server/services/musicVideo/autonomousSuno.test.js@@ -16,20 +16,21 @@ const NEW_B = '33333333-3333-3333-3333-333333333333';const noSleep = async () => {};/** A just-enough Playwright page: tracks fills/clicks and exposes song links that appear after Create. */-function fakePage({ url = 'https://suno.com/create', hasForm = true, afterCreate = [NEW_A, NEW_B] } = {}) {+function fakePage({ url = 'https://suno.com/create', hasForm = true, modern = true, afterCreate = [NEW_A, NEW_B] } = {}) {const fills = {};let created = false;const locator = (selector) => {const handle = {- count: async () => (selector === 'textarea' ? (hasForm ? 1 : 0) : 1),+ count: async () => selector === 'textarea' ? (hasForm ? 1 : 0) : selector === '[role="textbox"][aria-label="Lyrics editor"]' ? (modern ? 1 : 0) : 1,+ waitFor: async () => {},fill: async (v) => { fills[selector] = v; },click: async () => {},};return { ...handle, first: () => handle };};- const button = () => ({- count: async () => 1,- first: () => ({ click: async () => {} }),+ const button = (role, options) => ({+ count: async () => role === 'textbox' || role === 'tab' ? (modern ? 1 : 0) : /instrumental|custom/.test(String(options.name)) ? (modern ? 0 : 1) : 1,+ first: () => ({ click: async () => {}, fill: async v => { fills[options.name] = v; } }),last: () => ({ click: async () => { created = true; } }),});return {@@ -50,15 +51,22 @@ describe('submitSunoSong', () => {const page = fakePage();const ids = await submitSunoSong(page, fields, { sleep: noSleep });expect(ids).toEqual([NEW_A, NEW_B]);- expect(page.fills['textarea[placeholder*="lyrics" i]']).toBe('[verse]\nrain');- expect(page.fills['textarea[placeholder*="style" i]']).toBe('synthwave');- expect(page.fills['input[placeholder*="title" i]']).toBe('Neon Rain');+ expect(page.fills['[role="textbox"][aria-label="Lyrics editor"],textarea[placeholder*="lyrics" i]']).toBe('[verse]\nrain');+ expect(page.fills['textarea:not([aria-label]):not([placeholder="Describe the sound you want"])']).toBe('synthwave');+ expect(page.fills['input[placeholder*="title" i]:visible']).toBe('Neon Rain');});it('leaves the lyrics empty for an instrumental song', async () => {const page = fakePage();await submitSunoSong(page, { ...fields, instrumental: true, lyrics: '' }, { sleep: noSleep });- expect(page.fills['textarea[placeholder*="lyrics" i]']).toBeUndefined();+ expect(page.fills['[role="textbox"][aria-label="Lyrics editor"],textarea[placeholder*="lyrics" i]']).toBe('');+ });++ it('keeps the older Custom form compatible', async () => {+ const page = fakePage({ modern: false });+ await submitSunoSong(page, fields, { sleep: noSleep });+ expect(page.fills['[role="textbox"][aria-label="Lyrics editor"],textarea[placeholder*="lyrics" i]']).toBe(fields.lyrics);+ expect(page.fills['textarea[placeholder*="style" i]']).toBe(fields.style);});it('reports a signed-out page as login-required so the run parks for the operator', async () => {