Make WordPress Core

Changeset 56090


Ignore:
Timestamp:
06/28/2023 10:57:48 AM (3 years ago)
Author:
Clorith
Message:

Build/Test Tools: Switch frame container when testing block editor output.

The initial commit added the frame lookup within the wrong test, this follow-up restores the previous test runner, and adds the container lookup to the correct test.

Follow-up to [56089].

See #58592.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/e2e/specs/edit-posts.test.js

    r56089 r56090  
    2828                await page.waitForSelector( '#the-list .type-post' );
    2929
    30                 // Wait for the editor iframe to load, and switch to it as the active content frame.
    31                 const editorFrame = await page.waitForSelector( 'iframe[name="editor-canvas"]' );
     30                // Expect there to be one row in the post list.
     31                const posts = await page.$$( '#the-list .type-post' );
     32                expect( posts.length ).toBe( 1 );
    3233
    33                 const innerFrame = await editorFrame.contentFrame();
     34                const [ firstPost ] = posts;
    3435
    35                 // Wait for title field to render onscreen.
    36                 await innerFrame.waitForSelector( '.editor-post-title__input' );
    37 
    38                 // Expect to now be in the editor with the correct post title shown.
    39                 const editorPostTitleInput = await innerFrame.$x(
    40                         `//h1[contains(@class, "editor-post-title__input")][contains(text(), "${ title }")]`
     36                // Expect the title of the post to be correct.
     37                const postTitle = await firstPost.$x(
     38                        `//a[contains(@class, "row-title")][contains(text(), "${ title }")]`
    4139                );
    4240                expect( postTitle.length ).toBe( 1 );
     
    5755                await editLink.click();
    5856
    59                 // Edit the post.
    60                 await page.waitForNavigation();
     57                // Wait for the editor iframe to load, and switch to it as the active content frame.
     58                const editorFrame = await page.waitForSelector( 'iframe[name="editor-canvas"]' );
     59
     60                const innerFrame = await editorFrame.contentFrame();
    6161
    6262                // Wait for title field to render onscreen.
    63                 await page.waitForSelector( '.editor-post-title__input' );
     63                await innerFrame.waitForSelector( '.editor-post-title__input' );
    6464
    6565                // Expect to now be in the editor with the correct post title shown.
    66                 const editorPostTitleInput = await page.$x(
     66                const editorPostTitleInput = await innerFrame.$x(
    6767                        `//h1[contains(@class, "editor-post-title__input")][contains(text(), "${ title }")]`
    6868                );
Note: See TracChangeset for help on using the changeset viewer.