저는 각도 및 e2e를 배우고 사람이 올바른 방향으로 나를 가리킬 수 있는지 찾아야합니다. 나는 npm 테스트를 실행하는 동안 오류가 발생했습니다 - 오류 TS2688 : '각도기'에 대한 유형 정의 파일을 찾을 수 없습니다
내가 뭔가 package.json 잘못하지만 확실하지 않은 것으로 판단됩니다 ... http://www.webdriverjs.com/protractor-example-with-typescript/모든 것을 발견이 튜토리얼을 통해 다음 config.js와 함께 큰 일을하지만 난 타이프 스크립트 실행에 문제가 가지고 시작한 일 . 물건을 읽는 것에서, 버전과 물건과 같은 package.json 파일을 구성하는 여러 가지 방법이 있습니다 ... 그러나 나는 각도기를 처음 사용하고 일부가 devdependencies를 가지고있는 이유를 알아낼 수 없으며 일부는 등등하지 않습니다.
\ 사용자 :C:\Users\username\Desktop\ProtractorAutomation>npm test
[email protected]이 C를 모의고사 NPM 테스트 -
이 어떤 도움을 크게
여기실행할 때 내가 점점 오전 오류입니다 감사합니다 \ 사용자 이름 \ 바탕 화면 \ ProtractorAutomation의 NPM 실행 TSC
[email protected] TSC C : \ 사용자 \ 사용자 이름 \ 바탕 화면 \ ProtractorAutomation TSC
오류 TS2688 '각도기'에 대한 유형 정의 파일을 찾을 수 없습니다.
npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C : \ Program Files \ nodejs \ node.exe" "C : \ Program Files \ nodejs \ node_modules \ npm \ bin \ npm-cli.js" "run" "tsc"npm ERR! 노드 v6.11.4 npm ERR! npm v3.10.10 npm ERR! ELIFECYCLE npm ERR 코드를 작성하십시오. [email protected] tsc :
tsc
npm ERR! 종료 상태 2 npm ERR! npm ERR! [email protected] tsc 스크립트 'tsc'에서 실패했습니다. npm ERR! 최신 버전의 node.js와 npm 이 설치되어 있는지 확인하십시오. npm ERR! 그렇게한다면 각도 진단 패키지 npm ERR의 문제 일 가능성이 큽니다. npm 자체가 아닙니다. npm ERR! 작성자에게 시스템에서이 작업이 실패했음을 알립니다. npm ERR! tsc npm ERR! 이 프로젝트의 문제점을 열 수있는 방법에 대한 정보는 : npm ERR! npm bugs protractorautomation npm ERR! 또는 을 사용할 수없는 경우 다음을 통해 정보를 얻을 수 있습니다. npm ERR! npm 소유자 ls 길 안내 알림 npm ERR! 위의 추가 로깅 출력이있을 수 있습니다.npm ERR! 지원 요청과 함께 다음 파일을 포함하십시오. npm ERR!
C : \ Users \ username \ Desktop \ ProtractorAutomation \ npm-debug.log npm ERR! 검사가 실패했습니다. 자세한 내용은 위를 참조하십시오.
내 폴더 구조
:폴더 "ProtractorAutomation는"이 폴더로 구성되어/파일
- 폴더 ConvertedJSFiles
- 폴더
- 폴더 사양
그리고 파일을 node_modules :
- config.ts
- config.js
- NPM-디버그
- package.json
- tsconfig.json
내가 디버그 시도하고 추가 몇 가지 명령을 실행 많은 모듈을 node_modules 디렉토리
다음은 k 어이 파일
package.json
{
"name": "protractorautomation",
"version": "1.0.0",
"description": "Protractor Typescript automation framework",
"main": "config.js",
"dependencies": {
"protractor": "^5.1.2"
},
"devDependencies": {
"@types/jasminewd2": "^2.2.0",
"ts-node": "^3.0.2"},
"scripts": {
"pretest": "npm run tsc",
"test": "protractor ConvertedJSFiles/config.js",
"tsc": "tsc"
},
"keywords": [
"Protractor",
"Typescript"
],
"author": "",
"license": "ISC"
}
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": false,
"declaration": false,
"removeComments": false,
"noImplicitAny": false,
"outDir": "ConvertedJSFiles",
"types": ["jasmine", "node", "protractor"]
},
"exclude": [
"node_modules"
]
}
,515,
config.ts = 내부 사양 폴더
import { ProtractorBrowser, Config } from 'protractor';
export let config: Config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
//'browserName':'firefox'
},
framework: 'jasmine',
specs: ['./specs/**/*.js'],
jasmineNodeOpts: {
defaultTimeoutInterval: 90000
},
onPrepare:() => {
let globals = require('protractor');
let browser = globals.browser;
browser.manage().window().maximize();
browser.manage().timeouts().implicitlyWait(5000);
}
}
config.js = 내부 사양 폴더
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
// 'browserName': 'firefox'
},
framework: 'jasmine',
specs: ['./specs/FirstSpec.js'],
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
FirstSpec.ts = 내부 사양 폴더
import { ElementFinder, browser, by, element } from 'protractor';
describe('angularjs homepage todo list', function() { //Suite in
Jasmine
it('should add a todo', function() { // Test in Jasmine
browser.get('https://angularjs.org'); // Entering application url in
browser
// Enter text under TODO
element(by.model('todoList.todoText')).sendKeys('write first
protractor test');
element(by.css('[value="add"]')).click(); // Clicks on 'Add' button
// Getting all Todo lists displayed
element.all(by.repeater('todo in')).then(function (todoList) {
// Asserting the TODO's count as 3
expect(todoList.length.toString()).toEqual('3');
todoList[2].getText().then(function (text) {
//Verifying newly entered TODO is added
expect(text).toEqual('write first protractor test');
});
});
});
});
FirstSpec.js = 내부 사양 폴더 363,210은 - 난 그냥 config.js
//Suite in Jasmine
describe('angularjs homepage todo list', function() {
// Test in Jasmine
it('should add a todo', function() {
// Entering application url in browser
browser.get('https://angularjs.org');
// Enter text under TODO input field
//in the html code this element is :
//<input type="text" ng-model="todoList.todoText" size="30"
// placeholder="add new todo here" class="ng-pristine ng-valid ng-empty
ng-touched">
element(by.model('todoList.todoText')).sendKeys('write first
protractor test');
// Clicks on 'Add' button
// line in code where button is
//<input class="btn-primary" type="submit" value="add"> WHY
BY.CSS???
element(by.css('[value="add"]')).click();
// Getting all Todo lists displayed
var todoList = element.all(by.repeater('todo in todoList.todos'));
// Asserting the TODO's count as 3
expect(todoList.count()).toEqual(3);
//Verifying newly entered TODO is added
expect(todoList.get(2).getText()).toEqual('write first protractor
test');
});
});
설정을 실행할 때입니다.JS = 내부 ConvertedJSFiles
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
//'browserName':'firefox'
},
framework: 'jasmine',
specs: ['./specs/**/*.js'],
jasmineNodeOpts: {
defaultTimeoutInterval: 90000
},
onPrepare: function() {
var globals = require('protractor');
var browser = globals.browser;
browser.manage().window().maximize();
browser.manage().timeouts().implicitlyWait(5000);
}
};
는
FirstSpec.js = 내부 ConvertedJSFiles/사양
여기"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var protractor_1 = require("protractor");
describe('angularjs homepage todo list', function() {
it('should add a todo', function() {
protractor_1.browser.get('https://angularjs.org'); // Entering application url in browser
// Enter text under TODO
protractor_1.element(protractor_1.by.model('todoList.todoText')).sendKeys('write first protractor test');
protractor_1.element(protractor_1.by.css('[value="add"]')).click(); // Clicks on 'Add' button
// Getting all Todo lists displayed
protractor_1.element.all(protractor_1.by.repeater('todo in')).then(function (todoList) {
// Asserting the TODO's count as 3
expect(todoList.length.toString()).toEqual('3');
todoList[2].getText().then(function (text) {
//Verifying newly entered TODO is added
expect(text).toEqual('write first protractor test');
});
});
});
});
노드 -v v6.11.4 버전이다
NPM -v 난/업데이트 typings를 설치하는 몇 가지 명령을 실행하고 node_modules 내부에 폴더를 많이 가지고 3.10.10
각도기 --version 버전 5.1.2
....
감사 DH
업데이트 NPM은 감사를 설치 실행 한 후, 나는 그것을 시도,하지만 여전히 오류가 발생합니다. .. 여기 C의 디렉토리에있는 파일입니다 : \ 사용자 \ 사용자 이름 \ 바탕 화면 \ ProtractorAutomation
10/23/2017 09:58 AM <DIR> .
10/23/2017 09:58 AM <DIR> ..
10/22/2017 08:23 PM 288 config.js
10/22/2017 08:23 PM 547 config.ts
10/22/2017 07:17 PM <DIR> ConvertedJSFiles
10/22/2017 11:01 PM <DIR> node_modules
10/23/2017 09:54 AM 5,706 notes_files-questions.txt
10/23/2017 12:22 AM 517 package.json
10/22/2017 07:31 PM <DIR> specs
10/22/2017 11:03 PM 353 tsconfig.json
5 File(s) 7,411 bytes
5 Dir(s) 358,075,498,496 bytes free
C:\Users\username\Desktop\ProtractorAutomation>npm install
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.11.4
npm ERR! npm v3.10.10
npm ERR! code ETARGET
npm ERR! notarget No compatible version found: @types/[email protected]^2.2.0
npm ERR! notarget Valid install targets:
npm ERR! notarget 2.0.3, 2.0.2, 2.0.1, 2.0.0
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'protractorautomation'
npm ERR! notarget
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\username\Desktop\ProtractorAutomation\npm-debug.log
C : \ 사용자 \ 사용자 이름 \ 데스크탑 \ ProtractorAutomation> NPM 나는이 문제를 해결할 수 있었다
먼저 e2e 스크립트를 실행하려면 각도기를 설치해야합니다. 'package.json' 파일이있는 디렉토리에서'npm install'을 실행하십시오. –
고마워, 해봤지만 여전히 오류가있다. – user8816197