Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RTL e2e tests #26508

Merged
merged 2 commits into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ exports[`RTL should arrow navigate 1`] = `

exports[`RTL should arrow navigate between blocks 1`] = `
"<!-- wp:paragraph -->
<p>٠</p>
<p>٠<br>١</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><br>١١٠<br><br>٢</p>
<p>٠<br>١<br>٢</p>
<!-- /wp:paragraph -->"
`;

Expand All @@ -24,11 +24,7 @@ exports[`RTL should merge backward 1`] = `

exports[`RTL should merge forward 1`] = `
"<!-- wp:paragraph -->
<p>٠</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p></p>
<p>٠١</p>
<!-- /wp:paragraph -->"
`;

Expand Down
9 changes: 3 additions & 6 deletions packages/e2e-tests/specs/editor/various/rtl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ const ARABIC_TWO = '٢';
describe( 'RTL', () => {
beforeEach( async () => {
await createNewPost();
await page.evaluate( () => {
document.querySelector( '.is-root-container' ).dir = 'rtl';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it seems reducing the scope of the layout shift is solving the issue. We're just testing rich text and writing flow here, so that's fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is weird but I guess it's better than having wrong snapshots :)

} );
} );

it( 'should arrow navigate', async () => {
await page.evaluate( () => ( document.dir = 'rtl' ) );
await page.keyboard.press( 'Enter' );

// We need at least three characters as arrow navigation *from* the
Expand All @@ -36,7 +38,6 @@ describe( 'RTL', () => {
} );

it( 'should split', async () => {
await page.evaluate( () => ( document.dir = 'rtl' ) );
await page.keyboard.press( 'Enter' );

await page.keyboard.type( ARABIC_ZERO );
Expand All @@ -48,7 +49,6 @@ describe( 'RTL', () => {
} );

it( 'should merge backward', async () => {
await page.evaluate( () => ( document.dir = 'rtl' ) );
await page.keyboard.press( 'Enter' );

await page.keyboard.type( ARABIC_ZERO );
Expand All @@ -61,7 +61,6 @@ describe( 'RTL', () => {
} );

it( 'should merge forward', async () => {
await page.evaluate( () => ( document.dir = 'rtl' ) );
await page.keyboard.press( 'Enter' );

await page.keyboard.type( ARABIC_ZERO );
Expand All @@ -75,7 +74,6 @@ describe( 'RTL', () => {
} );

it( 'should arrow navigate between blocks', async () => {
await page.evaluate( () => ( document.dir = 'rtl' ) );
await page.keyboard.press( 'Enter' );

await page.keyboard.type( ARABIC_ZERO );
Expand All @@ -101,7 +99,6 @@ describe( 'RTL', () => {
} );

it( 'should navigate inline boundaries', async () => {
await page.evaluate( () => ( document.dir = 'rtl' ) );
await page.keyboard.press( 'Enter' );

// Wait for rich text editor to load.
Expand Down