赛普拉斯配置插值

时间:2019-10-22 06:05:58

标签: cypress

有没有办法让cypress.json中的配置变量指向另一个变量?

一个小例子:

{
    "baseUrl": "https://example.org"
    "env": {
        "apiUrl": "${baseUrl}/api/v1"
    }
}

我没有在文档中找到有关此内容的信息,但这对我来说非常有用。

1 个答案:

答案 0 :(得分:1)

由于cypress.json是简单的JSON文件,因此无法在cypress/plugins/index.js内进行插值。但是,您可以在运行时实现,就像这样(将这段代码放入module.exports = (on, config) => { // `on` is used to hook into various events Cypress emits // `config` is the resolved Cypress config config.baseUrl = `${config.baseUrl}${config.env.apiUrl}` console.log(config.baseUrl) // https://example.org/api/v1 return config; } 中):

cypress.json

还有您的{ "baseUrl": "https://example.org" "env": { "apiUrl": "/api/v1" } }

SET @codeid =( SELECT id FROM mytable WHERE flag = 1 GROUP BY code);
UPDATE mytable SET flag = 0 WHERE id IN (@codeid);
相关问题