dailykart-testing/tests/footer-contact-links.spec.ts

35 lines
1.2 KiB
TypeScript

import { test, expect } from '@playwright/test';
test('#10 Footer contact email should be a clickable mailto link', async ({ page }) => {
await page.goto('https://uat.dailykart.net');
// Scroll to footer to ensure visibility
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
await page.waitForTimeout(1000);
// Locate the email link using text or partial href
const emailLink = page.locator('a[href^="mailto:"]', { hasText: 'sales@dailykart.com' });
await expect(emailLink).toBeVisible();
const href = await emailLink.getAttribute('href');
expect(href).toBe('mailto:sales@dailykart.com');
});
test('Footer location should be a clickable map link', async ({ page }) => {
await page.goto('https://uat.dailykart.net');
// Scroll to footer
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
await page.waitForTimeout(1000);
// Locate the clickable map link
const locationLink = page.locator('li.footer__address-item a', { hasText: 'Bengaluru Karnataka - 562130' });
await expect(locationLink).toBeVisible();
const href = await locationLink.getAttribute('href');
// ✅ Accepts either maps.google.com or www.google.com/maps
expect(href).toContain('google.com/maps');
});