Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/mabl-demos/genAi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,23 @@ test('Evaluate a GenAI assertion to validate the state of a page', async ({
console.log(result.explanation);
expect(result.success).toBe(true);
});

// Enable "GenAI file downloads" in Labs before using this test
test('Evaluate a GenAI assertion with downloaded CSV file', async ({page, mabl}) => {
await page.goto('https://sandbox.mabl.com/downloads-pdfs');

// Wait for the download button and trigger download
const downloadPromise = page.waitForEvent('download');
await page.getByText('Download CSV').click();
const download = await downloadPromise;

const result = await mabl.evaluateGenAiAssertionInFile(
page,
'Outdoor Patio Chair is in stock',
download,
);

console.log('GEN AI EXPLANATION FOR CSV');
console.log(result.explanation);
expect(result.success).toBe(true);
});