Merge pull request #16700 from mauriciofauth/selenium

Fix Selenium failing tests
This commit is contained in:
Maurício Meneghini Fauth 2021-03-02 20:52:55 -03:00 committed by GitHub
commit 800eaf6a9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 6 deletions

View File

@ -64,7 +64,7 @@
<label class="form-check-label" for="checkAllCheckbox">{% trans 'Check all' %}</label>
</div>
</div>
<button class="btn btn-outline-secondary" type="submit" name="submit_mult" value="Drop" form="dbStatsForm" title="{% trans 'Drop' %}">
<button class="btn btn-outline-secondary" id="bulkActionDropButton" type="submit" name="submit_mult" value="Drop" form="dbStatsForm" title="{% trans 'Drop' %}">
{{ get_icon('db_drop', 'Drop'|trans) }}
</button>
</div>

View File

@ -76,10 +76,10 @@ class CreateDropDatabaseTest extends TestBase
$this->scrollToElement($dbElement, 0, 20);
$dbElement->click();
$multSubmit = $this->byCssSelector('button#bulkActionDropButton');
$multSubmit = $this->byCssSelector('#bulkActionDropButton');
$this->scrollToElement($multSubmit);
$multSubmit->click();
$this->byCssSelector('button.submitOK')->click();
$this->byCssSelector('#dropDatabaseModalDropButton')->click();
$this->waitForElementNotPresent(
'cssSelector',

View File

@ -7,6 +7,8 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Selenium;
use function sleep;
/**
* ExportTest class
*
@ -154,11 +156,15 @@ class ExportTest extends TestBase
$this->byName('limit_to')->sendKeys('1');
}
$this->scrollIntoView('radio_view_as_text');
sleep(1);
$this->scrollIntoView('radio_view_as_text');
$this->byCssSelector('label[for=radio_view_as_text]')->click();
if ($plugin === 'SQL') {
if ($type !== 'db') {
$this->scrollIntoView('radio_sql_structure_or_data_structure_and_data');
sleep(1);
$this->scrollIntoView('radio_sql_structure_or_data_structure_and_data');
$this->byCssSelector('label[for=radio_sql_structure_or_data_structure_and_data]')->click();
}
@ -170,6 +176,8 @@ class ExportTest extends TestBase
}
}
$this->scrollToBottom();
sleep(1);
$this->scrollToBottom();
$this->byId('buttonGo')->click();

View File

@ -46,7 +46,8 @@ class ServerSettingsTest extends TestBase
// Submit the form
$ele = $this->waitForElement(
'xpath',
"//fieldset[not(contains(@style,'display: none;'))]//input[@value='Apply']"
"//div[contains(@class, 'tab-pane') and contains(@class, 'show')"
. " and contains(@class, 'active')]//input[@value='Apply']"
);
$this->scrollToBottom();
$this->moveto($ele);
@ -82,6 +83,8 @@ class ServerSettingsTest extends TestBase
$this->isElementPresent('partialLinkText', $this->databaseName)
);
$this->waitForElement('xpath', "//a[contains(@href, '#Databases')]")->click();
$this->waitForElement('name', 'Servers-1-hide_db')->clear();
$this->saveConfig();
$this->assertTrue(
@ -99,7 +102,7 @@ class ServerSettingsTest extends TestBase
$this->byPartialLinkText('SQL queries')->click();
$this->waitAjax();
$this->waitForElement('className', 'tabs');
$this->waitForElement('className', 'nav-tabs');
$this->byPartialLinkText('SQL Query box')->click();
$this->assertTrue(

View File

@ -8,6 +8,7 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Selenium\Table;
use PhpMyAdmin\Tests\Selenium\TestBase;
use function sleep;
/**
* OperationsTest class
@ -136,6 +137,8 @@ class OperationsTest extends TestBase
$this->byName('comment')->sendKeys('foobar');
$this->scrollIntoView('tableOptionsForm');
sleep(1);
$this->scrollIntoView('tableOptionsForm');
$this->waitUntilElementIsVisible('cssSelector', 'form#tableOptionsForm', 30);
$this->byCssSelector("form#tableOptionsForm input[type='submit']")->click();
@ -164,6 +167,8 @@ class OperationsTest extends TestBase
*/
public function testCopyTable(): void
{
$this->scrollIntoView('copyTable');
sleep(1);
$this->scrollIntoView('copyTable');
$this->waitUntilElementIsVisible('cssSelector', 'form#copyTable', 30);
$this->byCssSelector("form#copyTable input[name='new_name']")->sendKeys('2');
@ -195,6 +200,8 @@ class OperationsTest extends TestBase
*/
public function testTruncateTable(): void
{
$this->scrollToBottom();
sleep(1);
$this->scrollToBottom();
$this->waitUntilElementIsVisible('id', 'drop_tbl_anchor', 30);
$this->byId('truncate_tbl_anchor')->click();
@ -224,7 +231,9 @@ class OperationsTest extends TestBase
public function testDropTable(): void
{
$dropLink = $this->waitUntilElementIsVisible('partialLinkText', 'Delete the table (DROP)', 30);
$this->scrollToElement($this->byId('selflink'));
$this->scrollToBottom();
sleep(1);
$this->scrollToBottom();
$dropLink->click();
$this->byCssSelector('button.submitOK')->click();
$this->waitAjax();