Skip to content

Commit

Permalink
Mobile - Skip some of the Drag & Drop E2E on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerardo committed Jun 3, 2022
1 parent 2db5149 commit 846e904
Showing 1 changed file with 67 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,61 +53,73 @@ describe( 'Gutenberg Editor Drag & Drop blocks tests', () => {
await editorPage.removeBlockAtPosition( blockNames.paragraph, 1 );
} );

it( 'should be able to long-press on a text-based block to paste a text in a focused textinput', async () => {
// Add a Paragraph block
await editorPage.addNewBlock( blockNames.paragraph );
const paragraphBlockElement = await editorPage.getTextBlockAtPosition(
blockNames.paragraph
);

// Set clipboard text
await setClipboard( editorPage.driver, testData.shortText );

// Dismiss auto-suggestion popup
if ( isAndroid() ) {
// On Andrdoid 10 a new auto-suggestion popup is appearing to let the user paste text recently put in the clipboard. Let's dismiss it.
await editorPage.dismissAndroidClipboardSmartSuggestion();
}

// Paste into the Paragraph block
await tapPasteAboveElement( editorPage.driver, paragraphBlockElement );
const paragraphText = await editorPage.getTextForParagraphBlockAtPosition(
1
);

// Expect to have the pasted text in the Paragraph block
expect( paragraphText ).toMatch( testData.shortText );

// Remove the block
await editorPage.removeBlockAtPosition( blockNames.paragraph );
} );

it( 'should be able to long-press on a text-based block using the PlainText component to paste a text in a focused textinput', async () => {
// Add a Shortcode block
await editorPage.addNewBlock( blockNames.shortcode );
const shortcodeBlockElement = await editorPage.getShortBlockTextInputAtPosition(
blockNames.shortcode
);

// Set clipboard text
await setClipboard( editorPage.driver, testData.shortText );

// Dismiss auto-suggestion popup
if ( isAndroid() ) {
// On Andrdoid 10 a new auto-suggestion popup is appearing to let the user paste text recently put in the clipboard. Let's dismiss it.
await editorPage.dismissAndroidClipboardSmartSuggestion();
}

// Paste into the Shortcode block
await tapPasteAboveElement( editorPage.driver, shortcodeBlockElement );
const shortcodeText = await shortcodeBlockElement.text();

// Expect to have the pasted text in the Shortcode block
expect( shortcodeText ).toMatch( testData.shortText );

// Remove the block
await editorPage.removeBlockAtPosition( blockNames.shortcode );
} );
// skip iOS for now
if ( isAndroid() ) {
it( 'should be able to long-press on a text-based block to paste a text in a focused textinput', async () => {
// Add a Paragraph block
await editorPage.addNewBlock( blockNames.paragraph );
const paragraphBlockElement = await editorPage.getTextBlockAtPosition(
blockNames.paragraph
);

// Set clipboard text
await setClipboard( editorPage.driver, testData.shortText );

// Dismiss auto-suggestion popup
if ( isAndroid() ) {
// On Andrdoid 10 a new auto-suggestion popup is appearing to let the user paste text recently put in the clipboard. Let's dismiss it.
await editorPage.dismissAndroidClipboardSmartSuggestion();
}

// Paste into the Paragraph block
await tapPasteAboveElement(
editorPage.driver,
paragraphBlockElement
);
const paragraphText = await editorPage.getTextForParagraphBlockAtPosition(
1
);

// Expect to have the pasted text in the Paragraph block
expect( paragraphText ).toMatch( testData.shortText );

// Remove the block
await editorPage.removeBlockAtPosition( blockNames.paragraph );
} );
}

// skip iOS for now
if ( isAndroid() ) {
it( 'should be able to long-press on a text-based block using the PlainText component to paste a text in a focused textinput', async () => {
// Add a Shortcode block
await editorPage.addNewBlock( blockNames.shortcode );
const shortcodeBlockElement = await editorPage.getShortBlockTextInputAtPosition(
blockNames.shortcode
);

// Set clipboard text
await setClipboard( editorPage.driver, testData.shortText );

// Dismiss auto-suggestion popup
if ( isAndroid() ) {
// On Andrdoid 10 a new auto-suggestion popup is appearing to let the user paste text recently put in the clipboard. Let's dismiss it.
await editorPage.dismissAndroidClipboardSmartSuggestion();
}

// Paste into the Shortcode block
await tapPasteAboveElement(
editorPage.driver,
shortcodeBlockElement
);
const shortcodeText = await shortcodeBlockElement.text();

// Expect to have the pasted text in the Shortcode block
expect( shortcodeText ).toMatch( testData.shortText );

// Remove the block
await editorPage.removeBlockAtPosition( blockNames.shortcode );
} );
}

it( 'should be able to drag & drop a text-based block when the textinput is not focused', async () => {
// Initialize the editor with two Paragraph blocks
Expand Down

0 comments on commit 846e904

Please sign in to comment.