I am working on building Smoke Tests (3 tests) for our company's web portal, which is built using C#, N-Unit, Selenium and Specflow.
These smoke tests are working fine in local in Visual Studio N-Unit Runner and Command Line interface (CLI). But, when we run the same tests in TeamCity CI or in CLI from TeamCity Agent server, one or two tests failing with error, such as below.
"OpenQA.Selenium.NoSuchElementException : Could not find element by: By.CssSelector: #u_r_v_search_btn"
Appropriate web element locators are in place in the test suite and looks good when we run in local. But throwing error when we run the tests in TeamCity CI pipeline.
Below command, which is working fine in local. Same command failing in TeamCity Agent Server when we run it from CLI; With error such as "could not find element". ----> nunit3-console.exe ......\Tests\Bin\Debug\Tests.dll --noheader --where cat==smoke
Team City CI commmand statement from build log:
C:\buildAgent\tools\NUnit.Console.3.9.0\nunit3-console.exe C:\buildAgent\temp\buildTmp\eahe9vWdDNwsMCnwYM0DJIHv4X7ycBFR.nunit --result=C:\buildAgent\temp\buildTmp\eahe9vWdDNwsMCnwYM0DJIHv4X7ycBFR.nunit.xml --noheader --where cat==smoke
Can someone please provide insights to resolve this issue?