我需要访问<fieldset disabled>
<legend>Disabled form elements</legend>
<label>Input 1<input name="input 1"></label>
<label>Input 2<input name="input 2"></label>
<button
class="disabled-button"
name="disabled-button"
>
This is disabled
</button>
<i
class="enabled-button"
role="button"
tabindex="0"
>
This is enabled
</i>
</fieldset>
<label>
Disabled button clicks:
<output class="disabled-output">0</output>
</label>
<label>
Enabled button clicks:
<output class="enabled-output">0</output>
</label>
,输入测试电子邮件,然后显示一个弹出窗口,选择一个帐户并输入密码。现在,在此阶段,从MS website
接收有效令牌,然后系统将被重定向到另一个MS Website
。在这种情况下,如何使用赛普拉斯重定向到该test_site
,以便可以在该测试站点中执行测试。
下面是我的Commands.js test_site
getLoginToken()
柏树测试:
var accessToken;
Cypress.Commands.add('getLoginToken', () => {
cy.request({
method: 'POST',
url: 'url_here',
body: {
email: 'yourEmail',
password: 'yourPassword'
}
})
.then((response) => {
return new Cypress.Promise((resolve, reject) => {
const rbody = (response.body);
var tokenPattern = "(?i)\"access_token\":\\s*\"([^\"]*)\"";
const authToken = rbody.access_token;
accessToken = authToken;
cy.log(accessToken);
resolve(accessToken);
return accessToken;
})
})
})