stripe-payments - 在测试中与来自其他域的网页交互
问题描述
我正在测试一个网上商店。当用户创建一个购物篮时。网站 (domain.de) 将用户重定向到 Stripe 支付系统。(条纹网)
现在,我想通过输入数据来完成付款。页面显示如下
该页面显示在一个新窗口中,屏幕左侧没有 cypress 测试步骤。
我努力了
cy.get(`[data-cy="checkout-button-desktop"] ion-button`)
.last()
.click({force: true}).then(()=>{
cy.window().then((win) => {
// Replace window.open(url, target)-function with our own arrow function
cy.stub(win, 'open', url =>
{
// change window location to be same as the popup url
win.location.href = url;
}).as("popup") // alias it with popup, so we can wait refer it with @popup
})
cy.get("@popup").should("be.called")
cy.get(`[id="cardNumber"]`).type(`5555555555554444`)
cy.get(`[id="cardExpiry"]`).type(`02 / 22`)
cy.get(`[id="cardCvc"]`).type(`022`)
cy.get(`[id="billingName"]`).type(`Test Test`)
// cy.xpath('//*[@id="root"]/div/div/div[2]/div/form/div[2]/div[4]/button/div[2]/span[1]').click({force: true});
cy.get(`.SubmitButton-IconContainer`).click();
cy.url().should('include', 'theoptical')
但它没有用。我没有任何从 cyperss 访问网页的权限
解决方案
推荐阅读
- javascript - JS 中的这种语言结构是什么?
- html - 有没有办法清除/隐藏两个 td 表中的第一个 td,而无需访问第一个 td?
- selenium - 使用 * vs 元素标签
- sql - 大于表达式中的 SQL 多列
- mysql - log4jdbc可以和spring boot一起使用吗?
- groovy - 在groovy中将十六进制字符串转换为二进制
- matlab - ode45 Matlab 中的 NaN 响应
- system-verilog - always 块中“复合”线的组合分配
- mongodb - 如何让 mongo-express 在 docker-compose 中等待 mongo
- homebrew - Brew 安装 gcc 错误 - 管道损坏 (Errno::EPIPE)