protected function CartBrowserTestTrait::assertAttributeSelected in Commerce Core 8.2
Asserts that an attribute option is selected.
Parameters
string $selector: The element selector.
string $option: The option.
6 calls to CartBrowserTestTrait::assertAttributeSelected()
- AddToCartMultiAttributeTest::testMultipleVariations in modules/
cart/ tests/ src/ FunctionalJavascript/ AddToCartMultiAttributeTest.php - Tests adding a product to the cart when there are multiple variations.
- AddToCartMultiAttributeTest::testRenderedVariationFields in modules/
cart/ tests/ src/ FunctionalJavascript/ AddToCartMultiAttributeTest.php - Tests that the cart refreshes rendered variation fields.
- AddToCartMultilingualTest::testProductVariationAttributesWidget in modules/
cart/ tests/ src/ FunctionalJavascript/ AddToCartMultilingualTest.php - Tests that the attribute widget uses translated items.
- AddToCartMultilingualTest::testProductVariationAttributesWidgetFromUrl in modules/
cart/ tests/ src/ FunctionalJavascript/ AddToCartMultilingualTest.php - Tests the attribute widget default values with a variation url (?v=).
- AddToCartMultilingualTest::testProductVariationTitleWidget in modules/
cart/ tests/ src/ FunctionalJavascript/ AddToCartMultilingualTest.php - Tests the title widget has translated variation title.
File
- modules/
cart/ tests/ src/ Traits/ CartBrowserTestTrait.php, line 39
Class
- CartBrowserTestTrait
- Defines a trait for commerce_cart functional tests.
Namespace
Drupal\Tests\commerce_cart\TraitsCode
protected function assertAttributeSelected($selector, $option) {
$selected_option = $this
->getSession()
->getPage()
->find('css', 'select[name="' . $selector . '"] option[selected="selected"]')
->getText();
$this
->assertEquals($option, $selected_option);
}