Chris@16: randomMachineName(10)); Chris@16: $style_label = $this->randomString(); Chris@16: $style_path = $admin_path . '/manage/' . $style_name; Chris@16: $effect_edit = [ Chris@16: 'data[test_parameter]' => 100, Chris@16: ]; Chris@16: Chris@16: // Add style form. Chris@16: $page = $this->getSession()->getPage(); Chris@16: $assert = $this->assertSession(); Chris@16: $this->drupalGet($admin_path . '/add'); Chris@16: $page->findField('label')->setValue($style_label); Chris@16: $assert->waitForElementVisible('named', ['button', 'Edit'])->press(); Chris@16: $assert->waitForElementVisible('named', ['id_or_name', 'name'])->setValue($style_name); Chris@16: $page->pressButton('Create new style'); Chris@16: $assert->pageTextContains("Style $style_label was created."); Chris@16: Chris@16: // Add two Ajax-enabled test effects. Chris@16: $this->drupalPostForm($style_path, ['new' => 'image_module_test_ajax'], t('Add')); Chris@16: $this->drupalPostForm(NULL, $effect_edit, t('Add effect')); Chris@16: $this->drupalPostForm($style_path, ['new' => 'image_module_test_ajax'], t('Add')); Chris@16: $this->drupalPostForm(NULL, $effect_edit, t('Add effect')); Chris@16: Chris@16: // Load the saved image style. Chris@16: $style = ImageStyle::load($style_name); Chris@16: Chris@16: // Edit back the effects. Chris@16: foreach ($style->getEffects() as $uuid => $effect) { Chris@16: $effect_path = $admin_path . '/manage/' . $style_name . '/effects/' . $uuid; Chris@16: $this->drupalGet($effect_path); Chris@16: $page->findField('data[test_parameter]')->setValue(111); Chris@16: $ajax_value = $page->find('css', '#ajax-value')->getText(); Chris@16: $this->assertSame('Ajax value bar', $ajax_value); Chris@16: $this->getSession()->getPage()->pressButton('Ajax refresh'); Chris@16: $this->assertTrue($page->waitFor(10, function ($page) { Chris@16: $ajax_value = $page->find('css', '#ajax-value')->getText(); Chris@16: return preg_match('/^Ajax value [0-9.]+ [0-9.]+$/', $ajax_value); Chris@16: })); Chris@16: $page->pressButton('Update effect'); Chris@16: $assert->pageTextContains('The image effect was successfully applied.'); Chris@16: } Chris@16: } Chris@16: Chris@16: }