共计 1881 个字符,预计需要花费 5 分钟才能阅读完成。
(1) yarn install
(2) 进到 storefrontapp-e2e-cypress 目录再次 yarn install
(3) yarn build:libs
脚本命令:
cypress run –config-file cypress.ci.json –record –key $CYPRESS_KEY –tag “2011,b2c,all,parallel” –p
arallel –group B2C –ci-build-id $TRAVIS_BUILD_ID –spec “cypress/integration/!(vendor|b2b|ssr)/*/.e2e
-spec.ts”
record option 代表视频记录,这个语法在官网文档 能够找到。
export 命令自身不须要应用 $ 符号,然而在脚本文件里应用变量时,须要加上 $ 符号。
Bash export 命令帮忙咱们导出环境变量,以便它们在所有 子过程
、shell 和命令中可用。
此外,export 命令和其余相干命令的不同命令行选项提供了跨不同 shell 和 bash 脚本定义、导出和应用 bash 变量的各种办法。
对于 bash 里特殊符号 $ 的用法,参考这个链接。
yarn e2e:run:ci”${SUITE}”
bash 里圆括号的语法
这里的 SUITE 是 script 里自定义的变量。
SUITE 值可能为下列 e2e:run:ci 冒号后的值,比方 ssr,b2b 等等。
取决于使用者依照什么样的命令行参数传递 –suite
应用 –suite 或者 -s 参数格局均可,默认参数为 b2c:
最初先 yarn start,再 yarn e2e:run:ci
咱们就看这个默认的 b2b script:
yarn –cwd ./projects/storefrontapp-e2e-cypress run cy:run:ci:b2b\
应用 –cwd 防止脚本文件里呈现不必要的 cd 操作符。参考这个操作符的官网文档。
cy:run:ci:b2b – 最初执行的如下脚本:
–tag 用于最初在 dashboard 后果列表里查看。
–group 用于在一个测试里将记录后的后果搁置于同一组内。
开始执行测试了:
一些测试后果:
B2B – Bulk Pricing
Mobile
Check bulk pricing table
(node:8855) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
✓ should render pricing table for products that contain bulk prices (5819ms)
✓ should checkout using the proper bulk price based on quantity (1604ms)
✓ should NOT render pricing table for products that DO NOT contain bulk prices (736ms)
✓ should verify lowering the quantity also lowers the discount (2262ms)
✓ should verify increasing the quantity also increases the discount (1904ms)
✓ should verify checking out a bulk priced item and a regular product (7819ms)
Desktop
Check bulk pricing table
✓ should render pricing table for products that contain bulk prices (963ms)
✓ should checkout using the proper bulk price based on quantity (1307ms)
✓ should NOT render pricing table for products that DO NOT contain bulk prices (756ms)
✓ should verify lowering the quantity also lowers the discount (2282ms)
✓ should verify increasing the quantity also increases the discount (1941ms)
✓ should verify checking out a bulk priced item and a regular product (9332ms)
在执行日志的开端,看到了 command exited with 0 的提醒,阐明执行胜利。
更多 Jerry 的原创文章,尽在:” 汪子熙 ”: