Skip to content

Commit

Permalink
Merge pull request #1806 from wordpress-mobile/test/list-block-toolba…
Browse files Browse the repository at this point in the history
…r-buttons

Added list block ordered button e2e test
  • Loading branch information
cameronvoell authored Jan 31, 2020
2 parents 772b610 + 14370a6 commit 976e8ae
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
13 changes: 13 additions & 0 deletions __device-tests__/gutenberg-editor-lists.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ describe( 'Gutenberg Editor tests for List block', () => {
await editorPage.verifyHtmlContent( testData.listHtml );
} );

it( 'should update format to ordered list, using toolbar button', async () => {
const listBlockElement = await editorPage.getListBlockAtPosition( 1 );

// Click List block to force EditText focus
await listBlockElement.click();

// Send a click on the order list format button
await editorPage.clickOrderedListToolBarButton();

// switch to html and verify html
await editorPage.verifyHtmlContent( testData.listHtmlOrdered );
} );

afterAll( async () => {
if ( ! isLocalEnvironment() ) {
driver.sauceJobStatus( allPassed );
Expand Down
3 changes: 3 additions & 0 deletions __device-tests__/helpers/test-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ exports.listItem2 = `Honey`;
exports.listHtml = `<!-- wp:list -->
<ul><li>Milk</li><li>Honey</li></ul>
<!-- /wp:list -->`;
exports.listHtmlOrdered = `<!-- wp:list {"ordered":true} -->
<ol><li>Milk</li><li>Honey</li></ol>
<!-- /wp:list -->`;
exports.listEndedHtml = `<!-- wp:list -->
<ul><li>Milk</li></ul>
<!-- /wp:list -->
Expand Down
11 changes: 11 additions & 0 deletions __device-tests__/pages/editor-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export default class EditorPage {
headingBlockName = 'Heading';
imageBlockName = 'Image';
galleryBlockName = 'Gallery';
unorderedListButtonName = 'Convert to unordered list';
orderedListButtonName = 'Convert to ordered list';

constructor( driver: wd.PromiseChainWebdriver ) {
this.driver = driver;
Expand Down Expand Up @@ -163,6 +165,11 @@ export default class EditorPage {
await blockButton.click();
}

async clickToolBarButton( buttonName: string ) {
const toolBarButton = await this.driver.elementByAccessibilityId( buttonName );
await toolBarButton.click();
}

// =========================
// Inline toolbar functions
// =========================
Expand Down Expand Up @@ -338,6 +345,10 @@ export default class EditorPage {
return text.toString();
}

async clickOrderedListToolBarButton() {
await this.clickToolBarButton( this.orderedListButtonName );
}

// =========================
// Image Block functions
// =========================
Expand Down

0 comments on commit 976e8ae

Please sign in to comment.