Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebFixture can now read external browserSetup files #83

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kbayraktar
Copy link
Member

No description provided.

// First try to resolve the file through environment variable
result = getResourceOverEnvironmentVariable(browserSetupFilePath);
if (StringUtils.isNotBlank(result)) {
logger.debug("Browser capabilities read from file : {}", browserSetupFilePath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be trace

result = CharStreams.toString(new InputStreamReader(inputStream, StandardCharsets.UTF_8));

} catch (IOException e) {
logger.info("The file with the name {} can not be read in the resource folder."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trace and then (re)throw the exception. the caller should then wrap this in a fixture exception

// throw new FixtureException("file could not be found in resource folder",
// FixtureException.keyValues("fileName", fileName));
} catch (NullPointerException e) {
logger.error("The file with the name {} can not be found in the resource folder.", fileName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trace and then (re)throw the exception. the caller should then wrap this in a fixture exception

/**
* For reading content of a JSON-File where the path is defined through the environment variable
* <code>TEST_EDITOR_BROWSER_SETUP_PATH</code>.<br>
* Usage under Linux : Set TEST_EDITOR_BROWSER_SETUP_PATH=~/your_prefered_folder/fileName.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no set, rather export

if (StringUtils.isNotBlank(path)) {
fileContent = FileUtils.readFileToString(new File(path), StandardCharsets.UTF_8);
} else {
logger.debug("Can not find environment variable '{}' with path entry for browser "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trace

@@ -61,6 +80,53 @@ public void readCapabilitySuccesful() throws Exception {
logger.debug(" ######## End of Test readCapabilitySuccesful ########");

}

private void getBrowserSetupFile() throws FixtureException, IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split test in two parts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants