-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feat(config): Add configuration for javascript version. #1939
Closed
Moumi
wants to merge
8
commits into
karma-runner:master
from
delftswa2016:feature-javascript-version-tag-firefox
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f759c43
feat(preprocessors): if a file matches multiple preprocessor patterns…
sjelin 91f1b31
docs: Including reference to Windows port of nvm
aaronpowell cc79311
feat(config): Add configuration for javascript version.
Moumi 78320db
feat(config): Add configuration for adding a javascript version.
Moumi 68a773c
feat(preprocessors): if a file matches multiple preprocessor patterns…
sjelin 76e9ee3
docs: Including reference to Windows port of nvm
aaronpowell 7e8666a
The javascript version tag would only be applied to the Firefox browser.
Moumi 8a7217b
Merge branch 'feature-javascript-version-tag-firefox' of https://gith…
Moumi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-disable no-unused-vars */ | ||
var isFirefox = function () { | ||
return typeof InstallTrigger !== 'undefined' | ||
} | ||
|
||
var containsJsTag = function () { | ||
var scripts = document.getElementsByTagName('script') | ||
for (var i = 0; i < scripts.length; i++) { | ||
if (scripts[i].type.indexOf(';version=') > -1) { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* globals containsJsTag, isFirefox */ | ||
describe('JavaScript version tag', function () { | ||
it('should add the version tag, if Firefox is used', function () { | ||
expect(containsJsTag()).toBe(isFirefox()) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Feature: JavaScript Tag | ||
In order to use Karma | ||
As a person who wants to write great tests | ||
I want to be able to run tests from the command line. | ||
|
||
Scenario: Execute a test in Firefox with version, with JavaScript tag | ||
Given a configuration with: | ||
""" | ||
files = ['tag/tag.js', 'tag/test.js']; | ||
browsers = ['Firefox'] | ||
jsVersion = 1.8 | ||
plugins = [ | ||
'karma-jasmine', | ||
'karma-firefox-launcher' | ||
] | ||
""" | ||
When I start Karma | ||
Then it passes with: | ||
""" | ||
. | ||
Firefox | ||
""" | ||
|
||
Scenario: Execute a test in Chrome with version, without JavaScript tag | ||
Given a configuration with: | ||
""" | ||
files = ['tag/tag.js', 'tag/test.js']; | ||
browsers = ['Chrome']; | ||
jsVersion = 1.8; | ||
plugins = [ | ||
'karma-jasmine', | ||
'karma-chrome-launcher' | ||
]; | ||
""" | ||
When I start Karma | ||
Then it passes with: | ||
""" | ||
. | ||
Chrome | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test will not actually check that the version tag is available, you should add another file that actually checks the html for the version tag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would I be able to check the HTML? I am not familiar with e2e tests.
I probably need to change the core_steps.js file to add a
contains
or something. However, could you help with the way to get that dynamic HTML? The HTML is changed by means of JavaScript, so how would I do this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can create a new file similar to what is in
basic/test.js
, e.g.basic/version.js
and include it in the files here. That means that file will be run in the browser. Now in that file you can put some js in that reads the current html and checks for the version tag to be present, and fails if it's not present.