Angularjs 交互式测试量角器

Angularjs 交互式测试量角器,angularjs,protractor,Angularjs,Protractor,我试图以交互方式运行量角器来测试elments 我通过以下方式启动selenium服务器: wedriver-manager start 然后我转到量角器根目录 C:\Users\Name\AppData\Roaming\npm\node_modules\protractor 然后键入以下命令 "./bin/elementexplorer.js" http://some_server/someApp 我发现以下错误 Script Line : 1 Char : 1 Error : Inva

我试图以交互方式运行量角器来测试elments

我通过以下方式启动selenium服务器:

wedriver-manager start
然后我转到量角器根目录

C:\Users\Name\AppData\Roaming\npm\node_modules\protractor
然后键入以下命令

"./bin/elementexplorer.js" http://some_server/someApp
我发现以下错误

Script
Line : 1
Char : 1
Error : Invalid Character
Code : 800A03F6
Source : MS JScript compliation error
在elementexplorer.js的第行是下面一行

#!/usr/bin/env node

尝试保留路径的引号

尝试保留路径的引号

我也有这个问题。输入量角器根目录后,请尝试输入命令

node bin\elementexplorer.js http://some_server/someApp

确保node命令位于PATH环境变量中,以便将其识别为有效命令。#/usr/bin/env节点通常是在基于Unix的系统上看到的,因此在这种情况下,您需要将“node”放在前面,告诉Windows使用node.js。

我也遇到了这个问题。输入量角器根目录后,请尝试输入命令

node bin\elementexplorer.js http://some_server/someApp
确保node命令位于PATH环境变量中,以便将其识别为有效命令。#/usr/bin/env node通常是在基于Unix的系统上看到的,因此在这种情况下,您需要将“node”放在前面,告诉Windows使用node.js。

节点10+具有repl wait(因此您可以在控制台中等待)

特殊交互式调试规范-interactive.e2e.ts

import { LoginPage } from './src/pages/login.po';
import { AppPage } from './src/pages/app.po';
import { SwitchProfileSideSheet } from './src/side-sheets/switch-profile-side-sheet.po';
import { sel } from '../src/testing/get-component';

const login = new LoginPage();
const app = new AppPage();
const switchProfileSideSheet = new SwitchProfileSideSheet();

// add my own page objects to the global object so I can use them interactively.
global['sel'] = sel;
global['po'] = {
  login,
  app,
  switchProfileSideSheet,
};

(global as any).systemTestsDone = new Promise(function(_resolve, _reject) {
  global['finishInteractiveDebug'] = _resolve;
});

describe('TestHelper', () => {
  it('should provide a way to interactively run tests', async () => {
    await (global as any).systemTestsDone;
  });
});
package.json

"e2e-interactive": "node --experimental-repl-await --inspect-brk ./node_modules/.bin/protractor ./e2e/protractor.interactive.conf",
progrator.interactive.conf.js

// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

// standard protractor config
const baseConfig = require('./protractor.conf');
const configCopy = Object.assign({}, baseConfig.config);

const oneDayInMilliSeconds = 1000 * 60 * 60 * 24;
// set timeout to a huge number
// so it's not an issue when we pause in the debugger
configCopy.allScriptsTimeout = oneDayInMilliSeconds;
configCopy.jasmineNodeOpts.defaultTimeoutInterval = oneDayInMilliSeconds;
// just load our interactive specs
configCopy.specs = ['./interactive.e2e.ts'];

console.log('interactive config', configCopy);
exports.config = configCopy;
现在,我想您只需在控制台上键入
wait元素.all($('a')).get(0).getText()
,即可获得第一个锚元素的文本。我仍然需要对此进行测试,然后回来修正我的答案

节点10+具有repl wait(因此您可以在控制台中等待)

特殊交互式调试规范-interactive.e2e.ts

import { LoginPage } from './src/pages/login.po';
import { AppPage } from './src/pages/app.po';
import { SwitchProfileSideSheet } from './src/side-sheets/switch-profile-side-sheet.po';
import { sel } from '../src/testing/get-component';

const login = new LoginPage();
const app = new AppPage();
const switchProfileSideSheet = new SwitchProfileSideSheet();

// add my own page objects to the global object so I can use them interactively.
global['sel'] = sel;
global['po'] = {
  login,
  app,
  switchProfileSideSheet,
};

(global as any).systemTestsDone = new Promise(function(_resolve, _reject) {
  global['finishInteractiveDebug'] = _resolve;
});

describe('TestHelper', () => {
  it('should provide a way to interactively run tests', async () => {
    await (global as any).systemTestsDone;
  });
});
package.json

"e2e-interactive": "node --experimental-repl-await --inspect-brk ./node_modules/.bin/protractor ./e2e/protractor.interactive.conf",
progrator.interactive.conf.js

// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

// standard protractor config
const baseConfig = require('./protractor.conf');
const configCopy = Object.assign({}, baseConfig.config);

const oneDayInMilliSeconds = 1000 * 60 * 60 * 24;
// set timeout to a huge number
// so it's not an issue when we pause in the debugger
configCopy.allScriptsTimeout = oneDayInMilliSeconds;
configCopy.jasmineNodeOpts.defaultTimeoutInterval = oneDayInMilliSeconds;
// just load our interactive specs
configCopy.specs = ['./interactive.e2e.ts'];

console.log('interactive config', configCopy);
exports.config = configCopy;

现在,我想您只需在控制台上键入
wait元素.all($('a')).get(0).getText()
,即可获得第一个锚元素的文本。我仍然需要对此进行测试,然后回来修改我的答案

谢谢。这是有道理的。我还对脚本文件中的unix命令感到困惑。我对Node.js知之甚少(或根本不知道)。没问题,很高兴我能帮上忙+谢谢!。这应该添加到量角器文档中。谢谢。这是有道理的。我还对脚本文件中的unix命令感到困惑。我对Node.js知之甚少(或根本不知道)。没问题,很高兴我能帮上忙+谢谢!。这应添加到量角器文档中。