File size: 1,659 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
/**
* @group p2
*/
import {
DataHelper,
P2Page,
IsolatedBlockEditorComponent,
ParagraphBlock,
TestAccount,
} from '@automattic/calypso-e2e';
import { ElementHandle, Page, Browser } from 'playwright';
declare const browser: Browser;
describe( DataHelper.createSuiteTitle( 'P2: Post' ), function () {
let page: Page;
let testAccount: TestAccount;
let blockHandle: ElementHandle;
let p2Page: P2Page;
let isolatedBlockEditorComponent: IsolatedBlockEditorComponent;
const postContent = DataHelper.getTimestamp();
beforeAll( async () => {
page = await browser.newPage();
testAccount = new TestAccount( 'p2User' );
await testAccount.authenticate( page );
} );
it( 'View P2', async function () {
await page.goto( testAccount.getSiteURL(), { waitUntil: 'networkidle' } );
} );
it( 'Add a Paragraph block', async function () {
p2Page = new P2Page( page );
await p2Page.clickNewPost();
isolatedBlockEditorComponent = new IsolatedBlockEditorComponent( page );
blockHandle = await isolatedBlockEditorComponent.addBlock(
ParagraphBlock.blockName,
ParagraphBlock.blockEditorSelector
);
} );
it( 'Enter text', async function () {
const paragraphBlock = new ParagraphBlock( blockHandle );
await paragraphBlock.enterParagraph( postContent );
} );
it( 'Submit post', async function () {
await isolatedBlockEditorComponent.submitPost();
// Click twice since the first "Publish" click will open the publish confirmation sidebar
await isolatedBlockEditorComponent.submitPost();
} );
it( 'Validate post submission was successful', async function () {
await p2Page.validatePostContent( postContent );
} );
} );
|