# Running UI tests in github action fails

**URL:** <https://club.ministryoftesting.com/t/running-ui-tests-in-github-action-fails/74307>\
**Category:** Discussions\
**Tags:** automation, ui-automation, mot-fcta\
**Created:** [23 February 2024 07:34 UTC](https://club.ministryoftesting.com/t/running-ui-tests-in-github-action-fails/74307 "2024-02-23T07:34:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![christian.baumann](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/christian.baumann/32/14979_2.png) [@christian.baumann](https://club.ministryoftesting.com/u/christian.baumann)\
**Post date:** [23 February 2024 07:34 UTC](https://club.ministryoftesting.com/t/running-ui-tests-in-github-action-fails/74307/1 "2024-02-23T07:34:57Z")

</div>

Running UI tests in github action fails

Hi all,

I followed _2.4.2 Adding a Framework to a Pipeline_ to setup my pipeline on github actions, but the _LoginTest_ is failing: [https://github.com/christianbaumann/mot-cert-support-app-java/actions/runs/8016005960/job/21897132340](https://github.com/christianbaumann/mot-cert-support-app-java/actions/runs/8016005960/job/21897132340)

```auto
[INFO] Running com.ministryoftesting.LoginTest
07:29:40.964 [main] INFO io.github.bonigarcia.wdm.WebDriverManager -- Using chromedriver 121.0.6167.184 (resolved driver for Chrome 121)
07:29:41.002 [main] INFO io.github.bonigarcia.wdm.online.Downloader -- Downloading https://storage.googleapis.com/chrome-for-testing-public/121.0.6167.184/mac-x64/chromedriver-mac-x64.zip
07:29:41.914 [main] INFO io.github.bonigarcia.wdm.online.Downloader -- Extracting driver from compressed file chromedriver-mac-x64.zip
07:29:42.070 [main] INFO io.github.bonigarcia.wdm.WebDriverManager -- Exporting webdriver.chrome.driver as /Users/runner/.cache/selenium/chromedriver/mac64/121.0.6167.184/chromedriver
ChromeDriver initialized successfully.
2024-02-23T07:29:43.923Z INFO 3265 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2024-02-23T07:29:43.923Z INFO 3265 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2024-02-23T07:29:43.924Z INFO 3265 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
Error: Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 9.408 s <<< FAILURE! - in com.ministryoftesting.LoginTest
Error: testPageUpdatesToProjectPageAfterLogin Time elapsed: 4.301 s <<< ERROR!
org.openqa.selenium.NoSuchElementException: 
no such element: Unable to locate element: {"method":"css selector","selector":"*[name='email']"}
  (Session info: chrome-headless-shell=121.0.6167.184)
For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
Build info: version: '4.14.1', revision: '03f8ede370'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '12.7.3', java.version: '18.0.2.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [220dde387270901eedfde99a8e657bcd, findElement {using=name, value=email}]
Capabilities {acceptInsecureCerts: false, browserName: chrome-headless-shell, browserVersion: 121.0.6167.184, chrome: {chromedriverVersion: 121.0.6167.184 (057a8ae7deb..., userDataDir: /var/folders/h1/8hndypj13ns...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:49190}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: mac, proxy: Proxy(), se:cdp: ws://localhost:49190/devtoo..., se:cdpVersion: 121.0.6167.184, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Session ID: 220dde387270901eedfde99a8e657bcd
	at com.ministryoftesting.LoginTest.testPageUpdatesToProjectPageAfterLogin(LoginTest.java:45)

```

Any advice?  
Thanks!

---

<div class="post-metadata">

**Author:** ![ansha\_batra](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/ansha_batra/32/12845_2.png) [@ansha\_batra](https://club.ministryoftesting.com/u/ansha_batra)\
**Post date:** [23 February 2024 08:06 UTC](https://club.ministryoftesting.com/t/running-ui-tests-in-github-action-fails/74307/2 "2024-02-23T08:06:14Z")

</div>

The failure of your LoginTest is due to an instance of “NoSuchElementException” unable to locate the HTML element with the CSS selector with the name ‘email’.

---

<div class="post-metadata">

**Author:** ![christian.baumann](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/christian.baumann/32/14979_2.png) [@christian.baumann](https://club.ministryoftesting.com/u/christian.baumann)\
**Post date:** [23 February 2024 08:20 UTC](https://club.ministryoftesting.com/t/running-ui-tests-in-github-action-fails/74307/3 "2024-02-23T08:20:03Z")

</div>

Yeah, that’s my understanding as well.

Okay, apparently the UI wasn’t there yet.  
Solved by adding a `wait` before trying to interact with any element:

```java
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("email")));

```

---

<div class="post-metadata">

**Author:** ![ansha\_batra](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/ansha_batra/32/12845_2.png) [@ansha\_batra](https://club.ministryoftesting.com/u/ansha_batra)\
**Post date:** [23 February 2024 08:29 UTC](https://club.ministryoftesting.com/t/running-ui-tests-in-github-action-fails/74307/4 "2024-02-23T08:29:31Z")

</div>

Great!!! Happy testing.

---

<div class="post-metadata">

**Author:** ![conrad.braam](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/conrad.braam/32/660_2.png) [@conrad.braam](https://club.ministryoftesting.com/u/conrad.braam)\
**Post date:** [23 February 2024 08:33 UTC](https://club.ministryoftesting.com/t/running-ui-tests-in-github-action-fails/74307/5 "2024-02-23T08:33:32Z")

</div>

How did you arrive at 10 seconds being a good wait interval here? I mean do you not use implicit webdriver waits all of the time, and if not, why?

Do test frameworks (my current tool) that use explicit waits struggle with hard coded wait interval decisions they later have to change?

---

<div class="post-metadata">

**Author:** ![christian.baumann](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/christian.baumann/32/14979_2.png) [@christian.baumann](https://club.ministryoftesting.com/u/christian.baumann)\
**Post date:** [23 February 2024 08:41 UTC](https://club.ministryoftesting.com/t/running-ui-tests-in-github-action-fails/74307/6 "2024-02-23T08:41:28Z")

</div>

To give some context: This is based on the MoT Testautomation Foundations Certificate course.

It was a quick fix, “just” to make the pipeline green, and the easiest, since I just had to copy (and adapt the selector) exactly this line from further down in the test.

The example tests in this chapter of the course are intentionally not “super sophisticated but something that can deliver value rapidly”.  
I assume when designing the exercises, @mwinteringham had something in mind like “first make it work, than make it pretty”.

That’s nothing I would do in a “real” test, but for the purpose of getting the pipeline green in the context of an exercise, this was “good enough”.

---

<div class="post-metadata">

**Author:** ![msh](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@msh](https://club.ministryoftesting.com/u/msh)\
**Post date:** [23 February 2024 12:13 UTC](https://club.ministryoftesting.com/t/running-ui-tests-in-github-action-fails/74307/7 "2024-02-23T12:13:07Z")

</div>

Im glad you noted that an explicit wait is sub-optimal!
