Skip to content

Commit

Permalink
refactor: Remove unused E2E test helpers (#55711)
Browse files Browse the repository at this point in the history
* test: Remove unused `waitIfAndroid` utility

* test: Remove unused `clearClipboard` utility

* test: Remove unused `setClipboard` utility

* test: Remove unnecessary `clearClipboard` usage

This became unnecessary when the clipboard-related tests were removed in
#55541.
  • Loading branch information
dcalhoun authored Nov 2, 2023
1 parent 6266974 commit 7016c56
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
* Internal dependencies
*/
import { blockNames } from './pages/editor-page';
import { clearClipboard, dragAndDropAfterElement } from './helpers/utils';
import { dragAndDropAfterElement } from './helpers/utils';
import testData from './helpers/test-data';

describe( 'Gutenberg Editor Drag & Drop blocks tests', () => {
beforeEach( async () => {
await clearClipboard( editorPage.driver );
} );

it( 'should be able to drag & drop a block', async () => {
// Initialize the editor with a Spacer and Paragraph block
await editorPage.initializeEditor( {
Expand Down
39 changes: 0 additions & 39 deletions packages/react-native-editor/__device-tests__/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,42 +682,6 @@ const clickIfClickable = async (
}
};

// Only for Android
const waitIfAndroid = async () => {
if ( isAndroid() ) {
await editorPage.driver.sleep( 1000 );
}
};

/**
* Content type definitions.
* Note: Android only supports plaintext.
*
* @typedef {"plaintext" | "image" | "url"} ClipboardContentType
*/

/**
* Helper to set content in the clipboard.
*
* @param {Object} driver Driver
* @param {string} content Content to set in the clipboard
* @param {ClipboardContentType} contentType Type of the content
*/
const setClipboard = async ( driver, content, contentType = 'plaintext' ) => {
const base64String = Buffer.from( content ).toString( 'base64' );
await driver.setClipboard( base64String, contentType );
};

/**
* Helper to clear the clipboard
*
* @param {Object} driver Driver
* @param {ClipboardContentType} contentType Type of the content
*/
const clearClipboard = async ( driver, contentType = 'plaintext' ) => {
await driver.setClipboard( '', contentType );
};

const launchApp = async ( driver, initialProps = {} ) => {
if ( isAndroid() ) {
await driver.execute( 'mobile: startActivity', {
Expand All @@ -744,7 +708,6 @@ const launchApp = async ( driver, initialProps = {} ) => {

module.exports = {
backspace,
clearClipboard,
clickBeginningOfElement,
clickIfClickable,
clickMiddleOfElement,
Expand All @@ -756,7 +719,6 @@ module.exports = {
launchApp,
longPressMiddleOfElement,
selectTextFromElement,
setClipboard,
setupDriver,
stopDriver,
swipeDown,
Expand All @@ -770,5 +732,4 @@ module.exports = {
typeString,
waitForMediaLibrary,
waitForVisible,
waitIfAndroid,
};

0 comments on commit 7016c56

Please sign in to comment.