update
This commit is contained in:
@@ -35,7 +35,7 @@ class AnalyzeTest extends UITestBase {
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
$this->drupalGet('admin/structure/views/view/test_view/edit');
|
||||
$this->assertLink(t('Analyze view'));
|
||||
$this->assertSession()->linkExists(t('Analyze view'));
|
||||
|
||||
// This redirects the user to the analyze form.
|
||||
$this->clickLink(t('Analyze view'));
|
||||
|
||||
@@ -53,7 +53,7 @@ class DefaultViewsTest extends UITestBase {
|
||||
|
||||
// It should not be possible to revert the view yet.
|
||||
// @todo Figure out how to handle this with the new configuration system.
|
||||
// $this->assertNoLink(t('Revert'));
|
||||
// $this->assertSession()->linkNotExists(t('Revert'));
|
||||
// $revert_href = 'admin/structure/views/view/glossary/revert';
|
||||
// $this->assertNoLinkByHref($revert_href);
|
||||
|
||||
@@ -81,7 +81,7 @@ class DefaultViewsTest extends UITestBase {
|
||||
// It should now be possible to revert the view. Do that, and make sure the
|
||||
// view title we added above no longer is displayed.
|
||||
// $this->drupalGet('admin/structure/views');
|
||||
// $this->assertLink(t('Revert'));
|
||||
// $this->assertSession()->linkExists(t('Revert'));
|
||||
// $this->assertLinkByHref($revert_href);
|
||||
// $this->drupalPostForm($revert_href, array(), t('Revert'));
|
||||
// $this->drupalGet('glossary');
|
||||
|
||||
@@ -47,8 +47,8 @@ class DisplayCRUDTest extends UITestBase {
|
||||
$this->drupalPostForm(NULL, [], 'Add Page');
|
||||
$this->assertLinkByHref($path_prefix . '/page_1', 0, 'Make sure after adding a display the new display appears in the UI');
|
||||
|
||||
$this->assertNoLink('Master*', 'Make sure the master display is not marked as changed.');
|
||||
$this->assertLink('Page*', 0, 'Make sure the added display is marked as changed.');
|
||||
$this->assertSession()->linkNotExists('Master*', 'Make sure the master display is not marked as changed.');
|
||||
$this->assertSession()->linkExists('Page*', 0, 'Make sure the added display is marked as changed.');
|
||||
|
||||
$this->drupalPostForm("admin/structure/views/nojs/display/{$view['id']}/page_1/path", ['path' => 'test/path'], t('Apply'));
|
||||
$this->drupalPostForm(NULL, [], t('Save'));
|
||||
|
||||
@@ -38,7 +38,7 @@ class DisplayExtenderUITest extends UITestBase {
|
||||
|
||||
$random_text = $this->randomMachineName();
|
||||
$this->drupalPostForm($display_option_url, ['test_extender_test_option' => $random_text], t('Apply'));
|
||||
$this->assertLink($random_text);
|
||||
$this->assertSession()->linkExists($random_text);
|
||||
$this->drupalPostForm(NULL, [], t('Save'));
|
||||
$view = Views::getView($view->storage->id());
|
||||
$view->initDisplay();
|
||||
|
||||
@@ -57,7 +57,7 @@ class DisplayPathTest extends UITestBase {
|
||||
// Add a new page display and check the appearing text.
|
||||
$this->drupalPostForm(NULL, [], 'Add Page');
|
||||
$this->assertText(t('No path is set'), 'The right text appears if no path was set.');
|
||||
$this->assertNoLink(t('View @display', ['@display' => 'page']), 'No view page link found on the page.');
|
||||
$this->assertSession()->linkNotExists(t('View @display', ['@display' => 'page']), 'No view page link found on the page.');
|
||||
|
||||
// Save a path and make sure the summary appears as expected.
|
||||
$random_path = $this->randomMachineName();
|
||||
@@ -68,7 +68,7 @@ class DisplayPathTest extends UITestBase {
|
||||
$this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', ['path' => $random_path], t('Apply'));
|
||||
$this->assertText('/' . $random_path, 'The custom path appears in the summary.');
|
||||
$display_link_text = t('View @display', ['@display' => 'Page']);
|
||||
$this->assertLink($display_link_text, 0, 'view page link found on the page.');
|
||||
$this->assertSession()->linkExists($display_link_text, 0, 'view page link found on the page.');
|
||||
$this->clickLink($display_link_text);
|
||||
$this->assertUrl($random_path);
|
||||
}
|
||||
@@ -159,7 +159,7 @@ class DisplayPathTest extends UITestBase {
|
||||
$this->assertUrl('admin/structure/views/view/test_view/edit/page_1');
|
||||
|
||||
$this->drupalGet('admin/structure/views/view/test_view');
|
||||
$this->assertLink(t('Tab: @title', ['@title' => 'Test tab title']));
|
||||
$this->assertSession()->linkExists(t('Tab: @title', ['@title' => 'Test tab title']));
|
||||
// If it's a default tab, it should also have an additional settings link.
|
||||
$this->assertLinkByHref('admin/structure/views/nojs/display/test_view/page_1/tab_options');
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ class DisplayTest extends UITestBase {
|
||||
// The form redirects to the master display.
|
||||
$this->drupalGet($path);
|
||||
|
||||
$this->assertLink(t('Custom URL'), 0, 'The link option has custom URL as summary.');
|
||||
$this->assertSession()->linkExists(t('Custom URL'), 0, 'The link option has custom URL as summary.');
|
||||
|
||||
// Test the default link_url value for new display
|
||||
$this->drupalPostForm(NULL, [], t('Add Block'));
|
||||
|
||||
@@ -41,7 +41,10 @@ class FilterUITest extends UITestBase {
|
||||
* Tests that an option for a filter is saved as expected from the UI.
|
||||
*/
|
||||
public function testFilterInOperatorUi() {
|
||||
$admin_user = $this->drupalCreateUser(['administer views', 'administer site configuration']);
|
||||
$admin_user = $this->drupalCreateUser([
|
||||
'administer views',
|
||||
'administer site configuration',
|
||||
]);
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
$path = 'admin/structure/views/nojs/handler/test_filter_in_operator_ui/default/filter/type';
|
||||
@@ -64,12 +67,15 @@ class FilterUITest extends UITestBase {
|
||||
* Tests the filters from the UI.
|
||||
*/
|
||||
public function testFiltersUI() {
|
||||
$admin_user = $this->drupalCreateUser(['administer views', 'administer site configuration']);
|
||||
$admin_user = $this->drupalCreateUser([
|
||||
'administer views',
|
||||
'administer site configuration',
|
||||
]);
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
$this->drupalGet('admin/structure/views/view/test_filter_groups');
|
||||
|
||||
$this->assertLink('Content: ID (= 1)', 0, 'Content: ID (= 1) link appears correctly.');
|
||||
$this->assertSession()->linkExists('Content: ID (= 1)', 0, 'Content: ID (= 1) link appears correctly.');
|
||||
|
||||
// Tests that we can create a new filter group from UI.
|
||||
$this->drupalGet('admin/structure/views/nojs/rearrange-filter/test_filter_groups/page');
|
||||
@@ -96,7 +102,10 @@ class FilterUITest extends UITestBase {
|
||||
* Tests the identifier settings and restrictions.
|
||||
*/
|
||||
public function testFilterIdentifier() {
|
||||
$admin_user = $this->drupalCreateUser(['administer views', 'administer site configuration']);
|
||||
$admin_user = $this->drupalCreateUser([
|
||||
'administer views',
|
||||
'administer site configuration',
|
||||
]);
|
||||
$this->drupalLogin($admin_user);
|
||||
$path = 'admin/structure/views/nojs/handler/test_filter_in_operator_ui/default/filter/type';
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class GroupByTest extends UITestBase {
|
||||
|
||||
// Change the groupby type in the UI.
|
||||
$this->drupalPostForm($edit_groupby_url, ['options[group_type]' => 'count'], t('Apply'));
|
||||
$this->assertLink('COUNT(Views test: ID)', 0, 'The count setting is displayed in the UI');
|
||||
$this->assertSession()->linkExists('COUNT(Views test: ID)', 0, 'The count setting is displayed in the UI');
|
||||
|
||||
$this->drupalPostForm(NULL, [], t('Save'));
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class RowUITest extends UITestBase {
|
||||
$this->assertFieldByName('row_options[test_option]', $random_name, 'Make sure the custom settings form field has the expected value stored.');
|
||||
|
||||
$this->drupalPostForm($view_edit_url, [], t('Save'));
|
||||
$this->assertLink(t('Test row plugin'), 0, 'Make sure the test row plugin is shown in the UI');
|
||||
$this->assertSession()->linkExists(t('Test row plugin'), 0, 'Make sure the test row plugin is shown in the UI');
|
||||
|
||||
$view = Views::getView($view_name);
|
||||
$view->initDisplay();
|
||||
|
||||
@@ -74,7 +74,7 @@ class SettingsTest extends UITestBase {
|
||||
$view['id'] = strtolower($this->randomMachineName());
|
||||
$this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
|
||||
|
||||
$this->assertNoLink(t('Master'));
|
||||
$this->assertSession()->linkNotExists(t('Master'));
|
||||
|
||||
// Configure to always show the advanced settings.
|
||||
// @todo It doesn't seem to be a way to test this as this works just on js.
|
||||
|
||||
@@ -51,7 +51,7 @@ class StyleUITest extends UITestBase {
|
||||
$this->assertFieldByName('style_options[test_option]', $random_name, 'Make sure the custom settings form field has the expected value stored.');
|
||||
|
||||
$this->drupalPostForm($view_edit_url, [], t('Save'));
|
||||
$this->assertLink(t('Test style plugin'), 0, 'Make sure the test style plugin is shown in the UI');
|
||||
$this->assertSession()->linkExists(t('Test style plugin'), 0, 'Make sure the test style plugin is shown in the UI');
|
||||
|
||||
$view = Views::getView($view_name);
|
||||
$view->initDisplay();
|
||||
|
||||
@@ -29,7 +29,7 @@ class ViewEditTest extends UITestBase {
|
||||
*/
|
||||
public function testDeleteLink() {
|
||||
$this->drupalGet('admin/structure/views/view/test_view');
|
||||
$this->assertLink(t('Delete view'), 0, 'Ensure that the view delete link appears');
|
||||
$this->assertSession()->linkExists(t('Delete view'), 0, 'Ensure that the view delete link appears');
|
||||
|
||||
$view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_view');
|
||||
$this->assertInstanceOf(View::class, $view);
|
||||
@@ -59,7 +59,7 @@ class ViewEditTest extends UITestBase {
|
||||
// Change the machine name for the display from page_1 to test_1.
|
||||
$edit = ['display_id' => 'test_1'];
|
||||
$this->drupalPostForm('admin/structure/views/nojs/display/test_view/attachment_1/display_id', $edit, 'Apply');
|
||||
$this->assertLink(t('test_1'));
|
||||
$this->assertSession()->linkExists(t('test_1'));
|
||||
|
||||
// Save the view, and test the new ID has been saved.
|
||||
$this->drupalPostForm(NULL, [], 'Save');
|
||||
@@ -73,7 +73,7 @@ class ViewEditTest extends UITestBase {
|
||||
$edit = ['display_id' => 'test_1'];
|
||||
$this->drupalPostForm('admin/structure/views/nojs/display/test_view/test_1/display_id', $edit, 'Apply');
|
||||
$this->drupalPostForm(NULL, [], 'Save');
|
||||
$this->assertLink(t('test_1'));
|
||||
$this->assertSession()->linkExists(t('test_1'));
|
||||
|
||||
// Test the form validation with invalid IDs.
|
||||
$machine_name_edit_url = 'admin/structure/views/nojs/display/test_view/test_1/display_id';
|
||||
@@ -103,7 +103,7 @@ class ViewEditTest extends UITestBase {
|
||||
|
||||
// Test that the display ID has not been changed.
|
||||
$this->drupalGet('admin/structure/views/view/test_view/edit/test_1');
|
||||
$this->assertLink(t('test_1'));
|
||||
$this->assertSession()->linkExists(t('test_1'));
|
||||
|
||||
// Test that validation does not run on cancel.
|
||||
$this->drupalGet('admin/structure/views/view/test_view');
|
||||
@@ -136,7 +136,7 @@ class ViewEditTest extends UITestBase {
|
||||
$langcode_url = 'admin/structure/views/nojs/display/' . $view_name . '/' . $display . '/rendering_language';
|
||||
$this->assertNoLinkByHref($langcode_url);
|
||||
$assert_session->linkNotExistsExact(t('@type language selected for page', ['@type' => t('Content')]));
|
||||
$this->assertNoLink(t('Content language of view row'));
|
||||
$this->assertSession()->linkNotExists(t('Content language of view row'));
|
||||
}
|
||||
|
||||
// Make the site multilingual and test the options again.
|
||||
@@ -153,12 +153,12 @@ class ViewEditTest extends UITestBase {
|
||||
if ($view_name == 'test_view') {
|
||||
$this->assertNoLinkByHref($langcode_url);
|
||||
$assert_session->linkNotExistsExact(t('@type language selected for page', ['@type' => t('Content')]));
|
||||
$this->assertNoLink(t('Content language of view row'));
|
||||
$this->assertSession()->linkNotExists(t('Content language of view row'));
|
||||
}
|
||||
else {
|
||||
$this->assertLinkByHref($langcode_url);
|
||||
$assert_session->linkNotExistsExact(t('@type language selected for page', ['@type' => t('Content')]));
|
||||
$this->assertLink(t('Content language of view row'));
|
||||
$this->assertSession()->linkExists(t('Content language of view row'));
|
||||
}
|
||||
|
||||
$this->drupalGet($langcode_url);
|
||||
|
||||
@@ -50,7 +50,7 @@ class ViewsListTest extends UITestBase {
|
||||
// Check if we can access the main views admin page.
|
||||
$this->drupalGet('admin/structure/views');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertLink(t('Add view'));
|
||||
$this->assertSession()->linkExists(t('Add view'));
|
||||
|
||||
// Check that there is a link to the content view without a destination
|
||||
// parameter.
|
||||
|
||||
@@ -40,7 +40,10 @@ class ViewsUITourTest extends TourTestBase {
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->adminUser = $this->drupalCreateUser(['administer views', 'access tour']);
|
||||
$this->adminUser = $this->drupalCreateUser([
|
||||
'administer views',
|
||||
'access tour',
|
||||
]);
|
||||
$this->drupalLogin($this->adminUser);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,11 +23,13 @@ class XssTest extends UITestBase {
|
||||
|
||||
public function testViewsUi() {
|
||||
$this->drupalGet('admin/structure/views/view/sa_contrib_2013_035');
|
||||
$this->assertEscaped('<marquee>test</marquee>', 'Field admin label is properly escaped.');
|
||||
// Verify that the field admin label is properly escaped.
|
||||
$this->assertEscaped('<marquee>test</marquee>');
|
||||
|
||||
$this->drupalGet('admin/structure/views/nojs/handler/sa_contrib_2013_035/page_1/header/area');
|
||||
$this->assertEscaped('{{ title }} == <marquee>test</marquee>', 'Token label is properly escaped.');
|
||||
$this->assertEscaped('{{ title_1 }} == <script>alert("XSS")</script>', 'Token label is properly escaped.');
|
||||
// Verify that the token label is properly escaped.
|
||||
$this->assertEscaped('{{ title }} == <marquee>test</marquee>');
|
||||
$this->assertEscaped('{{ title_1 }} == <script>alert("XSS")</script>');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -133,6 +133,7 @@ class ViewsListingTest extends WebDriverTestBase {
|
||||
* Removes any non-visible elements from the passed array.
|
||||
*
|
||||
* @param array $elements
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function filterVisibleElements($elements) {
|
||||
|
||||
Reference in New Issue
Block a user