gpt4 book ai didi

testing - 登录测试 - 自动化(node.js)

转载 作者:行者123 更新时间:2023-11-28 21:36:18 25 4
gpt4 key购买 nike

作为软件测试员职位申请的一部分,我被要求完成以下登录测试:

const page = require ('../page/page')
const { expect } = require('chai')

const username = ""
const password = ""
const usernameField = 'input[name=identifier]'
const passwordField ='input[name=password]'
const submitBtn = 'button'
const loginError = 'span=Username or Password are incorrect'

describe('login', () => {
it('login with valid credentials', () => {
browser.url('https://sso.hosteurope.de/')
$(usernameField).isDisplayed()
$(usernameField).setValue("test")
})
it('login with invalid credentials', () =>{
browser.url('https://sso.hosteurope.de/')


$(submitBtn).click()
expect($(loginError).isDisplayed()).to.be.true
})
})

根据规范,我需要一个 IDE,最好是 VSCode,以及安装 Node JS 来运行提供的项目。这应该使用 Webdriver.io 完成。

您可能会说,这对我来说都是外语。我不知道 JavaScript(但我愿意学习),我最近完成了一个手动测试类(class),我在申请这份工作时确实确认了这一点——比如,我告诉他们我不知道自动化,但我愿意学习。不过我确实通过了他们的第一次面试,现在他们让我完成 3 个测试,第一个就是上面提到的那个。我不想作弊,我只是想了解这是如何工作的。

帮助?

最佳答案

脚本分配基本上是使用 webdriver.io 或 protractor 等的简单凭据登录。它包括 chai。



根据你的编程技能,我建议你先学习基本的 javascript。有几个类(class)
付费
Udemy Javascript for Software Testers

免费
w3schools
Codecademy
guru99


完成此操作后,请阅读 webdriver.io 教程页面。
Official Page
Step by Step


终于读到这个了。这在某些方面类似于您的作业。
The Lamp Post

最后,如果你想了解 chai 是一个 TDD/BDD 断言库,你可以在这里阅读它
Chai JS

关于testing - 登录测试 - 自动化(node.js),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58464766/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com