mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 899614 - Make tab count check more robust in testNewTab; r=jmaher
--HG-- extra : rebase_source : 1e354f8d8d6d1b21c9b9af365dbfd605f8f4bc15
This commit is contained in:
parent
aa4c443b24
commit
6cf4ba231e
@ -34,20 +34,17 @@ public class testNewTab extends BaseTest {
|
||||
"Checking elements", "all elements present");
|
||||
|
||||
int expectedTabCount = 1;
|
||||
String tabCountText = tabCount.getText();
|
||||
tabCountInt = Integer.parseInt(tabCountText);
|
||||
getTabCount(expectedTabCount);
|
||||
mAsserter.is(tabCountInt, expectedTabCount, "Initial number of tabs correct");
|
||||
|
||||
addTab(url);
|
||||
expectedTabCount++;
|
||||
tabCountText = tabCount.getText();
|
||||
tabCountInt = Integer.parseInt(tabCountText);
|
||||
getTabCount(expectedTabCount);
|
||||
mAsserter.is(tabCountInt, expectedTabCount, "Number of tabs increased");
|
||||
|
||||
addTab(url2);
|
||||
expectedTabCount++;
|
||||
tabCountText = tabCount.getText();
|
||||
tabCountInt = Integer.parseInt(tabCountText);
|
||||
getTabCount(expectedTabCount);
|
||||
mAsserter.is(tabCountInt, expectedTabCount, "Number of tabs increased");
|
||||
|
||||
// cleanup: close all opened tabs
|
||||
@ -103,5 +100,18 @@ public class testNewTab extends BaseTest {
|
||||
mAsserter.ok(success, "Checking tab closed", "number of tabs now "+tabCountInt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void getTabCount(final int expected) {
|
||||
waitForTest(new BooleanTest() {
|
||||
@Override
|
||||
public boolean test() {
|
||||
String newTabCountText = tabCount.getText();
|
||||
tabCountInt = Integer.parseInt(newTabCountText);
|
||||
if (tabCountInt == expected) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, MAX_WAIT_MS);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user