@wordpress/e2e-test-utils-playwright
Version:
End-To-End (E2E) test utils for WordPress.
8 lines (7 loc) • 1.68 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../src/admin/create-new-post.ts"],
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Admin } from './';\n\ninterface NewPostOptions {\n\tpostType?: string;\n\ttitle?: string;\n\tcontent?: string;\n\texcerpt?: string;\n\tshowWelcomeGuide?: boolean;\n\tfullscreenMode?: boolean;\n}\n\n/**\n * Creates new post.\n *\n * @param this\n * @param options Options to create new post.\n */\nexport async function createNewPost(\n\tthis: Admin,\n\toptions: NewPostOptions = {}\n) {\n\tconst query = new URLSearchParams();\n\tconst { postType, title, content, excerpt } = options;\n\n\tif ( postType ) {\n\t\tquery.set( 'post_type', postType );\n\t}\n\tif ( title ) {\n\t\tquery.set( 'post_title', title );\n\t}\n\tif ( content ) {\n\t\tquery.set( 'content', content );\n\t}\n\tif ( excerpt ) {\n\t\tquery.set( 'excerpt', excerpt );\n\t}\n\n\tawait this.visitAdminPage( 'post-new.php', query.toString() );\n\n\tawait this.editor.setPreferences( 'core/edit-post', {\n\t\twelcomeGuide: options.showWelcomeGuide ?? false,\n\t\tfullscreenMode: options.fullscreenMode ?? false,\n\t} );\n}\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,eAAsB,cAErB,UAA0B,CAAC,GAC1B;AACD,QAAM,QAAQ,IAAI,gBAAgB;AAClC,QAAM,EAAE,UAAU,OAAO,SAAS,QAAQ,IAAI;AAE9C,MAAK,UAAW;AACf,UAAM,IAAK,aAAa,QAAS;AAAA,EAClC;AACA,MAAK,OAAQ;AACZ,UAAM,IAAK,cAAc,KAAM;AAAA,EAChC;AACA,MAAK,SAAU;AACd,UAAM,IAAK,WAAW,OAAQ;AAAA,EAC/B;AACA,MAAK,SAAU;AACd,UAAM,IAAK,WAAW,OAAQ;AAAA,EAC/B;AAEA,QAAM,KAAK,eAAgB,gBAAgB,MAAM,SAAS,CAAE;AAE5D,QAAM,KAAK,OAAO,eAAgB,kBAAkB;AAAA,IACnD,cAAc,QAAQ,oBAAoB;AAAA,IAC1C,gBAAgB,QAAQ,kBAAkB;AAAA,EAC3C,CAAE;AACH;",
"names": []
}