test(nodes): assert Save pair's metadata in the existing host test (#546)

A separate test raised the pinned host-test total, which the cutover branch also
changes. The assertion now lives in the explicit Save test.
This commit is contained in:
Vito Sansevero
2026-10-30 15:33:17 -07:00
parent 07bdfa559f
commit ca24fadf27
+3 -11
View File
@@ -55,18 +55,10 @@ test('paired default layout uses equal editors and follows real host themes',asy
}
});
test('paired explicit Save persists an empty negative through actual API and preserves local draft',async({page,request},testInfo)=>{
const id=await addPair(page);const root=page.locator('.pm-pair');const text=`Saved pair empty negative ${testInfo.project.name}`;await root.getByRole('textbox',{name:'Positive prompt',exact:true}).fill(text);await root.getByRole('button',{name:'Save pair',exact:true}).click();
test('paired explicit Save persists an empty negative through actual API, gives a new prompt its metadata and preserves local draft',async({page,request},testInfo)=>{
const id=await addPair(page);const root=page.locator('.pm-pair');const text=`Saved pair empty negative ${testInfo.project.name}`;await root.getByRole('textbox',{name:'Positive prompt',exact:true}).fill(text);await root.getByText('Metadata · category / tags',{exact:true}).click();await root.getByRole('combobox',{name:'Category',exact:true}).fill('Saved category');await root.getByRole('combobox',{name:'Tags',exact:true}).fill('saved-tag');await root.getByRole('button',{name:'Save pair',exact:true}).click();
await expect(root.getByRole('status').filter({hasText:'Pair saved.'})).toBeVisible();const response=await request.get(`/prompt_manager/pairs?text=${encodeURIComponent(text)}`);expect(response.ok()).toBe(true);expect((await response.json()).pairs).toEqual(expect.arrayContaining([expect.objectContaining({positive_text:text,negative_text:''})]));expect(await values(page,id)).toMatchObject({text,negative_text:''});
});
test('Save pair gives a new prompt the category and tags shown on the node',async({page,request},testInfo)=>{
await addPair(page);const root=page.locator('.pm-pair');const text=`Saved pair metadata ${testInfo.project.name}`;await root.getByRole('textbox',{name:'Positive prompt',exact:true}).fill(text);
await root.getByText('Metadata · category / tags',{exact:true}).click();await root.getByRole('combobox',{name:'Category',exact:true}).fill('Saved category');await root.getByRole('combobox',{name:'Tags',exact:true}).fill('saved-tag');
await root.getByRole('button',{name:'Save pair',exact:true}).click();await expect(root.getByRole('status').filter({hasText:'Pair saved.'})).toBeVisible();
const [pair]=(await (await request.get(`/prompt_manager/pairs?text=${encodeURIComponent(text)}`)).json()).pairs;
const library=await (await request.get(`/prompt_manager/library?text=${encodeURIComponent(text)}&limit=10`)).json();const prompt=library.items.find(item=>item.id===pair.positive_prompt_id);
expect([prompt.category,prompt.tags]).toEqual(['Saved category',['saved-tag']]);
const library=await (await request.get(`/prompt_manager/library?text=${encodeURIComponent(text)}&limit=10`)).json();expect(library.items).toEqual(expect.arrayContaining([expect.objectContaining({category:'Saved category',tags:['saved-tag']})]));
});
test('paired library filters search both texts, persist on reload and keep editor metadata separate',async({page,request},testInfo)=>{