我正在尝试在我的 azure devops uisng IAAC(Infra as a code) 中对 java 脚本代码进行 e2e-testcafe。所以我有不同的阶段构建、测试和部署到不同的环境。部署到测试环境(存储帐户)后,我需要在该部署的代码中进行 e2e。所以我对这些工作使用了以下步骤:我的 azure-pipeline.yml 有以下
- job: e2e_tests
pool:
vmImage: 'Ubuntu 16.04'
steps:
- task: NodeTool@0
inputs:
# Replace '10.14' with the latest Node.js LTS version
versionSpec: '10.14'
displayName: 'Install Node.js'
- script: npm install
displayName: 'Install TestCafe'
- script: npm test
displayName: 'Run TestCafe Tests'
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/report.xml'
testResultsFormat: 'JUnit'
---------------------------------------------------
my test.js:
import { Selector } from 'testcafe';
const articleHeader = Selector('#article-header');
const header = Selector('h1');
fixture `Getting Started`
.page `localhost:8080`
test('My first test', async t => {
await t
.expect(header.innerText).eql('Welcome to Your new App');
});
但是在这里它从我的 test.js 运行测试,它是应用程序的一部分,并且所有测试都在代理的本地服务器中运行,Azure devops 在这里为我使用它的 Windows 服务器。但现在我想将 URI 传递给 npm test,当它进入我的应用程序时,它再次获取 localhost:8080 并在本地执行。那么有人可以帮助我在我通过的 url 中运行 e2e 测试,这确实是 storageaccount 的 url?就像我的命令应该在 azurepipelines.yaml
npm run test --URL
在我的 test.js 中,它应该选择我在管道中运行时传入 Yaml 的 URL。
拉丁的传说
喵喵时光机
HUWWW
随时随地看视频慕课网APP
相关分类