인터넷 익스플로러와 Safari를 테스트하기 위해 소스 및 각도기를 사용하여
-
26-12-2019 - |
문제
Firefox와 Chrome을 사용하여 로컬 및 소스 (적어도 대부분의 시간)를 로컬로 실행할 때 괜찮아지는 다음 테스트가 있습니다.
ptor = protractor.getInstance();
baseUrl = protractor.getInstance().params.sBaseUrl;
aRequiredTextFieldsKeys = [
'sFirstName',
'sLastName',
'sStreet',
'sZip',
'sCity'
];
describe('form', function ()
{
var sFormUrl = baseUrl + '#/form';
beforeEach(function ()
{
ptor.get(sFormUrl);
});
describe('wholeForm', function ()
{
it('fully filled form => required fields have correct class && submit leads to other route', function ()
{
function checkRequiredClass(el)
{
expect(el.getAttribute('class')).toContain('ng-valid-required');
}
// requried text-fields
for (var i = 0; i < aRequiredTextFieldsKeys.length; i++) {
var el = element(by.model('oFormData.' + aRequiredTextFieldsKeys[i]));
el.sendKeys('a');
checkRequiredClass(el);
}
// email
var elEmail = element(by.model('oFormData.sEmail'));
elEmail.sendKeys('jo@jo.de');
checkRequiredClass(el);
// birthday
var elBirthday = element(by.model('oFormData.oBirthday'));
elBirthday.sendKeys('1.1.1995');
checkRequiredClass(el);
// checkboxes
var elCheck1 = element(by.model('oFormData.bAgb'));
elCheck1.click();
checkRequiredClass(elCheck1);
var elCheck2 = element(by.model('oFormData.bPrivatePolicy'));
elCheck2.click();
checkRequiredClass(elCheck2);
// hack upload bon
ptor.executeScript(function ()
{
var scope = $('#application-form-id').scope();
scope.oFormData.bBonUploaded = true;
});
// submit form
element(by.className('btn-submit')).click();
ptor.getCurrentUrl()
.then(function (url)
{
expect(url).toNotBe(sFormUrl);
});
});
});
.
그러나 Internet Explorer 또는 Safari를 실행하면 수동으로 테스트 할 때 페이지가 잘 작동하는 동안 모든 종류의 오류가 발생합니다. IE의 경우 :
메시지 : UnkownError : JavaScript 오류 (경고 : 서버가 스택트레이스 정보를 제공하지 않음) 명령 기간 또는 시간 초과 : 97 밀리 초가 빌드 정보 : 버전 : '2.30.0', 개정 : 'DC1EF9C', 시간 : '2013-02-19 00:15:27'시스템 정보 : OS.Name : 'Windows Server 2008 R2', os.arch : 'x86', os.version : '6.1', java.version : '1.6.0_35'세션 ID : 42B30348-8598-4EDB-923E-A7019CHED6EB0 드라이버 정보 : org.openqa.selenium.ie.InterNetExplorDriver 기능 [{Platform= Windows, elementsCrollBehavior= 0, javaScriptEnabled= true, enablepersistrethover= true, ignorezoomsetting= false, browsername= Internet Explorer, enableElelementCacheCleanup= true, unexpectedalertbehaviour= compiss, version= 10, cssselectorsenabled= true, ignoreprotectedmodesettings= false, requireWindowFocus= false, allowAsynchronousJavascript= false, handlesalerts= true, initialbrowserurl=, nativeEvents= true, takesscreenshot= true}]
오류 : PROTRACTOR가 페이지와 동기화 할 때까지 오류가 발생했습니다 : { "스택": "TypeError : 익명 함수에서 정의되지 않은 또는 널 참조 \ N의 'GET'속성을 얻을 수 없습니다 (알 수 없음 스크립트 코드 : 25 : 5) \ N 익명 함수 (알 수없는 스크립트 코드 : 21 : 14) \n익명 기능 (알 수없는 스크립트 코드 : 21 : 2) ","설명 ":"정의되지 않은 '가져 오기'를 얻을 수 없습니다. 또는 null 참조 ","번호 ": - 2146823281}
및 사파리 용 :
UnkownError : 페이지 언로드 이벤트를 감지했습니다. 스크립트 실행은 페이지로드에서 작동하지 않습니다. (경고 : 서버가 스택 트레이스 정보를 제공하지 않았습니다) 명령 기간 또는 시간 초과 : 384 밀리 초 빌드 정보 : 버전 : '2.33.0', 개정 : '4E90C97', 시간 : '2013-05-22 15:32:38' 시스템 정보 : OS.Name : 'Windows Server 2008 R2', OS.Arch : 'x86', OS.Version : '6.1', java.version : '1.6.0_35' 세션 ID : null. 드라이버 정보 : org.openqa.selenium.safari.safaridriver. 기능 [{platform= Windows, javaScriptEnabled= true, cssselectorsenabled= true, securessl= true, browname= safari, takesscreenshot= true, version= 5.1.7}]
이유에 대해 나쁘게 생각합니다. 나는 동일한 결과로 더 간단한 테스트를 시도했고, 로컬 및 원격 URL을 시도했으며, waitForAngular
, wait
및 ptor ignoreAsynch = true
와 같은 모든 종류의 지연을 시도했습니다. 그들 중 누구도 원하는 결과로 이어지지 않습니다. 어떤 제안?
내 protractor 구성 파일 :
// A reference configuration file.
exports.config = {
seleniumServerJar: null,
seleniumPort: null,
chromeOnly: false,
// Additional command line options to pass to selenium. For example,
// if you need to change the browser timeout, use
// seleniumArgs: ['-browserTimeout=60'],
seleniumArgs: [],
sauceUser: 'saucesuer',
sauceKey: 'key',
allScriptsTimeout: 120000,
specs: [
'test/e2e/**/*.js',
],
// https://code.google.com/p/selenium/wiki/DesiredCapabilities
// https://code.google.com/p/selenium/source/browse/javascript/webdriver/capabilities.js
capabilities: {
'browserName': 'phantomjs',
'phantomjs.binary.path':'node_modules/phantomjs/bin/phantomjs'
},
// Selector for the element housing the angular app - this defaults to
// body, but is necessary if ng-app is on a descendant of <body>
rootElement: 'body',
onPrepare: function ()
{
// driver.manage().timeouts().setScriptTimeout(60000);
},
params: {
sBaseUrl: 'https://dev.com/'
},
baseUrl: 'http://localhost:8000',
framework: 'jasmine',
// ----- Options to be passed to minijasminenode -----
//
// See the full list at https://github.com/juliemr/minijasminenode
jasmineNodeOpts: {
// onComplete will be called just before the driver quits.
onComplete: null,
// If true, display spec names.
isVerbose: true,
// If true, print colors to the terminal.
showColors: true,
// If true, include stack traces in failures.
includeStackTrace: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 120000
}
};
.
은 중요하지 않은 것처럼 보이지만, 나는 그 루트 - 각도 러너를 사용하여 여러 인스턴스를 순차적으로 실행합니다.
chrome: {
options: {
args: {
browser: 'chrome',
"idle-timeout": 120
}
}
},
firefox: {
options: {
args: {
browser: 'firefox'
}
}
},
ie9: {
options: {
args: {
browser: 'internet explorer',
version: '9',
"idle-timeout": 120
}
}
},
ie10: {
options: {
args: {
browser: 'internet explorer',
version: '10'
}
}
},
safari7: {
options: {
args: {
browser: 'safari',
version: '7'
}
}
},
safari6: {
options: {
args: {
browser: 'safari',
version: '6'
}
}
},
safari5: {
options: {
args: {
browser: 'safari',
version: '5'
}
}
}
}
grunt.registerTask('e2eall', [
'protractor:ie9',
'protractor:ie10',
'protractor:safari5',
'protractor:safari6',
'protractor:safari7',
'protractor:firefox',
'protractor:chrome'
]);
. 해결책
휴고, 이것은 0.17 건조기에서 부분적으로 해결되었고 0.18에서보다 확실하게 해결 된 특정 테스트 구성의 문제입니다.이 게시 당시에 < 0.18.1 에 대한 0.18.1 0.18.1 )을 갱신하는 것이 좋습니다.
관련 변경 로그 항목 :
v0.18
(10aec0f) 수정 (PageLoad) : 대기 시간 초과
300ms는 소스 실험실에서 테스트 할 때 문제가 발생했습니다.너무 짧은 방식으로 보입니다."browser.get ()"는 항상 시간이 밖으로 나왔습니다.증가하면 우리 문제를 해결했습니다.
v0.17
(A0BD84B) FIX (PageLoad) : Protractor.get () 동안 대기를 추가하여 언로드 문제를 해결
일부 시스템은 비동기 스크립트 실행을 시작하기 전에 브라우저 언로드 이벤트가 완료 될 때까지 기다리지 않습니다.
# 406을 닫습니다.# 85를 닫습니다.
도움이되기를 바랍니다!