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

Updated QUnit test cases and frameworks #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
=========

Sample for using karma-browserstack-launcher to run Karma tests (QUnit framework) on BrowserStack infrastructure.
One test is failing on purpose as a demo of BrowserStack catching bugs in different browsers.

### Prerequisites
Node and npm
Expand Down Expand Up @@ -32,11 +31,3 @@ You can further customize configuration in karma.conf.js. For detailed reference
Execute the following command to run the karma tests:

`npm test`

Choose a reason for hiding this comment

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

P


###Note
- IE 6 and 7 Tests on Karma version 0.13 may fail(output - browser not captured).
- Use Karmav0.12 or below and add `transports: ['websocket','jsonp-polling']` to the karma.conf.js file
- Checkout [karma issue] for more details.

[dashboard]:https://www.browserstack.com/automate

Choose a reason for hiding this comment

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

Sudo install

[karma issue]:https://github.com/karma-runner/karma/issues/983
22 changes: 12 additions & 10 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = function(config) {
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
reporters: ['progress', 'BrowserStack'],


// web server port
Expand All @@ -63,22 +63,24 @@ module.exports = function(config) {

// define browsers
customLaunchers: {
bs_firefox_mac: {
bs_chrome_windows: {
base: 'BrowserStack',
browser: 'firefox',
browser_version: '21.0',
os: 'OS X',
os_version: 'Mountain Lion'
browser: 'chrome',
browser_version: '72.0',
os: 'Windows',
os_version: '10'
},
bs_iphone5: {

bs_iphoneX: {
base: 'BrowserStack',
device: 'iPhone 5',
device: 'iPhone X',
os: 'ios',
os_version: '6.0'
real_mobile: true,
os_version: '11.0'
}
},

browsers: ['bs_firefox_mac', 'bs_iphone5'],
browsers: ['bs_chrome_windows', 'bs_iphoneX'],
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "karma-browserstack-example",
"version": "1.0.0",
"version": "2.0.0",
"description": "Sample To test Karma with BrowserStack",
"main": "karma.conf.js",
"directories": {
Expand All @@ -20,9 +20,9 @@
},
"homepage": "https://github.com/browserstack/karma-browserstack-example#readme",
"dependencies": {
"karma": "^0.13.11",
"karma-browserstack-launcher": "^0.1.5",
"karma-qunit": "^0.1.5",
"qunitjs": "^1.19.0"
"karma": "^4.0.1",
"karma-browserstack-launcher": "^1.4.0",
"karma-qunit": "^3.0.0",
"qunit": "^2.9.2"
}
}
10 changes: 6 additions & 4 deletions tests/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
test('isOdd()', function() {
ok(isOdd(1), 'One is an odd number');
ok(isOdd(3), 'Three is an odd number');
ok(isOdd(0), 'Zero is not odd number');
QUnit.test("is 1 odd", function( assert ) {
assert.ok(isOdd(1), 'One is an odd number');
});

QUnit.test("is 2 odd", function( assert ) {
assert.notOk(isOdd(2), 'two is an even number');
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
});
});