Skip to content
Snippets Groups Projects
Commit 36f23abf authored by catch's avatar catch
Browse files

Issue #3400150 by mstrelan, quietone: [random test failure]...

Issue #3400150 by mstrelan, quietone: [random test failure] TimestampFormatterWithTimeDiffTest::testTimestampFormatterWithTimeDiff
parent 365250d1
Branches
Tags
3 merge requests!3478Issue #3337882: Deleted menus are not removed from content type config,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!579Issue #2230909: Simple decimals fail to pass validation
Pipeline #454293 canceled
......@@ -88,7 +88,6 @@ protected function setUp(): void {
* Tests the 'timestamp' formatter when is used with time difference setting.
*/
public function testTimestampFormatterWithTimeDiff(): void {
$this->markTestSkipped("Skipped due to frequent random test failures. See https://www.drupal.org/project/drupal/issues/3400150");
$this->drupalGet($this->entity->toUrl());
// Unit testing Drupal.timeDiff.format(). Not using @dataProvider mechanism
......@@ -120,15 +119,15 @@ public function testTimestampFormatterWithTimeDiff(): void {
$time_diff = $time_element->getText();
[$seconds_value] = explode(' ', $time_diff, 2);
// Wait at least 1 second + 1 millisecond to make sure that the last time
// difference value has been refreshed.
$this->assertJsCondition("document.getElementsByTagName('time')[0].textContent != '$time_diff'", 1001);
// Wait up to 2 seconds to make sure that the last time difference value
// has been refreshed.
$this->assertJsCondition("document.getElementsByTagName('time')[0].textContent != '$time_diff'", 2000);
$time_diff = $time_element->getText();
[$new_seconds_value] = explode(' ', $time_diff, 2);
$this->assertGreaterThan($seconds_value, $new_seconds_value);
// Once again.
$this->assertJsCondition("document.getElementsByTagName('time')[0].textContent != '$time_diff'", 1001);
$this->assertJsCondition("document.getElementsByTagName('time')[0].textContent != '$time_diff'", 2000);
$time_diff = $time_element->getText();
$seconds_value = $new_seconds_value;
[$new_seconds_value] = explode(' ', $time_diff, 2);
......
......@@ -36,7 +36,6 @@ class TimestampFormatterWithTimeDiffViewsTest extends WebDriverTestBase {
* Tests the timestamp formatter used with time difference setting in views.
*/
public function testTimestampFormatterWithTimeDiff(): void {
$this->markTestSkipped("Skipped due to frequent random test failures. See https://www.drupal.org/project/drupal/issues/3400150");
ViewTestData::createTestViews(self::class, ['views_test_formatter']);
$data = $this->getRowData();
......@@ -67,9 +66,9 @@ public function testTimestampFormatterWithTimeDiff(): void {
$this->assertMatchesRegularExpression($regex_pattern, $time_diff);
}
// Wait at least 1 second + 1 millisecond to make sure the 'right now' time
// difference was refreshed.
$this->assertJsCondition("document.querySelector('.entity-$delta time').textContent >= '$time_diff'", 1001);
// Wait up to 2 seconds to make sure the 'right now' time difference was
// refreshed.
$this->assertJsCondition("document.querySelector('.entity-$delta time').textContent >= '$time_diff'", 2000);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment