Automation 如何跳过量角器&x2B;特定于浏览器的jasmine测试

Automation 如何跳过量角器&x2B;特定于浏览器的jasmine测试,automation,jasmine,protractor,cross-browser,Automation,Jasmine,Protractor,Cross Browser,假设我已经在chrome、firefox、IE、Edge和Safari等多个浏览器中自动执行了25个测试。所有测试(25)都在Chrome上运行良好。在Firefox中,只有20个测试运行正常,因为很少有量角器API不受支持。类似地,IE只能执行23个测试 我只想跳过浏览器的测试,而特定测试不支持浏览器?有什么方法可用吗?您可以为每个浏览器创建protracotr.conf文件,其中包含特定的套件,其中将指定应运行哪些测试。并一次性执行所有dragrator.conf文件 //protracto

假设我已经在chrome、firefox、IE、Edge和Safari等多个浏览器中自动执行了25个测试。所有测试(25)都在Chrome上运行良好。在Firefox中,只有20个测试运行正常,因为很少有量角器API不受支持。类似地,IE只能执行23个测试


我只想跳过浏览器的测试,而特定测试不支持浏览器?有什么方法可用吗?

您可以为每个浏览器创建
protracotr.conf
文件,其中包含特定的
套件
,其中将指定应运行哪些测试。并一次性执行所有
dragrator.conf
文件

//protractor.chrome.conf
export let config: Config = {
...
  capabilities: {
    browserName: 'chrome',
    shardTestFiles: true,
    maxInstances: 1
  },

  SELENIUM_PROMISE_MANAGER: false,
  specs: [
    '../test/chrome/**/*.js'
  ]
};

在您的
包.json中:

{
...
  "scripts": {
    "test:all": "npm run test:chrome && test:ie",
    "test:chrome": "protractor ./config/protractor.chrome.conf.js",
    "test:ie": "protractor ./config/protractor.ie.conf.js",
     ...
  },
...
}

使用jasmine2,您可以使用正则表达式过滤测试。也许您可以在测试中添加诸如@chrome、@ie之类的内容,然后只通过传递grep标志来运行这些测试:

it('should do stuff @ie @chrome', function() {
  ...
});
protractor conf.js --grep='@ie'
然后通过grep标志运行量角器:

it('should do stuff @ie @chrome', function() {
  ...
});
protractor conf.js --grep='@ie'

它如何解决这个问题?对于规格A中的ex,可使用测试x、y、z。所有测试都在chrome中正常运行。但由于某些量角器API的原因,测试y并没有在Firefox上运行。我想跳过测试y的测试执行。如何让testY在chrome上运行而在firefox上跳过?