2017-07-14 133 views
1

我有与量角器测试问题,它总是抛出一个消息:端对端测试没有发现规格角2量角器

[10:11:22] I/hosted - Using the selenium server at http://localhost:4444/wd/hub 
[10:11:22] I/launcher - Running 1 instances of WebDriver 
Started 
No specs found 
Finished in 0.001 seconds 
[10:11:24] I/launcher - 0 instance(s) of WebDriver still running 
[10:11:24] I/launcher - firefox #01 passed 
http-server stopped. 

配置文件是好的,它会读取E2E文件。还有就是配置文件:

exports.config = { 
    seleniumAddress: 'http://localhost:4444/wd/hub', 
    baseURL: 'http://localhost:3000/', 
    capabilities: { 
     'browserName': 'firefox' 
    }, 
    specs: ['e2e-spec.ts'], 
    jasmineNodeOpts: { 
     showColors: true 
    } 
}; 

我端对端文件:

// app.e2e-spec.ts 
import { Registration } from './registrationPage'; 
import {browser} from "protractor"; 

describe('e2e-spec.ts', function() { 
    let page: Registration; 
    let header = 'Welcome!'; 
    page = new Registration(); 
    let result = page.getHeader(); 
     it('should display heading saying Welcome!',() => { 
     page.navigateTo().then(function() { 
      console.log('Start test 1: automatic redirection of index'); 
      expect(result).toEqual(header); 
     }); 
    }); 
}); 

我不知道该怎么办,没关系我投入端对端文件,它会打开浏览器,关闭它,抛出所有的时间相同的消息,我用npm run e2e

回答

1

使用try套房:

/*let suites = { 
    e2e: "./*e2e-spec.ts" 
};*/ 

//Bruteforce to find the path 

let suites = { 
    e2e2: "../**/*spec.ts" 
}; 

exports.config = { 
    seleniumAddress: 'http://localhost:4444/wd/hub', 
    baseURL: 'http://localhost:3000/', 
    capabilities: { 
     'browserName': 'firefox' 
    }, 
    suites: suites, 
    jasmineNodeOpts: { 
     showColors: true 
    } 
}; 

也许你应该考虑的页面对象Dessign模式:

let RegistrationPage = require('./registrationPage'); 

describe('e2e-spec.ts', function() { 
    let page = new RegistrationPage(); 
    let result = page.getHeader(); 
    let header = 'Welcome!'; 

    it('should display heading saying Welcome!',() => { 
     page.navigateTo().then(function() { 
      console.log('Start test 1: automatic redirection of index'); 
      expect(result).toEqual(header); 
     }); 
    }); 
}); 
+0

还是同样的消息没有找到规格@ –

+0

JędrekMarkowski还好吧,蛮力:试试这个:'让套房= { E2E: “./*spec.ts”, E2E2:” ../* spec.ts“, e2e2e:”./**/*spec.ts“, e2e2e2:”../**/*spec.ts“ };' – Alf

+0

如果您发布测试路径的截图。所以我们可以找出正确的路径。 – Alf

0

这很简单:

specs: [ 
'./e2e/**/*.e2e-spec.ts' 
] 

这意味着它将运行端对端文件夹中的所有测试用例(.e2e-spec.ts)。

enter image description here

相关问题