Asserts order and quantity of select add options.
array $options: Array of expected select options in its correct order.
string $paragraphs_field: Name of the paragraphs field to check.
protected function assertSelectOptions($options, $paragraphs_field) {
$this
->drupalGet('node/add/paragraphed_test');
$buttons = $this
->xpath('//*[@name="' . $paragraphs_field . '[add_more][add_more_select]"]/option');
// Check if the options are in the same order as the given array.
foreach ($buttons as $key => $button) {
$this
->assertEquals($button
->getValue(), $options[$key]);
}
$this
->assertEquals(count($buttons), count($options), 'The amount of select options matches with the given array');
$this
->assertNotEquals($this
->xpath('//*[@name="' . $paragraphs_field . '_add_more"]'), [], 'The add button is displayed');
}