uaTest Using-a-Chrome-executable-in-a-non-standard-location
This commit is contained in:
		
							parent
							
								
									b885b7f9d0
								
							
						
					
					
						commit
						d842c857fc
					
				@ -38,6 +38,10 @@ As result, in REPOSITORY column, next images should be present:
 | 
			
		||||
 | 
			
		||||
        mvn clean install -DblackBoxTests.skip=false -Dsuite=uiTests 
 | 
			
		||||
 | 
			
		||||
  Optionally you can specify a custom Chrome binary location that might be useful for your CI/CD tool 
 | 
			
		||||
 | 
			
		||||
        mvn clean install -DblackBoxTests.skip=false -Dsuite=uiTests -DchromeBinary=/tmp/google-chrome/opt/google/chrome/chrome
 | 
			
		||||
 | 
			
		||||
- To run all tests in the [msa/black-box-tests](../black-box-tests) directory specifying suite name:
 | 
			
		||||
 | 
			
		||||
        mvn clean install -DblackBoxTests.skip=false -Dsuite=all 
 | 
			
		||||
 | 
			
		||||
@ -35,6 +35,7 @@ import org.testng.annotations.BeforeMethod;
 | 
			
		||||
import org.testng.annotations.BeforeSuite;
 | 
			
		||||
import org.testng.annotations.Listeners;
 | 
			
		||||
import org.thingsboard.server.common.data.Customer;
 | 
			
		||||
import org.thingsboard.server.common.data.StringUtils;
 | 
			
		||||
import org.thingsboard.server.common.data.page.PageLink;
 | 
			
		||||
import org.thingsboard.server.common.data.rule.RuleChain;
 | 
			
		||||
import org.thingsboard.server.msa.AbstractContainerTest;
 | 
			
		||||
@ -63,18 +64,21 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
 | 
			
		||||
    @BeforeMethod
 | 
			
		||||
    public void openBrowser() {
 | 
			
		||||
        log.info("*----------------------* Setup driver *----------------------*");
 | 
			
		||||
        if (HEADLESS == true) {
 | 
			
		||||
            ChromeOptions options = new ChromeOptions();
 | 
			
		||||
            options.addArguments("--ignore-certificate-errors");
 | 
			
		||||
        ChromeOptions options = new ChromeOptions();
 | 
			
		||||
        options.addArguments("--ignore-certificate-errors");
 | 
			
		||||
        if (HEADLESS) {
 | 
			
		||||
            options.addArguments("--no-sandbox");
 | 
			
		||||
            options.addArguments("--disable-dev-shm-usage");
 | 
			
		||||
            options.addArguments("--headless");
 | 
			
		||||
            driver = new ChromeDriver(options);
 | 
			
		||||
        } else {
 | 
			
		||||
            ChromeOptions options = new ChromeOptions();
 | 
			
		||||
            options.addArguments("--ignore-certificate-errors");
 | 
			
		||||
            driver = new ChromeDriver(options);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // https://sites.google.com/a/chromium.org/chromedriver/capabilities#TOC-Using-a-Chrome-executable-in-a-non-standard-location
 | 
			
		||||
        var chromeBinary = System.getProperty("chromeBinary");
 | 
			
		||||
        if (StringUtils.isNotBlank(chromeBinary)) {
 | 
			
		||||
            options.setBinary(chromeBinary);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        driver = new ChromeDriver(options);
 | 
			
		||||
        driver.manage().window().setSize(dimension);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user