Skip to content

Commit 6d656d4

Browse files
committed
Simplify beforeAll and afterAll.
1 parent 5974cb5 commit 6d656d4

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

‎tests/e2e/specs/accessibility.spec.js‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,16 @@ test.describe( 'Admin Pages Accessibility', () => {
112112
test.beforeAll( async ( { requestUtils } ) => {
113113
// Upload sample image to media library for testing.
114114
const imagePath = path.resolve( __dirname, '../assets/sample.png' )
115-
const uploadedMedia = await requestUtils.uploadMedia(
115+
await requestUtils.uploadMedia(
116116
imagePath
117117
);
118-
119-
// Store the ID for cleanup later.
120-
mediaAttachmentId = uploadedMedia.id;
121118
} );
122119

123120
test.afterAll( async ( { requestUtils } ) => {
124-
// Delete the uploaded image to restore initial state
125-
if ( mediaAttachmentId ) {
126-
await requestUtils.deleteMedia(
127-
mediaAttachmentId
128-
);
129-
}
121+
// Delete all media.
122+
await requestUtils.deleteAllMedia();
123+
// Delete all posts of type 'post' and all associated comments.
124+
await requestUtils.deleteAllPosts();
130125
} );
131126

132127
pages.forEach( ( pageSpec ) => {

0 commit comments

Comments
 (0)