我已经研究了很多并使用了各种论坛中提到的许多可能的解决方案,但没有一个对我有用。我正在尝试在 CI/CD 管道中运行它,尽管能够在本地运行量角器测试用例并能够启动浏览器,但在 CI/CD 管道构建中它失败了下面是量角器 2.5.4 E 出现问题的详细信息/launcher - 会话未创建:此版本的 ChromeDriver 仅支持 Chrome 版本 79
我在 package.json 中的脚本下使用以下 postinstall
"postinstall": "npm uninstall -g webdriver-manager protractor && npm install -g webdriver-manager protractor && webdriver-manager update && cd ./node_modules/protractor && npm i webdriver-manager@latest",
"postinstall": "cd ./node_modules/protractor && npm i webdriver-manager@latest",
Run Code Online (Sandbox Code Playgroud)
对于上面的脚本命令,抛出以下错误 I/file_manager - 创建文件夹 D:\a\1\s\node_modules\protractor\node_modules\webdriver-manager\selenium I/config_source - curl -oD:\a\1\s\ node_modules\protractor\node_modules\webdriver-manager\selenium\chrome-response.xml https://chromedriver.storage.googleapis.com/ I/downloader - curl -oD:\a\1\s\node_modules\protractor\node_modules\ webdriver-manager\selenium/chromedriver_79.0.3945.36.zip https://chromedriver.storage.googleapis.com/79.0.3945.16/chromedriver_win32.zip I/update - chromedriver:解压 chromedriver_79.0.3945.36.zip I/launcher - 运行 1 个 WebDriver 实例 I/direct - 直接使用 ChromeDriver... …
我有必须期待的规范,它仍然说没有期望......
it('should click on yes button of technician and check save&continue functionality', () => {
const saveAndContinue = fixture.debugElement.query(By.css(saveContinueBtn)).nativeElement;
saveAndContinue.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
const spy = spyOn(component,'isSaveAndContinueClicked').and.callThrough();
expect(component).toBeDefined();
expect(spy);
component.isSaveAndContinueClicked();
expect(component.isSaveAndContinueClicked).toHaveBeenCalled();
const yesbutton = fixture.debugElement.query(By.css('#yesButton')).nativeElement;
expect(yesbutton).toBeTruthy();
fixture.detectChanges();
fixture.whenStable().then(() => {
spyOn(component, 'change').and.callThrough();
spyOn(component, 'change2').and.callThrough();
yesbutton.click();
expect(component.change).toHaveBeenCalled();
expect(component.change2).toHaveBeenCalled();
});
});
});
Run Code Online (Sandbox Code Playgroud)
它抛出错误,因为规范 testComponent 应该点击技术人员的“是”按钮并检查保存和继续功能没有期望......你能建议......