Actions
On this page
#Page
getPageTitle
Get the page title based on the selector pageTitle on the Front Office view.
1$title = $frontOfficeCategoryPage->getPageTitle();
getTextContent
Get the text content of a specific element.
1$name = $this->getTextContent('.product-title');
goToUrl
Navigate to a fully qualified URL.
navigateTo
This method will go to the specified element and click on it.
1$this->navigateTo(2 $this->selector('productArticle',['index' => $index]) . ' .product-title a'3);
getMetaTitle
Get the meta title of the page.
waitForPageLoaded
Wait until the page has finished loading (waits for the DOMContentLoaded event, up to 10 seconds).
waitForPageReload
Wait for the page to reload after an action that triggers a navigation (form submit, filter, deletion, …).
goToPage
Navigate to a page object (or the current one when called without argument). Optional URL parameters are substituted in the page URL.
1$frontOfficeCategoryPage->goToPage($frontOfficeCategoryPage);
getTitle
Get the page heading, read from the pageTitle selector.
#Inputs
getInputValue
Read the current value of an input or textarea. Since v1.5.0 the value is read
from the live DOM .value property (works for <textarea> and for values that
differ from the initial value attribute).
1$note = $backOfficeOrderViewPage->getInputValue('#private_note_note');
setValue
Set the value of a specific input by focusing it and typing the value with the keyboard, so the site's own input listeners see a real user interaction.
1$this->setValue($this->getSelector('searchInput'), 'mug');
setValueByJs
Set the value of an input or textarea via JavaScript (assigns .value then
dispatches input and change). Use it for fields that live on an inactive tab
or in a hidden panel — where a click-then-type could not focus the element and
would leak the text into the currently focused input.
1$this->setValueByJs('#product_pricing_retail_price_price_tax_excluded', '19.99');
fillQuantity
Fill a numeric quantity into an input.
1$this->fillQuantity($this->getSelector('quantityWantedInput'), 10);
selectValue
Select the first option from a select containing value as content.
selectOption
Select an <option> by its label in a <select> element. Since v1.5.0 it
uses querySelector (so compound CSS selectors work) and dispatches a change
event on the underlying <select> — which correctly drives select2 and any JS
that listens for value changes.
1$this->selectOption('#checkout-addresses-step select[name="id_country"]', 'France');
#Visibility
isVisible
Return a boolean telling whether an element is visible, without failing the test. Useful for conditional steps. A $timeout (in ms, default 1000) can be passed.
1if ($this->isVisible($this->getSelector('cookieBanner'))) {2 $this->click($this->getSelector('cookieAcceptButton'));3}
#Mouse
click
Click on an element.
1$this->click($this->getSelector('addToCartButton'));
leftClick
Perform a native left click on an element. The optional $nth argument (default 1) targets the n-th matching element.
#Back Office
goToSubMenu
Open a Back Office admin menu entry. The parent menu is expanded first when it is visible, then the target sub-menu link is clicked and the page reload is awaited. Most native Back Office pages already call it for you through their own goTo() method.
1$this->goToSubMenu('#subtab-AdminCatalog', '#subtab-AdminProducts');
Products page
Actions on BackOffice\Products (see the EditProduct, ProductsCrud and
CreateProductAndVerify scenarios).
createProduct
Create a Standard product using the PrestaShop 9 two-step flow (open the
create page, submit the type choice, then fill name / price / quantity, activate
the product and save). The name, price and quantity fields are filled via
setValueByJs so they don't leak into one another (price and quantity live on
inactive tabs).
1$backOfficeProductsPage->createProduct('PrestaFlow Test Product', 9.99, 10);
filterByName
Filter the products grid by name and wait for the reload.
1$backOfficeProductsPage->filterByName('PrestaFlow Test Product');
openProduct
Open the product on the given row of the grid for edition.
1$backOfficeProductsPage->openProduct(1);
updatePrice
Update the price of the currently opened product and save.
1$backOfficeProductsPage->updatePrice(19.99);
getFormPrice
Read the current value of the price input on the edit form.
1$price = $backOfficeProductsPage->getFormPrice(); // "19.990000"
deleteProduct
Delete the product on the given row. Waits for the confirmation modal before clicking its confirm button.
1$backOfficeProductsPage->deleteProduct(1);
getCreatedProductId
After saving a product, return its numeric id read from the URL. Returns 0 if
no id is present.
1$id = $backOfficeProductsPage->getCreatedProductId();
getCreatedProductUrl
Return the canonical FrontOffice URL of the currently opened product (read from its "Preview" link in the Back Office). This is more reliable than guessing the friendly URL from the name.
1$url = $backOfficeProductsPage->getCreatedProductUrl();
Orders page
Actions on BackOffice\Orders (see the CheckoutOrder, OrderLifecycle and
ManageOrder scenarios).
filterByReference
Filter the orders grid by order reference.
1$backOfficeOrdersPage->filterByReference('YMVIRIPDD');
getOrderReferenceInList
Read the order reference displayed on the given row.
1$reference = $backOfficeOrdersPage->getOrderReferenceInList(1);
openOrder
Open the order on the given row (scoped to the order-view link, not the customer link).
1$backOfficeOrdersPage->openOrder(1);
OrderView page
Actions on BackOffice\OrderView (order detail).
updateStatus
Change the order status. The status name must match the label as shown in the
Back Office dropdown (which may be in English on a French shop). Under the hood,
the value is set on the underlying <select> and a change event is dispatched
so the select2 UI updates, then the update button is clicked.
1$backOfficeOrderViewPage->updateStatus('Payment accepted');
getCurrentStatus
Read the current status of the order (from the selected option of the status
<select>).
1$status = $backOfficeOrderViewPage->getCurrentStatus();
hasStatusInHistory
Return true if the given status is the currently applied status. Robust
against the debug profiler's own history panel, which shares an id with the
order status history.
1$backOfficeOrderViewPage->hasStatusInHistory('Payment accepted');
setInternalNote
Fill and submit the customer private note. Because that form sits in a collapsed panel, the input is set via JavaScript and the form is submitted programmatically.
1$backOfficeOrderViewPage->setInternalNote('PrestaFlow internal note');
getInternalNote
Read back the currently saved internal note.
1$note = $backOfficeOrderViewPage->getInternalNote();
addTracking
Set a tracking number on the order's shipping. The shipping-edit modal is opened (needed to populate its form with the carrier and the CSRF token), the tracking field is filled and its "Update" button is clicked.
1$backOfficeOrderViewPage->addTracking('PF-TRACK-0001');
getTracking
Re-open the shipping-edit modal and read its tracking field (which pre-fills with the saved value). The Carriers-tab display cell is lazy-loaded and unreliable to read headlessly.
1$tracking = $backOfficeOrderViewPage->getTracking();
#Front Office
Cart page
goToCart
Navigate to the cart page using the URL catalog (cart — resolves to
panier?action=show in French).
1$frontOfficeCartPage->goToCart();
proceedToCheckout
Click the "Checkout" button of the cart to enter the tunnel.
1$frontOfficeCartPage->proceedToCheckout();
Checkout page
Actions on FrontOffice\Checkout (multi-step checkout tunnel).
checkoutAsGuest
Fill the personal-information step of the tunnel as a guest (first name, last name, email) and tick every required consent checkbox before submitting.
1$frontOfficeCheckoutPage->checkoutAsGuest(2 'pf-guest@example.com',3 'PrestaFlow',4 'Guest'5);
fillNewAddress
Fill the addresses step with a fresh address, then submit.
1$frontOfficeCheckoutPage->fillNewAddress([2 'street' => '16 Main street',3 'city' => 'Paris',4 'postcode' => '75002',5 'country' => 'France',6 'phone' => '0102030405',7]);
confirmAddresses
Confirm the addresses step (when the customer already has one).
chooseShipping
Select the first shipping option and submit that step.
choosePaymentAndConfirm
Pick the first payment option, accept the terms and confirm the order.
Product page
goToProductPath
Navigate to a product by its canonical FrontOffice path (e.g.
1-1-hummingbird-printed-t-shirt.html). PrestaShop friendly URLs cannot be
rebuilt from an id alone, so this is the reliable way to reach a known product.
1$frontOfficeProductPage->goToProductPath('1-1-hummingbird-printed-t-shirt.html');
addToCart
Add the currently displayed product to the cart. Returns the modal message —
you can assert it contains message('addedToCart').
1$textResult = $frontOfficeProductPage->addToCart(2);
OrderConfirmation page
isConfirmed
Return whether the confirmation block is visible on the page.
1Expect::that($frontOfficeOrderConfirmationPage->isConfirmed())->equals(true);
getOrderReference
Read the order reference from the confirmation page (the "Order reference: XXXX" label is stripped so only the reference is returned).
1$reference = $frontOfficeOrderConfirmationPage->getOrderReference();
FrontOffice navigation
goToUrl
Navigate to an absolute FrontOffice URL with a clean session (the page is recreated first, so Back Office cookies don't leak in). Handy after reading a canonical URL from the Back Office.
1$frontOfficeProductPage->goToUrl($productUrl);
#Visual regression
visualCheckpoint
Take a screenshot of the current page and compare it against a stored baseline. The first run stores the baseline; subsequent runs compare and record a pass/fail result in the run's visual report.
The optional $fullPage argument (default true) selects between a full-page
capture and a viewport-only capture.
1$this->visualCheckpoint('checkout-tunnel-addresses');
Generate the HTML/JSON report at the end of the run:
1bin/prestaflow run tests --visual-report