Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
worldomonation committed Nov 2, 2021
1 parent 3acc56e commit b4ad308
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 87 deletions.
82 changes: 2 additions & 80 deletions test/e2e/specs/specs-playwright/wp-editor__post-basic-flow-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,86 +49,8 @@ describe( DataHelper.createSuiteTitle( 'Editor: Basic Post Flow' ), function ()

it( 'Enter post title', async function () {
gutenbergEditorPage = new GutenbergEditorPage( page );
await gutenbergEditorPage.enterTitle( title );
} );

it( 'Enter post text', async function () {
await gutenbergEditorPage.enterText( quote );
} );

it( 'Open editor settings sidebar for post', async function () {
await gutenbergEditorPage.openSettings();
const frame = await gutenbergEditorPage.getEditorFrame();
editorSettingsSidebarComponent = new EditorSettingsSidebarComponent( frame, page );
await editorSettingsSidebarComponent.clickTab( 'Post' );
} );

it( 'Add post category', async function () {
await editorSettingsSidebarComponent.expandSectionIfCollapsed( 'Categories' );
await editorSettingsSidebarComponent.clickCategory( category );
} );

it( 'Add post tag', async function () {
await editorSettingsSidebarComponent.expandSectionIfCollapsed( 'Tags' );
await editorSettingsSidebarComponent.enterTag( tag );
} );
} );

describe( 'Preview post', function () {
const targetDevice = BrowserHelper.getTargetDeviceName();
let previewPage: Page;

// This step is required on mobile, but doesn't hurt anything on desktop, so avoiding conditional.
it( 'Close settings sidebar', async function () {
await editorSettingsSidebarComponent.closeSidebar();
} );

// The following two steps have conditiionals inside them, as how the
// Editor Preview behaves depends on the device type.
// On desktop and tablet, preview applies CSS attributes to modify the preview in-editor.
// On mobile web, preview button opens a new tab.

// TODO: step skipped for non-mobile due to https://github.com/Automattic/wp-calypso/issues/57128.
itif( targetDevice === 'mobile' )( 'Launch preview', async function () {
if ( BrowserHelper.getTargetDeviceName() === 'mobile' ) {
previewPage = await gutenbergEditorPage.openPreviewAsMobile();
} else {
await gutenbergEditorPage.openPreviewAsDesktop( 'Mobile' );
}
} );

// TODO: step skipped for non-mobile due to https://github.com/Automattic/wp-calypso/issues/57128.
itif( targetDevice === 'mobile' )( 'Close preview', async function () {
// Mobile path.
if ( previewPage ) {
await previewPage.close();
// Desktop path.
} else {
await gutenbergEditorPage.closePreview();
}
} );

// TODO: step skipped for mobile, since previewing naturally saves the post, rendering this step unnecessary.
itif( targetDevice !== 'mobile' )( 'Save draft', async function () {
await gutenbergEditorPage.saveDraft();
} );
} );

describe( 'Publish post', function () {
it( 'Publish and visit post', async function () {
const publishedURL = await gutenbergEditorPage.publish( { visit: true } );
expect( publishedURL ).toBe( page.url() );
} );

it( 'Post content is found in published post', async function () {
publishedPostPage = new PublishedPostPage( page );
await publishedPostPage.validateTextInPost( title );
await publishedPostPage.validateTextInPost( quote );
} );

it( 'Post metadata is found in published post', async function () {
await publishedPostPage.validateTextInPost( category );
await publishedPostPage.validateTextInPost( tag );
await gutenbergEditorPage.openNavSidebar();
await gutenbergEditorPage.returnToHomeDashboard();
} );
} );
} );
10 changes: 3 additions & 7 deletions test/e2e/specs/specs-playwright/wp-signup__free.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,9 @@ describe.skip( DataHelper.createSuiteTitle( 'Signup: WordPress.com Free' ), func
it( 'Return to Home dashboard', async function () {
// Temporary workaround due to https://github.com/Automattic/wp-calypso/issues/51162.
// Conditional can be removed once fixed.
if ( BrowserHelper.getTargetDeviceName() === 'mobile' ) {
await page.goBack();
} else {
gutenbergEditorPage = new GutenbergEditorPage( page );
await gutenbergEditorPage.openNavSidebar();
await gutenbergEditorPage.returnToDashboard();
}
gutenbergEditorPage = new GutenbergEditorPage( page );
await gutenbergEditorPage.openNavSidebar();
await gutenbergEditorPage.returnToHomeDashboard();
} );
} );

Expand Down

0 comments on commit b4ad308

Please sign in to comment.