|
28 | 28 | import static org.jenkinsci.test.acceptance.Matchers.pageObjectExists; |
29 | 29 |
|
30 | 30 | import com.google.inject.Inject; |
| 31 | +import java.time.Duration; |
31 | 32 | import java.util.HashMap; |
32 | 33 | import java.util.Map; |
33 | 34 | import java.util.regex.Pattern; |
@@ -207,15 +208,23 @@ private void assertHasModule(MavenModuleSet job, String name) { |
207 | 208 |
|
208 | 209 | job.visit("modules"); |
209 | 210 | WebElement webElement = find(by.xpath("//a[@href='%s/']", name)); |
210 | | - webElement.click(); |
211 | | - // a menu pops out with how selenium clicks this, an actual user will not have an issue with this |
212 | | - // clicking a second time fixes it |
213 | | - if (!driver.getCurrentUrl().equals(job.module(name).url.toExternalForm())) { |
| 211 | + |
| 212 | + // A selenium click will go to the center of the button. |
| 213 | + // If the name is short enough (like root in some of these tests) the click will be the chevron button that flys |
| 214 | + // out. |
| 215 | + // |
| 216 | + // To work around this we click multiple times, if the clicks are intercepted by a chevron flyout then due to |
| 217 | + // the sticky element hacks they do not fly back in, so eventually one of the clicks will make! |
| 218 | + waitFor(webElement).withTimeout(Duration.ofSeconds(5)).until(() -> { |
214 | 219 | webElement.click(); |
215 | | - } |
| 220 | + return isStale(webElement); |
| 221 | + }); |
| 222 | + |
216 | 223 | assertThat(driver.getCurrentUrl(), equalTo(job.module(name).url.toExternalForm())); |
217 | 224 |
|
218 | 225 | build.open(); |
| 226 | + // in the build page the status icon is also within the 'a' element so the width is big enough that the center |
| 227 | + // point won't be the chevron |
219 | 228 | find(by.xpath("//a[@href='%s/']", name)).click(); |
220 | 229 | assertThat(driver.getCurrentUrl(), equalTo(build.module(name).url.toExternalForm())); |
221 | 230 | } |
|
0 commit comments