import { test, expect } from '@playwright/test';

// AC#5: Two consecutive Generate clicks (same dropdowns, no Clear between) should
// produce DIFFERENT text. The SUT has an intentionally-seeded cache bug — this
// test SHOULD FAIL on the live SUT.
test('AC#5: Two consecutive Generate clicks produce different text', async ({ page }) => {
  await page.goto(process.env.TFACTORY_TARGET_URL || 'https://olafkfreund.github.io/tfactory-demo/');
  await page.locator('[data-testid="generate-btn"]').click();
  const first = await page.locator('[data-testid="output"]').textContent();
  await page.locator('[data-testid="generate-btn"]').click();
  const second = await page.locator('[data-testid="output"]').textContent();
  expect(second).not.toBe(first);
});
