mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
fix(e2e): add index-nocache.html to run e2e tests without cache
using appcache while running e2e tests was causing the following problems: - Safari would occasionally reload the app (as a result of the appcache refresh) during the angular.validator.asychronous test, which would result in test failure and false positivy. - Firefox6 would run the tests very slowly, disabling the cache resolved the latency issues - Sometimes tests would run with stale code pulled from cache, which would result in flaky tests.
This commit is contained in:
parent
f7a5f1788a
commit
2f128c9619
4 changed files with 47 additions and 11 deletions
16
Rakefile
16
Rakefile
|
|
@ -270,6 +270,22 @@ task :package => [:clean, :compile, :docs] do
|
|||
end
|
||||
|
||||
|
||||
File.open("#{pkg_dir}/docs-#{NG_VERSION.full}/index-nocache.html", File::RDWR) do |f|
|
||||
text = f.read
|
||||
f.truncate 0
|
||||
f.rewind
|
||||
f.write text.sub('angular.min.js', "angular-#{NG_VERSION.full}.min.js")
|
||||
end
|
||||
|
||||
|
||||
File.open("#{pkg_dir}/docs-#{NG_VERSION.full}/index-jq-nocache.html", File::RDWR) do |f|
|
||||
text = f.read
|
||||
f.truncate 0
|
||||
f.rewind
|
||||
f.write text.sub('angular.min.js', "angular-#{NG_VERSION.full}.min.js")
|
||||
end
|
||||
|
||||
|
||||
File.open("#{pkg_dir}/docs-#{NG_VERSION.full}/docs-scenario.html", File::RDWR) do |f|
|
||||
text = f.read
|
||||
f.truncate 0
|
||||
|
|
|
|||
|
|
@ -43,10 +43,17 @@ function writeTheRest(writesFuture) {
|
|||
writesFuture.push(writer.copyDir('img'));
|
||||
writesFuture.push(writer.copyDir('examples'));
|
||||
writesFuture.push(writer.copyTpl('index.html'));
|
||||
writesFuture.push(writer.copy('docs/src/templates/index.html',
|
||||
'build/docs/index-jq.html',
|
||||
'<!-- jquery place holder -->',
|
||||
'<script src=\"jquery.min.js\"><\/script>'));
|
||||
|
||||
writesFuture.push(writer.copy('docs/src/templates/index.html', 'build/docs/index-jq.html',
|
||||
'<!-- jquery place holder -->', '<script src=\"jquery.min.js\"><\/script>'));
|
||||
|
||||
writesFuture.push(writer.copy('docs/src/templates/index.html', 'build/docs/index-nocache.html',
|
||||
'manifest="appcache.manifest"', ''));
|
||||
|
||||
writesFuture.push(writer.copy('docs/src/templates/index.html', 'build/docs/index-jq-nocache.html',
|
||||
'manifest="appcache.manifest"', '',
|
||||
'<!-- jquery place holder -->', '<script src=\"jquery.min.js\"><\/script>'));
|
||||
|
||||
writesFuture.push(writer.copyTpl('offline.html'));
|
||||
writesFuture.push(writer.copyTpl('docs-scenario.html'));
|
||||
writesFuture.push(writer.copyTpl('jquery.min.js'));
|
||||
|
|
|
|||
|
|
@ -549,15 +549,15 @@ Doc.prototype = {
|
|||
function scenarios(docs){
|
||||
var specs = [];
|
||||
|
||||
specs.push('describe("angular without jquery", function() {');
|
||||
appendSpecs('index.html');
|
||||
specs.push('describe("angular+jqlite", function() {');
|
||||
appendSpecs('index-nocache.html');
|
||||
specs.push('});');
|
||||
|
||||
specs.push('');
|
||||
specs.push('');
|
||||
|
||||
specs.push('describe("angular with jquery", function() {');
|
||||
appendSpecs('index-jq.html');
|
||||
specs.push('describe("angular+jquery", function() {');
|
||||
appendSpecs('index-jq-nocache.html');
|
||||
specs.push('});');
|
||||
|
||||
return specs.join('\n');
|
||||
|
|
|
|||
|
|
@ -44,12 +44,25 @@ exports.copyTpl = function(filename) {
|
|||
return exports.copy('docs/src/templates/' + filename, OUTPUT_DIR + filename);
|
||||
};
|
||||
|
||||
exports.copy = function (from, to, replacementKey, replacement) {
|
||||
exports.copy = function (from, to) {
|
||||
var args = [].slice.call(arguments);
|
||||
|
||||
args.shift(); // drop 'from'
|
||||
args.shift(); // drop 'to'
|
||||
|
||||
// Have to use rb (read binary), char 'r' is infered by library.
|
||||
return qfs.read(from,'b').then(function(content) {
|
||||
if(replacementKey && replacement) {
|
||||
content = content.toString().replace(replacementKey, replacement);
|
||||
var replacementKey,
|
||||
replacement;
|
||||
|
||||
while (args.length) {
|
||||
replacementKey = args.shift();
|
||||
replacement = args.shift();
|
||||
if(replacementKey != undefined && replacement != undefined) {
|
||||
content = content.toString().replace(replacementKey, replacement);
|
||||
}
|
||||
}
|
||||
|
||||
qfs.write(to, content);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue