Git Product home page Git Product logo

agent-js-webdriverio's Introduction

Join Slack chat! stackoverflow GitHub contributors Docker Pulls License Build with Love lambdaTest a27c44

Repositories structure

ReportPortal high level architecture

reportportal high level architecture

ReportPortal repositories structure

Report Portal organized into multiple repositories.

ReportPortal server side consists of the following services:

  • service-authorization Authorization Service. In charge of access tokens distribution
  • service-api API Service. Application Backend
  • service-ui UI Service. Application Frontend
  • service-index Index Service. Info and health checks per service.
  • service-analyzer Analyzer Service. Finds most relevant test fail problem.
  • gateway Traefik Gateway Service. Main entry point to application. Port used by gateway should be opened and accessible from outside network.
  • rabbitmq Load balancer for client requests. Bus for messages between servers.
  • minio Attachments storage.

Available plugins developed by ReportPortal team:

Client side adapters related repositories:

  • client-* - API integrations. Http clients, which process HTTP request sending.
  • agent-* - Frameworks integration. Custom reporters/listeners, which monitor test events and trigger event sending via client-*
  • logger-* - Logging integration. Logger appenders, which help to collect logs, bind it with test-case item via agent-* and send to server via client-*

Other repositories stored according to next rules

  • service-* - micro-services which are a part of Application
  • commons-* - common libraries, models, etc., used by micro-services

Installation steps

Simple setup with Docker

It's the best way for demo purposes and small teams. The database is already in the docker-compose.

  1. Install Docker (Engine, Compose)

  2. Download Example of docker-compose descriptor to any folder

  3. Deploy ReportPortal using docker compose plugin within the same folder

docker compose -p reportportal up

To start ReportPortal in daemon mode, add '-d' argument:

docker compose -p reportportal up -d
  1. Open in your browser IP address of deployed environment at port 8080
http://IP_ADDRESS:8080
  1. Use next login\pass for access:
  • default\1q2w3e
  • superadmin\erebus.

Please change admin password for security.

Mentioned compose file deploy all available Bug Tracking System integrations, which not always needed, but use resources.

Production-ready set and Custom deployment with Docker

For production usage, we recommend:

  • choose only required Bug Tracking System integration service. Exclude the rest

To customize deployment and make it production-ready please follow customization steps and details

Integration. How to get log data in

You should add Client Side code inside your test automation. It consists of:

  • client-* - API integrations. Http clients, which process HTTP request sending. E.g. for Java (client-java-*)
  • agent-* - Frameworks integration. Custom reporters/listeners, which monitor test events and trigger event sending via client-*
  • logger-* - Logging integration. Logger appenders, which helps to collect logs, bind it with test-case via agent-* and send to server via client-*

Integration steps and documentation

Contribution

There are many different ways to contribute to Report Portal's development, just find the one that best fits with your skills. Examples of contributions we would love to receive include:

  • Code patches
  • Documentation improvements
  • Translations
  • Bug reports
  • Patch reviews
  • UI enhancements

Big features are also welcome but if you want to see your contributions included in Report Portal codebase we strongly recommend you start by initiating a chat through our Team in Slack.

Contribution details

Documentation

Community / Support

License

Report Portal is Apache 2.0.

agent-js-webdriverio's People

Contributors

alexgalichenko avatar amsterget avatar bam6ycha avatar chivekrodis avatar renkyoji avatar tr1ble avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agent-js-webdriverio's Issues

Option 'token' is deprecated. Use 'apiKey' instead.

While using token as described in the configuration example -> https://github.com/reportportal/examples-js/blob/main/example-webdriverio/examples-webdriverio-mocha/wdio.conf.js
Everything is working but receiving annoying warn message to use apiKey instead, whenever I set apiKey instead of token I receive an error:

ReportPortalRequiredOptionError: 
ReportPortal client error: 
Validation failed. Please, check the specified parameters: 
Property 'apiKey' must not be empty.
    at getApiKey (path/node_modules/@reportportal/client-javascript/lib/commons/config.js:25:13)
    at getClientConfig (path/node_modules/@reportportal/client-javascript/lib/commons/config.js:40:20)
    at new RPClient (path/node_modules/@reportportal/client-javascript/lib/report-portal-client.js:34:19)
    at new Reporter (path/node_modules/@reportportal/agent-js-webdriverio/src/reporter.ts:57:19)
    at BaseReporter._loadReporter (file://path/node_modules/@wdio/runner/build/reporter.js:161:20)
    at Array.map (<anonymous>)
    at BaseReporter.initReporters (file://path/node_modules/@wdio/runner/build/reporter.js:23:68)
    at Runner.run (file://path/node_modules/@wdio/runner/build/index.js:70:30)

wdio.config

const rpConfig = {
  apiKey: 'my_token',
  endpoint: 'url/api/v1',
  project: 'xxx',
  launch: `Launch name`,
  mode: 'DEFAULT',
  debug: false,
  attributes: [{ key: 'Platform', value: process.env.ENV }],
  attachPicturesToLogs: true,
  reportSeleniumCommands: false,
  seleniumCommandsLogLevel: 'info',
};

[Issue] All steps are posted to the same failed scenario on the second rerun of the test

Tool:

  • WDIO + Cucumber

ReportPortal config:

config: {
        token: 'token',
        endpoint: 'endpoint',
        launch: 'QA Web Tests',
        project: 'project',
        mode: 'DEFAULT',
        debug: false,
        description: 'description',
        attachPicturesToLogs: true,
        rerun: true,
        cucumberNestedSteps: true,
        skippedIssue: true,
},

Turn on rerun: true flag.

Example:
We have two scenarios - one pass and the second one is fail.

image

If we go into the failed scenario, we can see why it doesn't work after the second run.
In addition, we see the steps from the passed scenario and the steps from the first one that failed.

image

Expected result:
It would be nice to have both launches of the failed tests and mark the test based on the corresponded latest result.
Example:

  1. First test failed / Second test passed - Result: passed
  2. First test failed / Second test failed - Result: failed

Reporter breaks on skipped test for WebdriverIO + Mocha

Hey there,

found a strange issue, that reporter breaks on it.skip(...) having WebdriverIO set up with Mocha (which seems quite popular pair).

Installed versions
agent-js-webdriverio: ^5.0.3
webdriverio: ^7.30.2

Sample code

describe('Demo of breaking skipped tests', () => {
  it('executing test case', () => {
    expect(true).toBe(true)
  })

  it.skip('skipped test case', () => {
    expect(true).toBe(true)
  })
})

gives following output when run

[0-0] TypeError in "Demo of breaking skipped tests.executing test case"
TypeError: Cannot destructure property 'id' of 'this.storage.getCurrentTest(...)' as it is null.
    at Reporter.finishTest (/Users/krzysztof.biszta/ACME/acme-app/clients/node_modules/@reportportal/agent-js-webdriverio/src/reporter.ts:177:7)
    at Reporter.onTestSkip (/Users/krzysztof.biszta/ACME/acme-app/clients/node_modules/@reportportal/agent-js-webdriverio/src/reporter.ts:154:10)
    at Reporter.<anonymous> (/Users/krzysztof.biszta/ACME/acme-app/clients/node_modules/@reportportal/agent-js-webdriverio/node_modules/@wdio/reporter/build/index.js:154:18)
    at Reporter.emit (node:events:526:28)
    at Reporter.emit (node:domain:475:12)
    at /Users/krzysztof.biszta/ACME/acme-app/clients/node_modules/@wdio/runner/build/reporter.js:36:56
    at Array.forEach (<anonymous>)
    at BaseReporter.emit (/Users/krzysztof.biszta/ACME/acme-app/clients/node_modules/@wdio/runner/build/reporter.js:36:25)
    at MochaAdapter.emit (/Users/krzysztof.biszta/ACME/acme-app/clients/node_modules/@wdio/mocha-framework/build/index.js:257:24)
    at Runner.emit (node:events:538:35)
    at Runner.emit (node:domain:475:12)
    at next (/Users/krzysztof.biszta/ACME/acme-app/clients/node_modules/mocha/lib/runner.js:759:14)
    at next (/Users/krzysztof.biszta/ACME/acme-app/clients/node_modules/mocha/lib/runner.js:581:14)
    at /Users/krzysztof.biszta/ACME/acme-app/clients/node_modules/mocha/lib/runner.js:591:7
    at next (/Users/krzysztof.biszta/ACME/acme-app/clients/node_modules/mocha/lib/runner.js:474:14)
    at Immediate.<anonymous> (/Users/krzysztof.biszta/ACME/acme-app/clients/node_modules/mocha/lib/runner.js:559:5)

Unable to push log to report portal using ReportingApi.log()

I am using @reportportal/agent-js-webdriverio npm module to push log statements written in test to report portal.
I used below code snippet.

const { Reporter } = require('@reportportal/agent-js-webdriverio');
ReportingApi.log('INFO', 'info log with attachment');

Logs is not able to push to report portal.
I am looking for log statement similar as provided in screenshots.
image

Support Nested Steps for Cucumber Reporting

Linking over to this issue: reportportal/reportportal#275

Right now, tests are being reported as

Launch -> Feature -> Scenario -> Test (A step is an individual Test)

It would be great to support having Steps directly inside of the Scenario instead of being their own individual tests with logs. A previous tool for WebDriverIO seemed to support it in the past, wdio-reportportal-reporter, but it doesn't seem to work with ReportPortal v5.

Please let me know if this is possible. It would be great if it could behave similar to agent-js-cucumber.

[Issue] Tests are running in a one thread when pass files as array of arrays

Tool:

  • WDIO + Cucumber

Config:
specs: [['tests/**/*.feature']]

If we pass the feature files as an array of arrays, this causes entire scripts to run on a single thread.

If we pass specs: ['tests/**/*.feature'] it runs scenarios in multiply threads, however, it creates a new lunch for each feature file in the ReportPortal.

Expected result:
It would be nice to add just specs: ['tests/**/*.feature'] and run scenarios in a parallel.

Get merged launch link and ID

As it stands, there is no way to get the link to a merged launch. The finishLaunch hook contains some logic to handle these links. However, when merging launches these links are invalid pretty much immediately.

It would be very useful to be able to print this link or even save it to a text file for later use.

Context: I currently link test reports upon test completion via the Slack API. I would like to be able to pass along the link to the Report Portal launch with these messages.

Finished launch doesn't set correct launch status on UI

After success or failed test execution, Report Portal doesn't set finished time.
Inside suite item:
Screenshot 2023-11-09 at 14 55 33
On the specific launch page:
Screenshot 2023-11-09 at 14 57 37
On all launches page:
Screenshot 2023-11-09 at 14 59 33

For the settings reference was used: https://github.com/reportportal/examples-js/blob/main/example-webdriverio/examples-webdriverio-mocha/wdio.conf.js

Debug logs(doesn't contains any issues):

RUNNING in iOS - file:///tests/e2e/Login/login.e2e.spec.ts
Start launch with tempId 3sb3z20kglor6r1ap {
  description: undefined,
  attributes: [
    { key: 'Platform', value: 'XXX' },
    {
      key: 'agent',
      value: '@reportportal/agent-js-webdriverio|5.0.3',
      system: true
    }
  ],
  rerun: undefined,
  rerunOf: undefined,
  mode: 'DEFAULT'
}
Success start launch with tempId 3sb3z20kglor6r1ap { id: 'f8f4408f-d56c-4c47-9d13-d893380bc456', number: 7 }
Start test item with tempId 3sb3z20kglor6r1au {
  startTime: 1699534147926,
  name: 'Authentication',
  type: 'SUITE',
  codeRef: 'tests/e2e/Login/login.e2e.spec.ts/Authentication',
  testCaseId: 'tests/e2e/Login/login.e2e.spec.ts/Authentication',
  launchUuid: 'f8f4408f-d56c-4c47-9d13-d893380bc456'
}
Success start item with tempId 3sb3z20kglor6r1au {
  id: 'c8337cb9-72d8-41c7-a70d-d3368c08ab43',
  uniqueId: 'auto:d211628e5953f8b1169dfd5221bd7781'
}
Start test item with tempId 3sb3z20kglor6r1av {
  startTime: 1699534147927,
  name: 'Log in without biometrics',
  type: 'STEP',
  codeRef: 'tests/e2e/Login/login.e2e.spec.ts/Authentication/Log in without biometrics',
  testCaseId: 'tests/e2e/Login/login.e2e.spec.ts/Authentication/Log in without biometrics',
  launchUuid: 'f8f4408f-d56c-4c47-9d13-d893380bc456'
}
Success start item with tempId 3sb3z20kglor6r1av {
  id: '613295fb-48b7-49fe-bda5-40cec2bcea58',
  uniqueId: 'auto:f1709df5a6f0786e70701bb25d5615e7'
}
Finish all children for test item with tempId 3sb3z20kglor6r1av 
Finish test item with tempId 3sb3z20kglor6r1av { status: 'passed' }
Finish test item with tempId 3sb3z20kglor6r1av {
  promiseStart: Promise {
    {
      id: '613295fb-48b7-49fe-bda5-40cec2bcea58',
      uniqueId: 'auto:f1709df5a6f0786e70701bb25d5615e7'
    }
  },
  realId: '613295fb-48b7-49fe-bda5-40cec2bcea58',
  children: [],
  finishSend: true,
  promiseFinish: Promise { <pending> },
  resolveFinish: [Function (anonymous)],
  rejectFinish: [Function (anonymous)]
}
Finish all children for test item with tempId 3sb3z20kglor6r1au 
Success finish item with tempId 3sb3z20kglor6r1av {
  message: "TestItem with ID = '613295fb-48b7-49fe-bda5-40cec2bcea58' successfully finished."
}
Successfully finish child with tempId 3sb3z20kglor6r1av
                 of test item with tempId 3sb3z20kglor6r1au 
Finish test item with tempId 3sb3z20kglor6r1au {}
Finish test item with tempId 3sb3z20kglor6r1au {
  promiseStart: Promise {
    {
      id: 'c8337cb9-72d8-41c7-a70d-d3368c08ab43',
      uniqueId: 'auto:d211628e5953f8b1169dfd5221bd7781'
    }
  },
  realId: 'c8337cb9-72d8-41c7-a70d-d3368c08ab43',
  children: [ '3sb3z20kglor6r1av' ],
  finishSend: true,
  promiseFinish: Promise { <pending> },
  resolveFinish: [Function (anonymous)],
  rejectFinish: [Function (anonymous)]
}
Success finish item with tempId 3sb3z20kglor6r1au {
  message: "TestItem with ID = 'c8337cb9-72d8-41c7-a70d-d3368c08ab43' successfully finished."
}
Finish launch with tempId 3sb3z20kglor6r1ap { endTime: 1699534177243 }
PASSED in iOS - file:///tests/e2e/Login/login.e2e.spec.ts

How to get launchId of completed launch to use in separate API call

Hi There,

Is it possible to access the launchId for a launch created via this library?

Context:

  • I need to create the launch via this plugin
  • Access launchId
  • Query API directly inputting launchId
  • Accessing launch stats to build up message to post to slack along with the launchURL as well

N.B: previous library used wdio-reportportal-reporter (3rd party library) allowed access to it via environment variable:
e.g: const uuid = process.env.RP_LAUNCH_ID;

Any help appreciated

Launch not being set to complete after test executions

URL: https://demo.reportportal.io/
Version: 5.7.4
Integration: WebdriverIO / Mocha

I have a very simple test file to create a POC to use Report Portal (mage 1). But whenever the test execution is complete, launch dashboard still displays that it's being executed (mage 2). So when isLaunchMergeRequired is enabled, it's erroring to merge all files.

Is there a workaround to merge test results of multiple test files into 1 launch?

Image 1:
image

Image 2
Screenshot 2023-04-13 at 8 42 14 am

Error merging launches with UUIDs: 0412c9dd-a5e2-44a7-89af-86ae0c20a138,9f6551fc-da47-46fc-8ae5-b947d0f9a2dd,a158ebaa-9230-4615-acde-94cfb01d64e1,ee254715-b564-4401-a800-3128aeca3a81 Error: Request failed with status code 406: {"errorCode":4063,"message":"Unable to perform operation for non-finished launch. Cannot merge launch '34' with status 'IN_PROGRESS'"}
URL: https://demo.reportportal.io/api/v1/personal_demo/launch/merge
method: POST
Request data: {"launches":[34,35,36,37],"mergeType":"BASIC","description":"Merged launch","mode":"DEFAULT","name":"Salesforce Automation Test","endTime":1681338924480,"extendSuitesDescription":true}
    at /Users/tester/demo-test/node_modules/@reportportal/client-javascript/lib/rest.js:41:15
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.onComplete (/Users/tester/wdio.conf.ts:395:9)
    at async /Users/tester/node_modules/@wdio/cli/build/utils.js:99:13
    at async Promise.all (index 0)
    at async Launcher.run (/Users/tester/node_modules/@wdio/cli/build/launcher.js:96:39)

Launches left IN_PROGRESS and break merge

I'm seeing an intermittent issue where merges are failing because one launch is apparently left open.

Error: Request failed with status code 406: {"errorCode":4063,"message":"Unable to perform operation for non-finished launch. Cannot merge launch '827' with status 'IN_PROGRESS'"}
URL: https://reportportal-api.jabraenhance.com/api/v1/JE_WEB/launch/merge
method: POST
    at /Users/myuser/git/dev-bundle/web/test/node_modules/@reportportal/client-javascript/lib/rest.js:41:15
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.onComplete (/Users/myuser/git/dev-bundle/web/test/configs/wdio.shared.conf.js:187:9)
    at async file:///Users/myuser/git/dev-bundle/web/test/node_modules/@wdio/cli/build/utils.js:101:13
    at async Promise.all (index 0)
    at async Launcher.run (file:///Users/myuser/git/dev-bundle/web/test/node_modules/@wdio/cli/build/launcher.js:111:39)
    at async Module.run (file:///Users/myuser/git/dev-bundle/web/test/node_modules/@wdio/cli/build/run.js:64:20)
Launches successfully merged!

I tried adding an explicit wait in case there was a race condition and it was trying to merge before the API had closed the last launch, but that doesn't help.

Using the debugger, I'm unable to reproduce it.

Can't report steps as logs

I have tried to set cucumberNestedSteps to true and run the test. And I got the following errors

yarn clean & wdio run ./config/wdio.local.conf.ts --suite e2e

I use the latest version of the lib "@reportportal/agent-js-webdriverio": "^5.0.2",.

[0-0] Error: Request failed with status code 400: {"errorCode":40019,"message":"Test item status is ambiguous. There is no status provided from request and there are no descendants to check statistics for test item id '1140'"}
[0-0] at /node_modules/@reportportal/client-javascript/lib/rest.js:37:15
[0-0] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[0-0] Error: Request failed with status code 400: {"errorCode":40019,"message":"Test item status is ambiguous. There is no status provided from request and there are no descendants to check statistics for test item id '1140'"}
[0-0] at /node_modules/@reportportal/client-javascript/lib/rest.js:37:15
[0-0] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[0-0] Error: Request failed with status code 400: {"errorCode":40019,"message":"Test item status is ambiguous. There is no status provided from request and there are no descendants to check statistics for test item id '1140'"}
[0-0] at /node_modules/@reportportal/client-javascript/lib/rest.js:37:15
[0-0] at processTicksAndRejections (node:internal/process/task_queues:96:5)

Any ideas? I want to aggregate test results per run instead of per spec. Right now, the report portal can only collect results per spec.

Tests are not being grouped with rerun disabled

Hi There,

When executing several test files with rerun disabled each, an execution is generated for each file. In this case I believe they should be together because the launchName is the same for everyone.

Get link for merged launches

I've been struggling with this all day trying to patch this on my own but I believe this might need changes beyond just the agent and client.

When I run client.mergeLaunches(), there is no way for me to get the link or even the ID of that new launch. This is really frustrating and basically defeats the purpose of tracking the links at all.

It would be great if mergeLaunches could return the link, id, or both.

Edit:
I previously had an implementation which leveraged the ReRun functionality. I would use startLaunch, note the id, run tests in ReRun mode, then finish the tests. This worked well and I had to revert to it in the meantime.

Allow adding browser parameters to test

On the "Item Details" page for a test, there is a section named "Parameters" which is for the browser parameters. However, nothing ever appears there. It would be a great addition if we could manually add browser parameters to tests like we can for logs and attachments with a method like addParameter(key, value).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.