Skip to content

Commit

Permalink
#198 add tests for driver arguments support
Browse files Browse the repository at this point in the history
  • Loading branch information
oomelianchuk committed Sep 6, 2021
1 parent 83dd7cb commit 634c271
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
10 changes: 8 additions & 2 deletions config/browser.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
################################################################################
#
# Mandatory properties
# Mandatory properties
#
#################################################################################
#
Expand All @@ -37,7 +37,7 @@
#
################################################################################
#
# Global properties
# Global properties
#
#################################################################################
#
Expand Down Expand Up @@ -131,6 +131,12 @@ browserprofile.FF_1024x768.name = Firefox 1024x768
browserprofile.FF_1024x768.browser = firefox
browserprofile.FF_1024x768.browserResolution = 1024x768

# Small headless Firefox
browserprofile.FF_headless.name = Firefox Headless
browserprofile.FF_headless.browser = firefox
browserprofile.FF_headless.browserResolution = 1024x768
browserprofile.FF_headless.headless = true

# Local Firefox but with larger window size
browserprofile.FF_1500x1000.name = Latest local Firefox 1500x1000
browserprofile.FF_1500x1000.browser = firefox
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.xceptance.neodymium.tests;

import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import org.junit.After;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

import com.codeborne.selenide.Selenide;
import com.xceptance.neodymium.NeodymiumRunner;
import com.xceptance.neodymium.module.statement.browser.multibrowser.Browser;

@RunWith(NeodymiumRunner.class)
@Browser("Chrome_headless")
@Browser("FF_headless")
public class DriverArgumentsTest extends NeodymiumTest
{
private static String randomLogFileName = "target/" + UUID.randomUUID().toString() + ".log";

@BeforeClass
public static void createSettings()
{
Map<String, String> properties1 = new HashMap<>();
properties1.put("neodymium.webDriver.chrome.driverArguments", "--silent ; --log-path=" + randomLogFileName);
properties1.put("neodymium.webDriver.firefox.driverArguments", "--log ; fatal ; --log-path=" + randomLogFileName);
File tempConfigFile1 = new File("./config/dev-neodymium.properties");
tempFiles.add(tempConfigFile1);
writeMapToPropertiesFile(properties1, tempConfigFile1);
}

@Test
public void test()
{
Selenide.open("https://www.xceptance.com/en/");
Assert.assertTrue("No log file found", new File(randomLogFileName).exists());
}

@After
public void cleanup()
{
new File(randomLogFileName).delete();
}
}

0 comments on commit 634c271

Please sign in to comment.