fix ie e2e bugs

stable
Juanfran 2015-10-08 15:10:41 +02:00
parent 6ceacb9e25
commit f17c8bc7d4
9 changed files with 141 additions and 14 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@ tmp/
app/config/main.coffee
app/plugins/taiga-front-extras
scss-lint.log
e2e/screenshots/

View File

@ -197,6 +197,7 @@ AttachmentsDirective = ($config, $confirm, $templates, $translate) ->
$el.on "change", ".attachments-header input", (event) ->
files = _.toArray(event.target.files)
return if files.length < 1
$scope.$apply ->
@ -336,4 +337,4 @@ AttachmentDirective = ($template, $compile, $translate, $rootScope) ->
restrict: "AE"
}
module.directive("tgAttachment", ["$tgTemplate", "$compile", "$translate", "$rootScope", AttachmentDirective])
module.directive("tgAttachment", ["$tgTemplate", "$compile", "$translate", "$rootScope", AttachmentDirective])

View File

@ -10,7 +10,13 @@ exports.config = {
framework: 'mocha',
params: {
glob: {
host: 'http://localhost:9001/'
host: 'http://localhost:9001/',
attachments: {
unix: './upload-file-test.txt',
windows: 'C:\\test\\upload-file-test.txt',
unixImg: './upload-image-test.png',
windowsImg: 'C:\\test\\upload-image-test.png'
}
}
},
mochaOpts: {
@ -18,7 +24,8 @@ exports.config = {
compilers: 'js:babel/register'
},
// capabilities: {
// 'browserName': 'firefox'
// browserName: 'internet explorer',
// version: '11'
// },
suites: {
auth: "e2e/auth/*.e2e.js",
@ -37,6 +44,8 @@ exports.config = {
team: "e2e/full/team.e2e.js"
},
onPrepare: function() {
require('./e2e/capabilities.js');
browser.driver.manage().window().maximize();
browser.getCapabilities().then(function (cap) {

102
e2e/capabilities.js Normal file
View File

@ -0,0 +1,102 @@
////////////////////////////////////////////////
// Protractor Browser Capabilities Extensions //
////////////////////////////////////////////////
"use strict";
module.exports = browser.getCapabilities().then(function(s) {
var browserName, browserVersion;
var shortName, shortVersion;
var ie, ff, ch, sa;
var platform;
platform = s.caps_.platform;
browserName = s.caps_.browserName;
browserVersion = s.caps_.version;
shortVersion = browserVersion.split('.')[0];
ie = /i.*explore/.test(browserName);
ff = /firefox/.test(browserName);
ch = /chrome/.test(browserName);
sa = /safari/.test(browserName);
if (ie) {
shortName = 'ie';
} else if (ff) {
shortName = 'ff';
} else if (ch) {
shortName = 'ch';
} else if (sa) {
shortName = 'sa';
} else {
throw new Exception('Unsupported browser: '+ browserName);
};
// Returns one of these: ['ch', 'ff', 'sa', 'ie']
browser.getShortBrowserName = function() {
return shortName;
};
// Returns one of these: ['ch33', 'ff27', 'sa7', 'ie11', 'ie10', 'ie9']
browser.getShortNameVersionAll = function() {
return shortName + shortVersion;
};
// Returns one of these: ['ch', 'ff', 'sa', 'ie11', 'ie10', 'ie9']
browser.getShortNameVersion = function() {
if (ie) {
return shortName + shortVersion;
} else {
return shortName;
};
};
// Return if current browser is IE, optionally specifying if it is a particular IE version
browser.isInternetExplorer = function(ver) {
if (ver == null) {
return ie;
} else {
return ie && ver.toString() === shortVersion;
}
};
// Function alias
browser.isIE = browser.isInternetExplorer;
browser.isSafari = function() {
return sa;
};
browser.isFirefox = function() {
return ff;
};
// Return if current browser is Chrome, optionally specifying if it is a particular Chrome version
browser.isChrome = function(ver) {
if (ver == null) {
return ch;
} else {
return ch && ver.toString() === shortVersion;
}
};
browser.inWindows = function() {
return /^WIN|XP/.test(platform);
};
browser.inOSX = function() {
return /^MAC/.test(platform);
};
// Save current webdriver session id for later use
browser.webdriverRemoteSessionId = s.caps_['webdriver.remote.sessionid'];
browser.inSauceLabs = function() {
return !!(browser.params.inSauceLabs);
};
browser.inBrowserStack = function() {
return !!(browser.params.inBrowserStack);
};
browser.inTheCloud = function() {
return !!(browser.params.inSauceLabs || browser.params.inBrowserStack);
};
});

View File

@ -322,7 +322,7 @@ describe('backlog', function() {
expect(ussSprintCount).to.be.equal(initUssSprintCount + 1);
});
it('select us with SHIFT', async function() {
utils.common.browserSkip('internet explorer', 'select us with SHIFT', async function() {
let dragableElements = backlogHelper.userStories();
let firstInput = dragableElements.get(0).$('input[type="checkbox"]');

View File

@ -48,8 +48,9 @@ describe('edit user profile', function() {
let imageContainer = $('.image-container');
let htmlChanges = await utils.common.outerHtmlChanges(imageContainer);
var fileToUpload = utils.common.uploadImagePath();
await utils.common.uploadFile(inputFile, './upload-image-test.png');
await utils.common.uploadFile(inputFile, fileToUpload);
await htmlChanges();

View File

@ -36,8 +36,7 @@ common.browserSkip = function(browserName, name, fn) {
if (browser.browserName !== browserName) {
return it.call(this, name, fn);
} else {
// return it.skip.call(this, name, fn);
return it.call(this, name, fn);
return it.skip.call(this, name, fn);
}
};
@ -317,11 +316,9 @@ common.uploadFile = async function(inputFile, filePath) {
$(arguments[0]).removeClass('hidden');
};
let absolutePath = path.resolve(process.cwd(), 'e2e', filePath);
await browser.executeScript(toggleInput, inputFile.getWebElement());
await inputFile.sendKeys(absolutePath);
await inputFile.sendKeys(filePath);
await browser.executeScript(toggleInput, inputFile.getWebElement());
};
@ -362,3 +359,19 @@ common.goToFirstTask = async function() {
await common.waitLoader();
}
common.uploadFilePath = function() {
if (browser.inWindows()) {
return browser.params.glob.attachments.windows;
} else {
return path.resolve(process.cwd(), 'e2e', browser.params.glob.attachments.unix);
}
};
common.uploadImagePath = function() {
if (browser.inWindows()) {
return browser.params.glob.attachments.windowsImg;
} else {
return path.resolve(process.cwd(), 'e2e', browser.params.glob.attachments.unixImg);
}
};

View File

@ -141,9 +141,9 @@ helper.attachmentTesting = async function() {
// Uploading attachment
let attachmentsLength = await attachmentHelper.countAttachments();
var fileToUpload = './upload-file-test.txt',
absolutePath = path.resolve(process.cwd(), 'e2e', fileToUpload);
await attachmentHelper.upload(absolutePath, 'This is the testing name ' + date);
var fileToUpload = commonUtil.uploadFilePath();
await attachmentHelper.upload(fileToUpload, 'This is the testing name ' + date);
// Check set name
let name = await attachmentHelper.getLastAttachmentName();

View File

@ -8,7 +8,7 @@ var actions = {
let project = $$('div[tg-dropdown-project-list] li a').get(index);
common.link(project);
project.click();
common.waitLoader();
},