From 453b16c79ae3ba0cfc86bb9ae64ad3e7da6de0db Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Fri, 5 Jan 2024 11:43:28 +0400 Subject: [PATCH] Clean up e2e tests package --- .../experiments/experimental-features.js | 39 --------- .../fixtures/menu-items-request-fixture.json | 84 ------------------- 2 files changed, 123 deletions(-) delete mode 100644 packages/e2e-tests/specs/experiments/experimental-features.js delete mode 100644 packages/e2e-tests/specs/experiments/fixtures/menu-items-request-fixture.json diff --git a/packages/e2e-tests/specs/experiments/experimental-features.js b/packages/e2e-tests/specs/experiments/experimental-features.js deleted file mode 100644 index 3c33f930012dde..00000000000000 --- a/packages/e2e-tests/specs/experiments/experimental-features.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * WordPress dependencies - */ -import { addQueryArgs } from '@wordpress/url'; -import { visitAdminPage } from '@wordpress/e2e-test-utils'; - -async function setExperimentalFeaturesState( features, enable ) { - const query = addQueryArgs( '', { - page: 'gutenberg-experiments', - } ); - await visitAdminPage( '/admin.php', query ); - - await Promise.all( - features.map( async ( feature ) => { - await page.waitForSelector( feature ); - const checkedSelector = `${ feature }[checked=checked]`; - const isChecked = !! ( await page.$( checkedSelector ) ); - if ( ( ! isChecked && enable ) || ( isChecked && ! enable ) ) { - await page.click( feature ); - } - } ) - ); - await Promise.all( [ - page.waitForNavigation( { waitUntil: 'networkidle0' } ), - page.click( '#submit' ), - ] ); -} - -/** - * Establishes test lifecycle to enable experimental feature for the duration of - * the grouped test block. - * - * @param {Array} features Array of {string} selectors of settings to enable. - * Assumes they can be enabled with one click. - */ -export function useExperimentalFeatures( features ) { - beforeAll( () => setExperimentalFeaturesState( features, true ) ); - afterAll( () => setExperimentalFeaturesState( features, false ) ); -} diff --git a/packages/e2e-tests/specs/experiments/fixtures/menu-items-request-fixture.json b/packages/e2e-tests/specs/experiments/fixtures/menu-items-request-fixture.json deleted file mode 100644 index 01b844c45ceee4..00000000000000 --- a/packages/e2e-tests/specs/experiments/fixtures/menu-items-request-fixture.json +++ /dev/null @@ -1,84 +0,0 @@ -[ - { - "title": "Home", - "url": "http://localhost:8889/", - "menu_order": 1 - }, - { - "title": "About", - "type": "post_type", - "object": "page", - "menu_order": 2 - }, - { - "title": "Our team", - "type": "post_type", - "object": "page", - "menu_order": 3, - "parent": 1 - }, - { - "title": "Shop", - "type": "post_type", - "object": "page", - "menu_order": 4 - }, - { - "title": "Winter apparel", - "type": "post_type", - "object": "page", - "menu_order": 5, - "parent": 3 - }, - { - "title": "Chunky socks", - "type": "post_type", - "object": "page", - "menu_order": 6, - "parent": 4 - }, - { - "title": "Hideous hats", - "type": "post_type", - "object": "page", - "menu_order": 7, - "parent": 4 - }, - { - "title": "Glorious gloves", - "type": "post_type", - "object": "page", - "menu_order": 8, - "parent": 4 - }, - { - "title": "Jazzy Jumpers", - "type": "post_type", - "object": "page", - "menu_order": 9, - "parent": 4 - }, - { - "title": "Shipping", - "type": "post_type", - "object": "page", - "menu_order": 10 - }, - { - "title": "Contact Us", - "type": "post_type", - "object": "page", - "menu_order": 11 - }, - { - "title": "WordPress.org", - "url": "https://wordpress.org", - "menu_order": 12 - }, - { - "title": "Google", - "url": "https://google.com", - "menu_order": 13, - "parent": 11 - } -]