Update email editor acceptance test

MAILPOET-6331
This commit is contained in:
Oluwaseun Olorunsola
2024-12-04 17:20:56 +01:00
committed by Oluwaseun Olorunsola
parent 8b1f7c9a88
commit fbf4272e0e
2 changed files with 22 additions and 19 deletions

View File

@@ -147,6 +147,8 @@ class CreateAndSendEmailUsingGutenbergCest {
private function closeTemplateSelectionModal(\AcceptanceTester $i): void {
$i->wantTo('Close template selector');
$i->waitForElementClickable('.email-editor-start_from_scratch_button');
$i->click('[aria-label="Basic"]');
$i->waitForElementVisible('.block-editor-block-preview__container');
$i->click('[aria-label="Close"]');
}

View File

@@ -38,11 +38,11 @@ function SelectTemplateBody( {
}
export function SelectTemplateModal( {
onSelectCallback,
closeCallback = null,
previewContent = '',
} ) {
const [ templates ] = usePreviewTemplates( previewContent );
onSelectCallback,
closeCallback = null,
previewContent = '',
} ) {
const [ templates ] = usePreviewTemplates( previewContent );
const hasTemplates = templates?.length > 0;
@@ -85,9 +85,9 @@ export function SelectTemplateModal( {
return (
<Modal
title={ __( 'Select a template', 'mailpoet' ) }
onRequestClose={ () =>
closeCallback ? closeCallback() : handleCloseWithoutSelection()
}
onRequestClose={ () =>
closeCallback ? closeCallback() : handleCloseWithoutSelection()
}
isFullScreen
>
<SelectTemplateBody
@@ -97,17 +97,18 @@ export function SelectTemplateModal( {
handleTemplateSelection={ handleTemplateSelection }
/>
<Flex justify="flex-end">
<FlexItem>
<Button
variant="tertiary"
onClick={ () => handleCloseWithoutSelection() }
isBusy={ ! hasTemplates }
>
{ __( 'Start from scratch', 'mailpoet' ) }
</Button>
</FlexItem>
</Flex>
<Flex justify="flex-end">
<FlexItem>
<Button
variant="tertiary"
className="email-editor-start_from_scratch_button"
onClick={ () => handleCloseWithoutSelection() }
isBusy={ ! hasTemplates }
>
{ __( 'Start from scratch', 'mailpoet' ) }
</Button>
</FlexItem>
</Flex>
</Modal>
);
}