Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

**suggestion (testing):** Test dynamic content #83

Open
jgeofil opened this issue Dec 22, 2024 · 1 comment
Open

**suggestion (testing):** Test dynamic content #83

jgeofil opened this issue Dec 22, 2024 · 1 comment

Comments

@jgeofil
Copy link
Owner

jgeofil commented Dec 22, 2024

          **suggestion (testing):** Test dynamic content

The test currently checks for the first link in the list. It would be better to add tests for specific blog post links to ensure that dynamic content is loaded correctly. Also, uncomment or remove the commented-out test case.

Suggested implementation:

test('homepage navigation and blog content loads correctly', async ({ page }) => {
  await page.goto(TARGET_URL);

  // Test navigation links
  await expect(page.getByRole('link', { name: 'ML Readme' })).toBeVisible();
  await expect(page.getByRole('link', { name: 'Home' })).toBeVisible();
  await expect(page.getByRole('link', { name: 'About', exact: true })).toBeVisible();

  // Test blog posts are loaded
  await expect(page.getByRole('link', { name: 'Byte-Pair Encoding (BPE)' })).toBeVisible();
  await expect(page.locator('ul.blog-posts-list > li')).toHaveCount(3); // Assuming we expect at least 3 blog posts

  // Test specific blog post links
  await expect(page.getByRole('link', { name: 'Byte-Pair Encoding (BPE)' })).toBeVisible();
  await expect(page.getByRole('link', { name: 'Getting Started with Machine Learning' })).toBeVisible();
});

Note: You may need to:

  1. Adjust the blog post titles to match the actual titles in your application
  2. Update the expected count of blog posts (.toHaveCount(3)) to match your actual expected number
  3. Add or modify the CSS selector for the blog posts list (ul.blog-posts-list) to match your actual HTML structure

Originally posted by @sourcery-ai[bot] in #80 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant