From aa9b155d84a641e63a5c191a5c689b3d62f9be50 Mon Sep 17 00:00:00 2001 From: mmtr Date: Wed, 18 Dec 2019 19:30:11 +0100 Subject: [PATCH] Do not open sidebar if already opened in mobile --- .../gutenberg-editor-sidebar-component.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/test/e2e/lib/gutenberg/gutenberg-editor-sidebar-component.js b/test/e2e/lib/gutenberg/gutenberg-editor-sidebar-component.js index 01386e22ac2df..2f6d2bbb5f198 100644 --- a/test/e2e/lib/gutenberg/gutenberg-editor-sidebar-component.js +++ b/test/e2e/lib/gutenberg/gutenberg-editor-sidebar-component.js @@ -168,22 +168,15 @@ export default class GutenbergEditorSidebarComponent extends AsyncBaseContainer async displayComponentIfNecessary() { if ( driverManager.currentScreenSize() === 'mobile' ) { - const driver = this.driver; - const c = await driver.findElement( this.cogSelector ).getAttribute( 'class' ); - if ( c.indexOf( 'is-toggled' ) < 0 ) { - return await driverHelper.clickWhenClickable( driver, this.cogSelector ); - } + const gEditorComponent = await GutenbergEditorComponent.Expect( this.driver ); + return await gEditorComponent.openSidebar(); } } async hideComponentIfNecessary() { if ( driverManager.currentScreenSize() === 'mobile' ) { - const driver = this.driver; - - const c = await driver.findElement( this.cogSelector ).getAttribute( 'class' ); - if ( c.indexOf( 'is-toggled' ) > -1 ) { - return await driverHelper.clickWhenClickable( driver, this.closeSelector ); - } + const gEditorComponent = await GutenbergEditorComponent.Expect( this.driver ); + return await gEditorComponent.closeSidebar(); } }