
/**
 * WordPress dependencies
 */
import { activatePlugin, visitAdminPage } from '@wordpress/e2e-test-utils';

/**
 * The allow list of AMP modes.
 *
 */
export const allowedAmpModes = {
	standard: 'standard',
	transitional: 'transitional',
	reader: 'disabled',
};

/**
 * Activate AMP and set it to the correct mode.
 *
 * @param {string} mode The mode to set AMP to. Possible value of standard, transitional or reader.
 */
export const activateAmpAndSetMode = async ( mode ) => {
	// Test to be sure that the passed mode is known.
	expect( Object.keys( allowedAmpModes ) ).toContain( mode );
	// Active AMP and set the passed mode.
	await activatePlugin( 'amp' );
	await visitAdminPage( 'admin.php', 'page=amp-options' );
	await expect( page ).toClick( `#theme_support_${ allowedAmpModes[ mode ] }` );
	await expect( page ).toClick( '#submit' );
	await page.waitForSelector( '#setting-error-settings_updated' );
	await expect( page ).toMatchElement( '#setting-error-settings_updated', { text: 'Settings saved.' } );
};

@@ -476,16 +476,252 @@
  ) =%3E %7B%0A
+%09await activatePlugin( 'amp' );%0A%09await setAMPMode( mode );%0A%7D;%0A%0A/**%0A * Set AMP Mode%0A *%0A * @param %7Bstring%7D mode The mode to set AMP to. Possible value of standard, transitional or reader.%0A */%0Aexport const setAMPMode = async ( mode ) =%3E %7B%0A
 %09// Test
@@ -832,75 +832,24 @@
 %09// 
-Active AMP and set the passed mode.%0A%09await activatePlugin( 'amp' );
+Set the AMP mode
 %0A%09aw

Add helper to change AMP mode.