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

WordPress 6.7 compatibility / test coverage #696

Merged
merged 9 commits into from
Sep 29, 2024
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
26 changes: 24 additions & 2 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions: {}

jobs:
e2e-tests:
name: 'E2E Tests (${{ matrix.wp }}) (${{ matrix.shard }})'
name: E2E Tests (${{ matrix.wp }}${{ matrix.gb && ' + GB ' }}) (${{ matrix.shard }})
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental == true }}
strategy:
Expand All @@ -38,6 +38,22 @@ jobs:
- wp: 'trunk'
shard: '4/4'
experimental: true
- wp: 'trunk'
gb: true
shard: '1/4'
experimental: true
- wp: 'trunk'
gb: true
shard: '2/4'
experimental: true
- wp: 'trunk'
gb: true
shard: '3/4'
experimental: true
- wp: 'trunk'
gb: true
shard: '4/4'
experimental: true

steps:
- name: Checkout
Expand Down Expand Up @@ -71,8 +87,14 @@ jobs:

chmod -R 767 ./
npm run wp-env start

if [[ $GUTENBERG != 'true' ]]; then
echo "Deactivating Gutenberg plugin"
npm run wp-env --silent -- run tests-cli wp plugin deactivate gutenberg
fi
env:
WP_VERSION: ${{ matrix.wp }}
GUTENBERG: ${{ matrix.gb == 'true' }}

- name: Run tests
run: |
Expand All @@ -94,7 +116,7 @@ jobs:
ARTIFACT_NAME=${ARTIFACT_NAME//\//-}
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
env:
ARTIFACT_NAME: failures-artifacts-${{ matrix.wp }}-${{ matrix.shard }}
ARTIFACT_NAME: failures-artifacts-${{ matrix.wp }}${{ matrix.gb && '-gb' }}-${{ matrix.shard }}

- name: Archive debug artifacts (screenshots, HTML snapshots)
uses: actions/upload-artifact@v4
Expand Down
5 changes: 4 additions & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"core": null,
"plugins": [ "." ],
"plugins": [
".",
"https://downloads.wordpress.org/plugin/gutenberg.latest-stable.zip"
],
"mappings": {
"wp-content/mu-plugins": "./tests/e2e/mu-plugins"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/editor/src/block-media-panel/add-poster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
}

export function AddPoster( { attributes, setAttributes }: AddPosterProps ) {
const { baseControlProps, controlProps } = useBaseControlProps( {} );
const { baseControlProps, controlProps } = useBaseControlProps( {

Check warning on line 37 in packages/editor/src/block-media-panel/add-poster.tsx

View check run for this annotation

Codecov / codecov/patch

packages/editor/src/block-media-panel/add-poster.tsx#L37

Added line #L37 was not covered by tests
__nextHasNoMarginBottom: true,
} );

const [ posterId, setPosterId ] = useState< number | undefined >();

Expand Down
2 changes: 2 additions & 0 deletions packages/editor/src/block-media-panel/audio-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export function AudioControls( props: AudioControlsProps ) {
if ( url ) {
props.setAttributes( {
src: url,
// New local attribute in WordPress 6.7.
blob: url,
} );
}
}
Expand Down
4 changes: 3 additions & 1 deletion packages/editor/src/block-media-panel/debug-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@
}

export function DebugInfo( { id }: DebugInfoProps ) {
const { baseControlProps, controlProps } = useBaseControlProps( {} );
const { baseControlProps, controlProps } = useBaseControlProps( {

Check warning on line 68 in packages/editor/src/block-media-panel/debug-info.tsx

View check run for this annotation

Codecov / codecov/patch

packages/editor/src/block-media-panel/debug-info.tsx#L68

Added line #L68 was not covered by tests
__nextHasNoMarginBottom: true,
} );

const { record: attachment } = useEntityRecord< RestAttachment | null >(
'postType',
Expand Down
4 changes: 3 additions & 1 deletion packages/editor/src/block-media-panel/generate-subtitles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
attributes,
setAttributes,
}: GenerateSubtitlesProps ) {
const { baseControlProps, controlProps } = useBaseControlProps( {} );
const { baseControlProps, controlProps } = useBaseControlProps( {

Check warning on line 35 in packages/editor/src/block-media-panel/generate-subtitles.tsx

View check run for this annotation

Codecov / codecov/patch

packages/editor/src/block-media-panel/generate-subtitles.tsx#L35

Added line #L35 was not covered by tests
__nextHasNoMarginBottom: true,
} );

const { record: post } = useEntityRecord< RestAttachment | null >(
'postType',
Expand Down
2 changes: 2 additions & 0 deletions packages/editor/src/block-media-panel/image-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export function ImageControls( props: ImageControlsProps ) {
if ( url ) {
props.setAttributes( {
url,
// New local attribute in WordPress 6.7.
blob: url,
} );
}
}
Expand Down
4 changes: 3 additions & 1 deletion packages/editor/src/block-media-panel/import-media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
onChange,
allowedTypes,
}: ImportMediaProps ) {
const { baseControlProps, controlProps } = useBaseControlProps( {} );
const { baseControlProps, controlProps } = useBaseControlProps( {

Check warning on line 37 in packages/editor/src/block-media-panel/import-media.tsx

View check run for this annotation

Codecov / codecov/patch

packages/editor/src/block-media-panel/import-media.tsx#L37

Added line #L37 was not covered by tests
__nextHasNoMarginBottom: true,
} );

const { addItemFromUrl } = useDispatch( uploadStore );
const { createErrorNotice } = useDispatch( noticesStore );
Expand Down
4 changes: 3 additions & 1 deletion packages/editor/src/block-media-panel/mute-video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
}

export function MuteVideo( { id, url, poster, onChange }: MuteVideoProps ) {
const { baseControlProps, controlProps } = useBaseControlProps( {} );
const { baseControlProps, controlProps } = useBaseControlProps( {

Check warning on line 33 in packages/editor/src/block-media-panel/mute-video.tsx

View check run for this annotation

Codecov / codecov/patch

packages/editor/src/block-media-panel/mute-video.tsx#L33

Added line #L33 was not covered by tests
__nextHasNoMarginBottom: true,
} );

const { record: post } = useEntityRecord< RestAttachment | null >(
'postType',
Expand Down
16 changes: 8 additions & 8 deletions packages/editor/src/block-media-panel/recording-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,8 @@
void startRecording();
}
} }
extraProps={ {
disabled: ! isReady && ! isRecording,
} }
disabled={ ! isReady && ! isRecording }
accessibleWhenDisabled={ true }
icon={
! isRecordingOrCountdown ? (
<StartRecording
Expand Down Expand Up @@ -244,9 +243,8 @@
void resumeRecording();
}
} }
extraProps={ {
disabled: ! isRecording && ! isPaused,
} }
disabled={ ! isRecording && ! isPaused }
accessibleWhenDisabled={ true }
icon={
isPaused ? (
<ResumeRecording
Expand All @@ -261,7 +259,7 @@
)
}
label={
isRecording
! isPaused
? __(
'Pause recording',
'media-experiments'
Expand Down Expand Up @@ -332,7 +330,9 @@
onInsert,
recordingTypes,
}: RecordingControlsProps ) {
const { baseControlProps, controlProps } = useBaseControlProps( {} );
const { baseControlProps, controlProps } = useBaseControlProps( {

Check warning on line 333 in packages/editor/src/block-media-panel/recording-controls.tsx

View check run for this annotation

Codecov / codecov/patch

packages/editor/src/block-media-panel/recording-controls.tsx#L333

Added line #L333 was not covered by tests
__nextHasNoMarginBottom: true,
} );

const { enterRecordingMode, leaveRecordingMode } =
useDispatch( recordingStore );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
const UPLOAD_REQUEST_MAX_LIFETIME = 15 * 60; // Seconds.

export function UploadRequestControls( props: UploadRequestControlsProps ) {
const { baseControlProps, controlProps } = useBaseControlProps( {} );
const { baseControlProps, controlProps } = useBaseControlProps( {

Check warning on line 44 in packages/editor/src/block-media-panel/upload-requests/controls.tsx

View check run for this annotation

Codecov / codecov/patch

packages/editor/src/block-media-panel/upload-requests/controls.tsx#L44

Added line #L44 was not covered by tests
__nextHasNoMarginBottom: true,
} );

const { openModal, closeModal } = useDispatch( interfaceStore );
// @ts-ignore -- invalidateResolution is not yet exposed in GB types.
Expand Down
2 changes: 2 additions & 0 deletions packages/editor/src/block-media-panel/video-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export function VideoControls( props: VideoControlsProps ) {
if ( url ) {
props.setAttributes( {
src: url,
// New local attribute in WordPress 6.7.
blob: url,
} );
}
}
Expand Down
4 changes: 3 additions & 1 deletion packages/editor/src/components/bulk-optimization/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@
}: {
attachments: BulkOptimizationAttachmentData[];
} ) {
const { baseControlProps, controlProps } = useBaseControlProps( {} );
const { baseControlProps, controlProps } = useBaseControlProps( {

Check warning on line 270 in packages/editor/src/components/bulk-optimization/index.tsx

View check run for this annotation

Codecov / codecov/patch

packages/editor/src/components/bulk-optimization/index.tsx#L270

Added line #L270 was not covered by tests
__nextHasNoMarginBottom: true,
} );

const [ isBulkUploading, setIsBulkUploading ] = useState( false );

Expand Down
6 changes: 6 additions & 0 deletions packages/editor/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,24 @@ import type { BlockInstance, BlockEditProps } from '@wordpress/blocks';
export type ImageBlock = BlockInstance< {
id: number;
url: string;
// New local attribute in WordPress 6.7.
blob: string;
caption: string;
alt: string;
} > & { name: 'core/image' };

export type AudioBlock = BlockInstance< {
id: number;
src: string;
// New local attribute in WordPress 6.7.
blob: string;
} > & { name: 'core/audio' };

export type VideoBlock = BlockInstance< {
id: number;
src: string;
// New local attribute in WordPress 6.7.
blob: string;
poster: string;
muted: boolean;
caption: string;
Expand Down
Loading