woocommerce/plugins/woocommerce-blocks/tests/e2e/utils/constants.ts

39 lines
1.9 KiB
TypeScript
Raw Normal View History

/**
* External dependencies
*/
import path from 'path';
export const BLOCK_THEME_WITH_TEMPLATES_SLUG = 'theme-with-woo-templates';
export const BLOCK_THEME_WITH_TEMPLATES_NAME = 'Theme with Woo Templates';
export const BLOCK_THEME_SLUG = 'twentytwentyfour';
export const BLOCK_THEME_NAME = 'Twenty Twenty-Four';
export const BLOCK_CHILD_THEME_WITH_BLOCK_NOTICES_FILTER_SLUG = `${ BLOCK_THEME_SLUG }-child__block-notices-filter`;
export const BLOCK_CHILD_THEME_WITH_BLOCK_NOTICES_TEMPLATE_SLUG = `${ BLOCK_THEME_SLUG }-child__block-notices-template`;
export const BLOCK_CHILD_THEME_WITH_CLASSIC_NOTICES_TEMPLATE_SLUG = `${ BLOCK_THEME_SLUG }-child__classic-notices-template`;
export const CLASSIC_THEME_SLUG = 'storefront';
export const CLASSIC_THEME_NAME = 'Storefront';
export const CLASSIC_CHILD_THEME_WITH_BLOCK_NOTICES_FILTER_SLUG = `${ CLASSIC_THEME_SLUG }-child__block-notices-filter`;
export const CLASSIC_CHILD_THEME_WITH_BLOCK_NOTICES_TEMPLATE_SLUG = `${ CLASSIC_THEME_SLUG }-child__block-notices-template`;
export const CLASSIC_CHILD_THEME_WITH_CLASSIC_NOTICES_TEMPLATE_SLUG = `${ CLASSIC_THEME_SLUG }-child__classic-notices-template`;
Initialize BlockTemplatesController for block themes only (#48905) * Move `check_should_use_blockified_product_grid_templates` to `wc-template-functions.php` * add changelog entry * alias Blocks/Options as BlocksOptions * Init `BlockTemplatesController` for block themes only * Remove the `wc_current_theme_is_fse_theme()` check from BTC * Streamline the option update logic a tad * Revert "Streamline the option update logic a tad" This reverts commit 54a965d9784df253f82533991e03c1112fd386ef. * init BTC for themes that support block template parts Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com> * init BTC for themes that support block template parts, p.2 Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com> * move the check to a new OptionsManager class * make types consistent * add classic theme with block template parts support * tmp: add logs for debugging * Initialize BlockTemplatesController on init * Remove debugging code * Prevent duplicate template parts appearing in the Site Editor in classic themes that support template parts * Update e2e tests for classic themes that support template parts * Fix Checkout header not being rendered * Fix PHP tests * Simplify WC_BLOCK_USE_BLOCKIFIED_PRODUCT_GRID_BLOCK_AS_TEMPLATE logic * Rename OptionsManager class to TemplateOptions * Change format of inline comment * Use wc()->is_store_api_request() * Update plugins/woocommerce/src/Blocks/TemplateOptions.php Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com> * Update testing theme slugs * Add strict_types to TemplateOptions file * Refactor check_should_use_blockified_product_grid_templates() * Don't update 'wc_blocks_use_blockified_product_grid_block_as_template' when switching between block themes * Add extra unit test to make sure the option is not updated when switching between block themes * Update strict_types format * Remove unnecessary theme switch after tests finish running * Replace .toHaveCount( 0 ) with .toBeHidden() in several tests * Create a TestUtils to abstract logic to open Mini-Cart block * Remove unnecessary import * Replace .toHaveCount( 0 ) with .toBeHidden() in several tests (II) --------- Co-authored-by: Bart Kalisz <bartlomiej.kalisz@gmail.com> Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>
2024-07-03 09:31:41 +00:00
export const CLASSIC_CHILD_THEME_WITH_BLOCK_TEMPLATE_PARTS_SLUG = `${ CLASSIC_THEME_SLUG }-child__with-block-template-part`;
export const CLASSIC_CHILD_THEME_WITH_BLOCK_TEMPLATE_PARTS_SUPPORT_SLUG = `${ CLASSIC_THEME_SLUG }-child__with-block-template-part-support`;
export const BASE_URL = 'http://localhost:8889';
Playwright E2E tests: Multiple signed in roles (https://github.com/woocommerce/woocommerce-blocks/pull/10561) * Convert checkout place order E2E tests to Playwright * Add "gotoMyAccount" method * Create login/logout utility functions * Use the existing "customer" test data * Complete the place order test cases * Fix "My Account" page title * Fix rebase * Reset My account page title * Check for heading instead of the page title * Check for heading in login/logout functions * Fix all failing tests * Add guest/customer/admin roles * Update the auth setup * Register the auth setup within Playwright * Update testing cases * Add generated auth files to .gitignore * Tidy up comments Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com> * Remove unnecessary comment Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com> * Update comments Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com> * Remove unnecessary comment Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com> * Update comment for Guest case Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com> * Remove confusing comment * Remove another unnecessary comment * Remove unnecessary Playwright project dependency * Tidy up the file structure and constants * Fix mixed up test descriptions * Remove commented code Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com> * Remove unnecessary function from frontend-utils * Refactor testing cases * Rename testing file * Delete unused testing file * Ensure we're logged out before trying to log in as a user * Log out before each authentication setup step * Ensure tests requiring admin are logged in * Log in as admin during block theme setup * Fix Playwright strict mode violation * Run Multiple sign-in roles to the global-setup phase In this step of the Playwright's setup, we can add the multiple sign-in roles and keeping the admin logged by default. This fixes the issue of failing tests `logged out` error. * Remove unnecessary login as admin * Remove "auth.setup" dependency since the logic lives in the global setup instead * Remove unnecessary login as admin from test files The admin profile is set by default --------- Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com> Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2023-12-08 16:44:59 +00:00
export const WP_ARTIFACTS_PATH =
process.env.WP_ARTIFACTS_PATH ||
path.join( process.cwd(), 'tests/e2e/artifacts' );
export const STORAGE_STATE_PATH =
process.env.STORAGE_STATE_PATH ||
path.join( WP_ARTIFACTS_PATH, 'storage-states/admin.json' );
// User roles storage states
export const adminFile = STORAGE_STATE_PATH;
export const customerFile = path.join(
path.dirname( STORAGE_STATE_PATH ),
'customer.json'
);
export const guestFile = { cookies: [], origins: [] };
export const DB_EXPORT_FILE = 'blocks_e2e.sql';