gianlucamangiapelo / wdio-azure-devops-service Goto Github PK
View Code? Open in Web Editor NEWCustom WDIO service to publish WebdriverIO results on Azure DevOps Test Plans.
License: MIT License
Custom WDIO service to publish WebdriverIO results on Azure DevOps Test Plans.
License: MIT License
Hi! I dealt with the issue that service is not initialized (Mocha or Cucumber + JS (Node 16.17.0) + WDIO).
Analyzed both issues (#1 and #4 ), checked the logs and there are no any data about the service.
I use WDIO example files as a basis for verification and Azure trial subscription, I got appropriate responses using data from Azure API.
My config looks like:
services: ['chromedriver','geckodriver',
[AzureDevopsService,
{
pat: 'pat',
organizationUrl: 'https://dev.azure.com/org',
projectId: '8b3c68ac-f69d-41c6-bbad-921d8bae9819',
planId: 6,
suiteId: 8,
caseIdRegex: '@?[ref](https://github.com/gianlucamangiapelo/wdio-azure-devops-service/blob/master/\\d+)',
runName: 'FE regression tests for TestPlan',
},
I tried to delete and change this key caseIdRegex, and there was no success.
2022-09-14T18:24:31.827Z INFO @wdio/local-runner: Run worker command: run
2022-09-14T18:24:31.829Z DEBUG @wdio/config:ConfigParser: No compiler found, continue without compiling files
2022-09-14T18:24:31.976Z DEBUG @wdio/local-runner:utils: init remote session
2022-09-14T18:24:31.979Z DEBUG @wdio/utils:initialiseServices: initialise service "chromedriver" as NPM package
2022-09-14T18:24:32.030Z DEBUG @wdio/utils:initialiseServices: initialise service "geckodriver" as NPM package
2022-09-14T18:24:32.071Z DEBUG @wdio/utils:initialiseServices: initialise custom initiated service
2022-09-14T18:24:32.086Z INFO geckodriver: Start Geckodriver (C:\azure-pipelines\node_modules\geckodriver\geckodriver.exe) with args: --log=trace --port=59070
Example of scenario:
Feature: The Internet Guinea Pig Website
@C5
Scenario Outline: As a user, I can log into the secure area
Tokens were generated with Full access and with Test Plan management, no changes
First of all thanks for this awesome feature.
I wanted to check with you if its possible to upload screenshot to Azure DevOps Test Plans ? Currently I have screenshots generated and attached to the Cucumber JSON and HTML reporters but those screenshots are not getting populated in Azure DevOps Test Plans. I have seen this feature on Playwright though. Please check https://github.com/alexneo2003/playwright-azure-reporter
Hi, I've been trying to make the connection between my wdio learning scripts and my Azure DevOps test plan. I saw they were updated to In Progress while the automation test running, but once it was done they were updated as Not Applicable.
And this is the RegEx used in the wdio.config.js:
And this is how I set the test case name in my mocha test case:
Wondering if anyone has experienced this and could share any advice, please.
Hello, I need help, when trying to import the module with import AzureDevopsService from '@gmangiapelo/wdio-azure-devops-service'; i receive this errror
Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ...
to show where the warning was created)
ERROR @wdio/config:ConfigParser: Failed loading configuration file: .../wdio.conf.js: Cannot use import statement outside a module
\node_modules@gmangiapelo\wdio-azure-devops-service\dist\esm\index.js:1
import AzureDevopsService from './azure-devops-service';
^^^^^^
I have set in my package.json the "type": "module", but I still receive this error can someone help?
I'm looking to enhance my process by adding the description or Azure Pipeline build URL once the run ID has been generated. What would be the best approach to accomplish this?
hello @gianlucamangiapelo please help me by addressing the below mentioned issue
i am trying to publish the test results to Azure Devops testcase using your custom service: AzureDevopsService and added that to wdio.config.js file and set all the project, test plan related attributes like below.. also added a test case ID to a test but its not able to publish the test results.. i am quite sure that the azure token and values are perfect as they are working fine via postman.. need to know where I am doing wrong...
services: [
[
'appium',
{
args: {
address: 'localhost',
port: 4724
},
logPath: './'
}
],
[
AzureDevopsService,
{
pat: 'tokenvalue',
organizationUrl: 'https://dev.azure.com/orgid',
projectId: 'projectid',
planId: 6496,
suiteId: 6497,
// caseIdRegex: '@?cC',
caseIdRegex: '(\d+)',
runName: 'Demo',
caseId: 6547
},
]
and in the test script i am using like below:
describe('6547 sample',() => {
it('6547 sample test', async () => {
await driver.pause(10000);
})
})
I am blocked due to this issue, please HELP
Originally posted by @Guru426 in #6 (comment)
When I try to use import AzureDevopsService from "@gmangiapelo/wdio-azure-devops-service"
in V8 with a plain JavaScript project (no TypeScript or Babel to modify node_modules), it fails on internal imports:
Error: Failed to initilialise launcher service unknown: Error: Couldn't initialise "@gmangiapelo/wdio-azure-devops-service".
C:\dev\e2e\node_modules\@gmangiapelo\wdio-azure-devops-service\dist\esm\index.js:1
import AzureDevopsService from './azure-devops-service';
One way I was able to resolve this was:
A simpler way seems to be to simply set your import reference in wdio-azure-devops-service's package.json to also point to the cjs version as with require. This seems to work correctly in an import scenario without having to alter anything further.
Getting below error:
`import AzureDevopsService from './azure-devops-service';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:77:18)
at wrapSafe (node:internal/modules/cjs/loader:1288:20)
at Module._compile (node:internal/modules/cjs/loader:1340:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Object.require.extensions. [as .js] (C:\Users\SundaravelLoganathan\Documents\saim_codes\web-revedia\test\node_modules\ts-node\src\index.ts:1608:43)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
at cjsLoader (node:internal/modules/esm/translators:356:17)
at ModuleWrap. (node:internal/modules/esm/translators:305:7)
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async ConfigParser.addConfigFile (file:///C:/Users/SundaravelLoganathan/Documents/saim_codes/web-revedia/test/node_modules/@wdio/config/build/node/ConfigParser.js:94:36)
at async ConfigParser.initialize (file:///C:/Users/SundaravelLoganathan/Documents/saim_codes/web-revedia/test/node_modules/@wdio/config/build/node/ConfigParser.js:56:13)
at async Launcher.run (file:///C:/Users/SundaravelLoganathan/Documents/saim_codes/web-revedia/test/node_modules/@wdio/cli/build/launcher.js:41:9)
at async Module.run (file:///C:/Users/SundaravelLoganathan/Documents/saim_codes/web-revedia/test/node_modules/@wdio/cli/build/run.js:64:20)`
Attached tsconfig.json
file
tsconfig.json
Currently one limitation I found is that I am having to keep all my test cases in one suite. Usually we keep test cases in different suite based on each cucumber feature.
Could you let us know if it's possible to do this ? Either by passing suite number as tag or from a config file ?
OnPrepare and OnComplete hooks in the class AzureDevopsService are not getting not invoked or executed. Due to which Test run id is not created, hence results are not updated to test plan. Where as if the test run id for test plan is available and inProgress then results are updated to test plan, but test execution history for current test point will not be updated.
gianlucamangiapelo/wdio-azure-devops-service Version: 0.0.11
Jasmine + JS (Node 18.12.1) + WDIO(7.29.1)
@gianlucamangiapelo please check and help us with the solution. Please let me know if any additional details are required
AzureDevopsService,
{
pat: 'u46xjx2ol4px36zg3z565uz52dbvshctlulkhrsecxiamn6nhtwa',
organizationUrl: 'https://dev.azure.com/gianlucamangiapelo',
projectId: '8b3c68ac-f69d-41c6-bbad-921d8bae9819',
planId: 263072,
suiteId: 263073,
caseIdRegex: '@?ref',
runName: 'FE regression tests for TestPlan',
},
actual result is :
Type '{ pat: string; organizationUrl: string; projectId: string; planId: number; suiteId: number; caseIdRegex: string; runName: string; }' is not assignable to type 'ServiceEntry'.
Object literal may only specify known properties, and 'pat' does not exist in type 'HookFunctions | ServiceClass | [string, ServiceOption] | [ServiceClass, ServiceOption]'.ts
Tried this service as per documents : https://webdriver.io/docs/gmangiapelo-wdio-azure-devops-service
But couldn’t find anything reflected in my Azure Test plans.
Hello, I am hoping that you could give me a hand in getting this service working. I have added the service as per https://webdriver.io/docs/gmangiapelo-wdio-azure-devops-service/ and as far as I can tell have it setup correctly but test cases are not being updated in Azure.
I have looked through issue #1 but have still not been able to get it working. Below is the setup that I have in wdio and Azure. Any help would be greately appreciated, thanks in advance.
wdio.conf.js setup as so:
services: [
[driverService],
[AzureDevopsService,
{
pat: 'pat',
organizationUrl: 'https://dev.azure.com/org',
projectId: 'projectid',
planId: 30584,
suiteId: 37063,
caseIdRegex: '@?[cC](\d+)',
runName: 'AzureDevops Test',
},
],
],
When querieng the through Postman I am able to return test cases with no issues using the pat, org, projectId, planId and suiteId
GET https://dev.azure.com/{org}/{projectid}/_apis/test/Plans/30584/suites/37063/testcases?api-version=5.0
"testCase": {
"id": "37064",
"url": "https://dev.azure.com/{org}/_apis/wit/workItems/37064",
"webUrl": "https://dev.azure.com/{org}/web/wi.aspx?pcguid=########-####-####-####-############&id=37064"
},
Test case setup, I have tried with lower and upper case C:
describe('Test 1', () => {
it( 'C37064 Test case', async () => {
});
});
After running the test Azure is not updated:
I have set the logging to:
logLevel: "trace",
outputDir: path.join(__dirname, "/logs"),
But can see no mention of this service in any of the logs.
In jasmine framework the test title is not propagated on the test object, that is used to parse the test case id.
Update the parse function to use also test.description
in case the test.title
is missing.
Original reference: #4 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.