Changeset 251931 in webkit


Ignore:
Timestamp:
Nov 1, 2019 11:27:00 AM (4 years ago)
Author:
Wenson Hsieh
Message:

TestWebKitAPI.EditorStateTests.TypingAttributesTextAlignmentStartEnd is flaky in iOS simulator
https://bugs.webkit.org/show_bug.cgi?id=203733
<rdar://problem/56814640>

Reviewed by Tim Horton.

Try to fix the flaky test by making EditingTestHarness more robust. Instead of checking for expected editor
state entries after the next presentation update, wait for the latest editor state entry to contain the expected
values.

  • TestWebKitAPI/EditingTestHarness.mm:

(-[EditingTestHarness _execCommand:argument:expectEntries:]):

Preserve the existing log statement by printing it out once after a few seconds, if the entry is still not found
in the last known editor state.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r251927 r251931  
     12019-11-01  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        TestWebKitAPI.EditorStateTests.TypingAttributesTextAlignmentStartEnd is flaky in iOS simulator
     4        https://bugs.webkit.org/show_bug.cgi?id=203733
     5        <rdar://problem/56814640>
     6
     7        Reviewed by Tim Horton.
     8
     9        Try to fix the flaky test by making EditingTestHarness more robust. Instead of checking for expected editor
     10        state entries after the next presentation update, wait for the latest editor state entry to contain the expected
     11        values.
     12
     13        * TestWebKitAPI/EditingTestHarness.mm:
     14        (-[EditingTestHarness _execCommand:argument:expectEntries:]):
     15
     16        Preserve the existing log statement by printing it out once after a few seconds, if the entry is still not found
     17        in the last known editor state.
     18
    1192019-11-01  Aakash Jain  <aakash_jain@apple.com>
    220
  • trunk/Tools/TestWebKitAPI/EditingTestHarness.mm

    r242339 r251931  
    191191    TestWebKitAPI::Util::run(&done);
    192192
    193     [_webView waitForNextPresentationUpdate];
    194 
    195193    EXPECT_TRUE(result);
    196194    if (!result)
    197195        NSLog(@"Failed to execute editing command: ('%@', '%@')", command, argument ?: @"");
    198196
    199     BOOL containsEntries = [self latestEditorStateContains:entries];
    200     EXPECT_TRUE(containsEntries);
    201     if (!containsEntries)
    202         NSLog(@"Expected %@ to contain %@", self.latestEditorState, entries);
     197    const NSTimeInterval loggingTimeout = 3;
     198    auto startTime = retainPtr([NSDate date]);
     199    BOOL hasLoggedWarning = NO;
     200    BOOL containsEntries;
     201    do {
     202        [_webView waitForNextPresentationUpdate];
     203        containsEntries = [self latestEditorStateContains:entries];
     204        if (!hasLoggedWarning && [[NSDate date] timeIntervalSinceDate:startTime.get()] > loggingTimeout) {
     205            NSLog(@"Expected %@ to contain %@", self.latestEditorState, entries);
     206            hasLoggedWarning = YES;
     207        }
     208    } while (!containsEntries);
    203209}
    204210
Note: See TracChangeset for help on using the changeset viewer.