dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('Picture input field', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('/certifieduser');
|
|
|
|
await page.getByRole('button', { name: 'Edit my profile' }).click();
|
|
});
|
|
|
|
test('Should be possible to type', async ({ page }) => {
|
|
const pictureInput = page.getByLabel('Picture');
|
|
await pictureInput.fill('');
|
|
await pictureInput.fill('twaha');
|
|
await expect(pictureInput).toHaveAttribute('value', 'twaha');
|
|
});
|
|
|
|
test('Show an error message if an incorrect url was submitted', async ({
|
|
page
|
|
}) => {
|
|
const pictureInput = page.getByLabel('Picture');
|
|
await pictureInput.fill('');
|
|
await pictureInput.fill(
|
|
'https://cdn.freecodecamp.org/platform/universal/camper-image-placeholder'
|
|
);
|
|
await expect(
|
|
page.getByText('URL must link directly to an image file')
|
|
).toBeVisible();
|
|
});
|
|
|
|
test('Can submit a correct URL', async ({ page }) => {
|
|
const pictureInput = page.getByLabel('Picture');
|
|
await pictureInput.fill('');
|
|
await pictureInput.fill(
|
|
'https://cdn.freecodecamp.org/platform/universal/camper-image-placeholder.png'
|
|
);
|
|
|
|
const form = page.getByTestId('camper-identity');
|
|
const saveButton = form.getByRole('button', { name: 'Save' });
|
|
await expect(saveButton).toBeEnabled();
|
|
});
|
|
});
|