Skip to content

Commit

Permalink
Revert new Gutenberg Preview and use old Calypso preview instead
Browse files Browse the repository at this point in the history
  • Loading branch information
simison committed Mar 25, 2020
1 parent d7c034c commit 5d9870d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 35 deletions.
20 changes: 3 additions & 17 deletions test/e2e/lib/gutenberg/gutenberg-editor-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,28 +339,14 @@ export default class GutenbergEditorComponent extends AsyncBaseContainer {
return await driverHelper.clickWhenClickable( this.driver, By.css( '.components-snackbar' ) );
}

// @TODO: Update to new `.editor-post-preview__dropdown` format once we support it again
// https://github.com/Automattic/wp-calypso/issues/40401
async launchPreview() {
if ( driverManager.currentScreenSize() === 'mobile' ) {
return await driverHelper.clickWhenClickable(
this.driver,
By.css( '.components-button.editor-post-preview' ),
this.explicitWaitMS
);
}

return await driverHelper.clickWhenClickable(
this.driver,
// @TODO: Update to new `.editor-post-preview__dropdown` format once we support it again
// https://github.com/Automattic/wp-calypso/issues/40401
By.css( '.editor-post-preview' ),
By.css( '.components-button.editor-post-preview' ),
this.explicitWaitMS
);
// @TODO: Enable again once we support dropdown preview again
// https://github.com/Automattic/wp-calypso/issues/40401
//
// const editorPostPreviewSelector = By.css( '.editor-post-preview__button-external' );
// await driverHelper.waitTillPresentAndDisplayed( this.driver, editorPostPreviewSelector );
// return await driverHelper.clickWhenClickable( this.driver, editorPostPreviewSelector );
}

async revertToDraft() {
Expand Down
20 changes: 9 additions & 11 deletions test/e2e/specs/wp-calypso-gutenberg-page-editor-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import NotFoundPage from '../lib/pages/not-found-page.js';
import PaypalCheckoutPage from '../lib/pages/external/paypal-checkout-page';
import GutenbergEditorComponent from '../lib/gutenberg/gutenberg-editor-component';
import GutenbergEditorSidebarComponent from '../lib/gutenberg/gutenberg-editor-sidebar-component';
import PagePreviewExternalComponent from '../lib/components/page-preview-external-component';
import PagePreviewComponent from '../lib/components/page-preview-component';
import SimplePaymentsBlockComponent from '../lib/gutenberg/blocks/payment-block-component';

Expand Down Expand Up @@ -96,13 +95,9 @@ describe( `[${ host }] Calypso Gutenberg Editor: Pages (${ screenSize })`, funct
} );

step( 'Can see correct page title in preview', async function() {
if ( driverManager.currentScreenSize() === 'mobile' ) {
this.pagePreviewComponent = await PagePreviewComponent.Expect( driver );
await this.pagePreviewComponent.displayed();
} else {
this.pagePreviewComponent = new PagePreviewExternalComponent( driver );
}
const actualPageTitle = await this.pagePreviewComponent.pageTitle();
const pagePreviewComponent = await PagePreviewComponent.Expect( driver );
await pagePreviewComponent.displayed();
const actualPageTitle = await pagePreviewComponent.pageTitle();
assert.strictEqual(
actualPageTitle.toUpperCase(),
pageTitle.toUpperCase(),
Expand All @@ -111,7 +106,8 @@ describe( `[${ host }] Calypso Gutenberg Editor: Pages (${ screenSize })`, funct
} );

step( 'Can see correct page content in preview', async function() {
const content = await this.pagePreviewComponent.pageContent();
const pagePreviewComponent = await PagePreviewComponent.Expect( driver );
const content = await pagePreviewComponent.pageContent();
assert.strictEqual(
content.indexOf( pageQuote ) > -1,
true,
Expand All @@ -124,7 +120,8 @@ describe( `[${ host }] Calypso Gutenberg Editor: Pages (${ screenSize })`, funct
} );

step( 'Can see the image uploaded in the preview', async function() {
const imageDisplayed = await this.pagePreviewComponent.imageDisplayed( fileDetails );
const pagePreviewComponent = await PagePreviewComponent.Expect( driver );
const imageDisplayed = await pagePreviewComponent.imageDisplayed( fileDetails );
return assert.strictEqual(
imageDisplayed,
true,
Expand All @@ -133,7 +130,8 @@ describe( `[${ host }] Calypso Gutenberg Editor: Pages (${ screenSize })`, funct
} );

step( 'Can close page preview', async function() {
await this.pagePreviewComponent.close();
const pagePreviewComponent = await PagePreviewComponent.Expect( driver );
await pagePreviewComponent.close();
} );

step( 'Can publish and preview published content', async function() {
Expand Down
8 changes: 1 addition & 7 deletions test/e2e/specs/wp-calypso-gutenberg-post-editor-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import SidebarComponent from '../lib/components/sidebar-component.js';
import NoticesComponent from '../lib/components/notices-component.js';
import NavBarComponent from '../lib/components/nav-bar-component.js';
import PostPreviewComponent from '../lib/components/post-preview-component';
import PostPreviewExternalComponent from '../lib/components/post-preview-external-component';
import RevisionsModalComponent from '../lib/components/revisions-modal-component';
import GutenbergEditorComponent from '../lib/gutenberg/gutenberg-editor-component';
import GutenbergEditorSidebarComponent from '../lib/gutenberg/gutenberg-editor-sidebar-component';
Expand Down Expand Up @@ -130,12 +129,7 @@ describe( `[${ host }] Calypso Gutenberg Editor: Posts (${ screenSize })`, funct
} );

step( 'Can see correct post title in preview', async function() {
if ( driverManager.currentScreenSize() === 'mobile' ) {
this.postPreviewComponent = await PostPreviewComponent.Expect( driver );
await this.postPreviewComponent.displayed();
} else {
this.postPreviewComponent = new PostPreviewExternalComponent( driver );
}
this.postPreviewComponent = await PostPreviewComponent.Expect( driver );

const postTitle = await this.postPreviewComponent.postTitle();
assert.strictEqual(
Expand Down

0 comments on commit 5d9870d

Please sign in to comment.