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

Embed block integration tests part 2 #35533

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ae77e2e
added test for Embed block caption.
jd-alexander Oct 12, 2021
d7446d1
Merge remote-tracking branch 'origin/rnmobile/add/embed-block-integra…
jd-alexander Oct 14, 2021
afc1ddb
WIP
jd-alexander Oct 14, 2021
67ae243
fixed unneeded diff change.
jd-alexander Oct 14, 2021
f03d25d
WIP block settings
jd-alexander Oct 14, 2021
eab90f9
Merge remote-tracking branch 'origin/rnmobile/add/embed-block-integra…
jd-alexander Oct 15, 2021
e9f5c8b
Mocked RCTAztecView to utilize an underlying TextInput.
jd-alexander Oct 15, 2021
4b9d41f
Fixed Embed block caption test issues.
jd-alexander Oct 15, 2021
5000152
Created test - toggle resize for smaller devices media settings
jd-alexander Oct 15, 2021
0f4d623
Added cannot embed test.
jd-alexander Oct 15, 2021
f03c6ad
Removed unneeded test id.
jd-alexander Oct 15, 2021
9ee25d0
Merge branch 'rnmobile/add/embed-block-integration-tests' into rnmobi…
fluiddot Oct 19, 2021
b75b4e9
Merge branch 'rnmobile/add/embed-block-integration-tests' into rnmobi…
jd-alexander Oct 27, 2021
9b4287d
WIP insert embed from slash inserter.
jd-alexander Oct 27, 2021
b675261
Mock fetch request in cannot embed test case
fluiddot Nov 2, 2021
60e8cab
Trigger onSelectionChange event instead of onChange
fluiddot Nov 2, 2021
3b7faa9
Query slash inserter item by text
fluiddot Nov 2, 2021
9b29c49
Add expected HTML to slash inserter test case
fluiddot Nov 2, 2021
95a8a23
Mock autocomplete component styles
fluiddot Nov 2, 2021
1d3bce0
Set paragraph as default block
fluiddot Nov 2, 2021
afffdc1
Add empty paragraph HTML constant
fluiddot Nov 2, 2021
8d01d96
Add test suite for insert via slash inserter case
fluiddot Nov 2, 2021
231d832
Update toggle responsive test case
fluiddot Nov 2, 2021
3b1b260
Merge branch 'rnmobile/add/embed-block-integration-tests' into rnmobi…
fluiddot Nov 2, 2021
651c80e
Fix request mock for theme endpoint
fluiddot Nov 2, 2021
8e932aa
Add slash inserter cases for most used providers
fluiddot Nov 2, 2021
b56dc46
Expect for block settings button instead edit URL button
fluiddot Nov 2, 2021
520680a
Use snapshot testing instead of checking HTML
fluiddot Nov 2, 2021
70475b7
Add block settings test suite
fluiddot Nov 2, 2021
a13c5fd
Add embed test snapshots
fluiddot Nov 2, 2021
902ca9b
Use snapshot in insert generic embed block test
fluiddot Nov 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 15 additions & 18 deletions packages/block-library/src/embed/test/index.native.js
Expand Up @@ -282,31 +282,28 @@ describe( 'Embed block', () => {
} );

it( 'sets an Embed block caption', async () => {
jd-alexander marked this conversation as resolved.
Show resolved Hide resolved
const waitForElement = ( { getByA11yLabel } ) =>
getByA11yLabel( /Embed Block\. Row 1/ );
const {
getByA11yLabel,
element,
getByText,
getByPlaceholderText,
getByTestId,
} = await initializeEditor( {
initialHtml: '',
} );
} = await initializeEditor(
{
initialHtml: '<!-- wp:embed /-->',
},
{ waitForElement }
);

const expectedURL = 'https://twitter.com/notnownikki';
const expectedCaption = 'Caption';

// Return mocked responses for the oembed endpoint.
fetchRequest.mockImplementation( ( { path } ) => {
let response = {};
if ( path.startsWith( '/oembed/1.0/proxy' ) ) {
response = RICH_TEXT_EMBED_SUCCESS_RESPONSE;
}
return Promise.resolve( response );
} );

// Open the inserter menu
fireEvent.press( await waitFor( () => getByA11yLabel( 'Add block' ) ) );
// Select block
fireEvent.press( element );

// Insert an embed block
fireEvent.press( await waitFor( () => getByText( `Embed` ) ) );
// Edit URL
fireEvent.press( getByText( 'ADD LINK' ) );

// Wait for edit URL modal to be visible
const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
Expand All @@ -322,7 +319,7 @@ describe( 'Embed block', () => {
fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );

// Set a caption
const caption = getByTestId( 'embed-caption' );
const caption = await waitFor( () => getByTestId( 'embed-caption' ) );
jd-alexander marked this conversation as resolved.
Show resolved Hide resolved
fireEvent( caption, 'focus' );
fireEvent.changeText( caption, expectedCaption );

Expand Down
2 changes: 1 addition & 1 deletion test/native/__mocks__/styleMock.js
Expand Up @@ -72,7 +72,7 @@ module.exports = {
richTextPlaceholder: {
color: 'gray',
},
unsupportedBlockIcon: {
çç: {
color: 'white',
},
infoIcon: {
Expand Down