Updated test to check for Unsplash button in Admin (#19814)

ref DES-167

https://linear.app/tryghost/issue/DES-167/🐛-unsplash-in-admin-x-not-styled-correctly
This commit is contained in:
Ronald Langeveld 2024-03-06 16:54:37 +02:00 committed by GitHub
parent ae5df293c3
commit 8a67901355
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 2 deletions

View File

@ -174,7 +174,7 @@ const ImageUpload: React.FC<ImageUploadProps> = ({
<div className={`${buttonContainerClassName} ${unsplashEnabled ? 'relative' : ''}`}>
{
unsplashEnabled &&
<button className={unsplashButtonClassName} type='button' onClick={openUnsplash}>
<button className={unsplashButtonClassName} data-testid="toggle-unsplash-button" type='button' onClick={openUnsplash}>
{unsplashButtonContent}
</button>
}

View File

@ -132,7 +132,7 @@ const BrandSettings: React.FC<{ values: BrandSettingValues, updateSetting: (key:
unsplashButtonClassName='!top-1 !right-1 z-50'
unsplashEnabled={unsplashEnabled}
onDelete={() => updateSetting('cover_image', null)}
onUpload={async (file) => {
onUpload={async (file: any) => {
try {
updateSetting('cover_image', getImageUrl(await uploadImage({file})));
} catch (e) {

View File

@ -129,6 +129,7 @@ test.describe('Design settings', async () => {
await expect(modal.frameLocator('[data-testid="theme-preview"] iframe[data-visible=true]').getByText('homepage preview')).toHaveCount(1);
await modal.getByLabel('Site description').fill('new description');
await expect(modal.getByTestId('toggle-unsplash-button')).toBeVisible();
// set timeout of 500ms to wait for the debounce
await page.waitForTimeout(1000);
await modal.getByRole('button', {name: 'Save'}).click();