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 { private function closeTemplateSelectionModal(\AcceptanceTester $i): void {
$i->wantTo('Close template selector'); $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->waitForElementVisible('.block-editor-block-preview__container');
$i->click('[aria-label="Close"]'); $i->click('[aria-label="Close"]');
} }

View File

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