如何通过Nightwatch中的API验证表单元素中的预填充数据 - 使用Nightwatch将Ajax请求传递给PI

时间:2018-06-15 11:01:26

标签: nightwatch.js

我正在使用Nightwatch自动化入门表单,并且要求我们需要验证从我们拥有API的数据库中预填充的数据。任何人都可以帮助指导我如何使用Nightwatch验证预填充数据。

目前我已经这样做了。

var launch_url = 'https://hireflyui.ptlab.com/onboarding/7e6d2843a679bdcf62f68369c6d2ab848571885d3f206b92a811bdb3e3c7d559c65ca93afc6ab56a48943bd4cfdd42176756d468f359b89d381ce7c6c34f5abd557f4e96a71878cfa1bf4d387a0bbfc872c95110e133eaa987345e9b8da6bbdcdffae2082ec2b560a31fab6a6656aaef51c90e55cbc7b82c1badb6c7a16a5a0a';
var apiUrl = "http://hireflyapi.ptlab.com/_hirefly/7e6d2843a679bdcf62f68369c6d2ab848571885d3f206b92a811bdb3e3c7d559c65ca93afc6ab56a48943bd4cfdd42176756d468f359b89d381ce7c6c34f5abd557f4e96a71878cfa1bf4d387a0bbfc872c95110e133eaa987345e9b8da6bbdcdffae2082ec2b560a31fab6a6656aaef51c90e55cbc7b82c1badb6c7a16a5a0a";
        browser
        .url(apiUrl)
        .waitForFirstXHR('', 1000, null, function assertValues(xhr) {
            browser.assert.equal(xhr.status, "success");
            browser.assert.equal(xhr.method, "POST");
            browser.assert.equal(xhr.requestData, "200");
            browser.assert.equal(xhr.httpResponseCode, "200");
            browser.assert.equal(xhr.responseData, "");
            console.log(xhr.requestData);
        })

0 个答案:

没有答案