feat: validate portfolio image correctly (#57084)

This commit is contained in:
Sem Bauke
2024-11-19 10:08:53 +01:00
committed by GitHub
parent d6ea481cbc
commit ef25dfee50
2 changed files with 72 additions and 26 deletions
+11 -2
View File
@@ -63,12 +63,21 @@ test.describe('Add Portfolio Item', () => {
test('The image has validation', async ({ page }) => {
await page.getByLabel(translations.settings.labels.image).fill('T');
await expect(page.getByTestId('image-validation')).toContainText(
'URL must link directly to an image file'
'Please use a valid URL'
);
await page
.getByLabel(translations.settings.labels.image)
.fill('http://helloworld.com/image.png');
.fill(
'https://cdn.freecodecamp.org/universal/favicons/favicon-32x32.png'
);
await expect(page.getByTestId('image-validation')).toBeHidden();
await page
.getByLabel(translations.settings.labels.image)
.fill('https://cdn.freecodecamp.org/universal/favicons/favicon-32x32.pn');
await expect(page.getByTestId('image-validation')).toContainText(
'URL must link directly to an image file'
);
});
test('The description has validation', async ({ page }) => {