upskill-event-manager/wordpress-dev/tests/e2e/profile-verification.spec.ts

35 lines
No EOL
1.4 KiB
TypeScript

import { STAGING_URL, PATHS, TIMEOUTS } from './config/staging-config';
import { test, expect } from '@playwright/test';
test.describe('Trainer Profile Page', () => {
test('should be accessible and return a 200 status', async ({ page }) => {
// Navigate to the trainer profile page
const response = await page.goto('https://upskill-staging.measurequick.com/trainer-profile/');
// Verify the response status code
expect(response?.status()).toBe(200);
// Verify the page contains an expected element
await expect(page).toHaveTitle(/Trainer Profile/);
// Take a screenshot for verification
await page.screenshot({ path: './test-results/trainer-profile.png' });
// Check if the page contains either our custom HTML or the shortcode
const content = await page.content();
const hasShortcode = content.includes('[hvac_trainer_profile]') || content.includes('Trainer Profile');
expect(hasShortcode).toBeTruthy();
});
test('should have no 404 error', async ({ page }) => {
// Navigate to the trainer profile page
await page.goto('https://upskill-staging.measurequick.com/trainer-profile/');
// Ensure there's no 404 error on the page
const notFoundText = await page.locator('text=Page not found').count();
expect(notFoundText).toBe(0);
const error404Text = await page.locator('text=Error 404').count();
expect(error404Text).toBe(0);
});
});