我已经在这一段时间了,但无法通过文件找到任何解决方案。
基本上我在需要密码凭据的QA环境中进行测试。
虽然我可以手动输入用户名/密码,但理想情况下我希望在测试中自动输入。
这可以通过WebdriverIO实现吗?
如上所述,只需在URL中添加凭据(使用您自己的userName
和passWord
:
const credentials = `https://userName:passWord@`
const URLEnv = 'www.google.com'
const url = credentials + URLEnv
....
describe('Google page', () => {
it('should have the right title', () => {
browser.url(url);
const title = browser.getTitle();
const correctResult = 'Google'
expect(title).toEqual(correctResult);
});
});