This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding debugging tests showing different types of timeouts, and fixing
a bug where scheduled tasks from a previous it block would run into the next in case of a timeout.
- Loading branch information
Showing
6 changed files
with
120 additions
and
10 deletions.
There are no files selected for viewing
File renamed without changes.
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,26 @@ | ||
// Examples of tests to show how timeouts works with Protractor. Tests | ||
// should be run against the testapp. | ||
|
||
exports.config = { | ||
seleniumAddress: 'http://localhost:4444/wd/hub', | ||
|
||
// Spec patterns are relative to the current working directly when | ||
// protractor is called. | ||
specs: [ | ||
'debugging/timeout_spec.js', | ||
], | ||
|
||
capabilities: { | ||
'browserName': 'chrome' | ||
}, | ||
|
||
baseUrl: 'http://localhost:8000', | ||
|
||
// ----- Options to be passed to minijasminenode. | ||
jasmineNodeOpts: { | ||
onComplete: null, | ||
isVerbose: false, | ||
showColors: true, | ||
includeStackTrace: true | ||
} | ||
}; |
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,40 @@ | ||
describe('timeout possibilities', function() { | ||
ptor = protractor.getInstance(); | ||
jasmine.getEnv().defaultTimeoutInterval = 33; | ||
|
||
|
||
it('shoud pass - first test should not timeout', function() { | ||
expect(true).toEqual(true); | ||
}); | ||
|
||
it('should timeout due to webdriver script timeout', function() { | ||
ptor.driver.manage().timeouts().setScriptTimeout(55); | ||
|
||
ptor.get('app/index.html#/form'); | ||
|
||
ptor.driver.executeAsyncScript(function() { | ||
var callback = arguments[arguments.length - 1]; | ||
setTimeout(callback, 500); | ||
}); | ||
|
||
expect(ptor.findElement(protractor.By.binding('greeting')).getText()). | ||
toEqual('Hiya'); | ||
}, 5000); // The 5000 here sets the Jasmine spec timeout. | ||
|
||
it('should fail normally', function() { | ||
expect(false).toEqual(true); | ||
}); | ||
|
||
it('should pass - tests in the middle should be unaffected', function() { | ||
expect(true).toEqual(true); | ||
}); | ||
|
||
it('should timeout due to Jasmine spec timeout', function() { | ||
ptor.driver.sleep(1000); | ||
expect(true).toBe(true); | ||
}); | ||
|
||
it('should pass - previous timeouts should not affect this', function() { | ||
expect(true).toEqual(true); | ||
}); | ||
}); |
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