Giter VIP home page Giter VIP logo

mochawesome-screenshots's People

Contributors

belan97 avatar dependabot[bot] avatar marcbachmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mochawesome-screenshots's Issues

Screenshots are missing when used with nightwatchjs

Hi,

Here are my nightwatch config options for mocha

"test_runner" : {
    "type" : "mocha",
    "options" : {
      "ui" : "bdd",
      "reporter": "mochawesome-screenshots",
      "reporterOptions": {
        "takePassedScreenshot": false,
        "clearOldScreenshots": true,
        "jsonReport": false,
        "multiReport": false,
        "timeout": 600000
      }
    }
}

I am not getting screenshots for the failed test cases, but HTML report is coming properly.
Its even adding screenshot file name in HTML but the screenshots folder is empty.

When I looked into reportGenerator.js I see that browser object is undefined in method saveScreenshotToFile.

Since browser object is undefined its not able to capture screenshots.

Can you please help me on how to solve this problem ?

Screenshots display

Hello,

First, thanks for your work !

I just check your project, and i've some issues with screenshots display.

Context:

  • screenshot generate is OK, files exists,
  • test with takePassedScreenshot set to true (same results with false also, but only second issue appear).
  • node version: v6.3.0
  • project version: 1.4.2
  • I launch protractor into a Gulp task
  • protractor version: "gulp-angular-protractor": "^0.1.4", "gulp-protractor": "^3.0.0",

Issues:

  • For a success test, I've link to click on scresshot, but nothin appears. Here the code arroud the button:
    <p class="test-screenshot"><button class="btn btn-link btn-sm toggle-btn toggle-stack collapsed" data-toggle="collapse" data-target="#7c7a16b9-c156-447b-9afc-aa7db71f2b92 > .test-scr.collapse">Screenshot </button> </p>
  • For a failed test, no screenshot link appears

I've test with firefox, chrome, chormium, same issue.

Thanks

i can't see the passed screenshot

i see the source code ,now it can't show the passed screenshot in the html, also i have already set the "takePassedScreenshot": true

Gulp build not running

gulp build crashing in config line#51, had to comment out the line below to make it work.
config.multiReport = _getOption('multiReport', options);

Display and logging of "before" and "after" hooks.

Currently when i run any mocha script successfully, i am only able to view only the "it" hook of the mocha.
Is there any provision/parameter which needs to be passed in .mocharc.js file to make the "before" and "after" hooks also visible in the report, irrespective of those hooks passing or failing?

Secondly, using, require("mochawesome-screenshots/logReport");
I am able to send log to "it" hook, when i am trying to send any custom log for "before" or "after", it does not get displayed in the report.

Not able to save a screenshot.

Hi,

I am not able to save a screenshot using this mochawesome-sreenshot tool. below is the error I am getting-
Error: Unable to save screenshot
ReferenceError: path is not defined

Though the html report is created successfully but the failing screenshot is not there. Could you please check this and correct it.

conf.js file-

framework: 'mocha',

mochaOpts: {
    grep: util.getGrep(),
    reporter: 'mochawesome-screenshots',
    reporterOptions: {
        reportTitle: util.getTitle(),
        inlineAssets: true            
    },
    timeout: 60000  /* --mochaOpts.timeout*/
}

Thanks & Regards,
Hitesh Gupta

Wrong screenshot captured for remote webdriver

  1. I ran a test in sauce labs, which is particularly slow
  2. The test failed
  3. It triggered the on fail event in mochawesome-screenshots code
  4. This triggered the take screenshot code
  5. BUT, the next test ran before the screenshot was captured
  6. So the screenshot of the next page was captured instead of the previous

I don't think mocha waits for the on fail event to complete before moving on to the next test???

Screenshots are saved with wrong names under CodeceptJS

Context: (CodeceptJS with Protractor execution driver)

  • node version: v6.9.2
  • mochawesome-screenshots version: 1.4.3
  • codeceptjs version: 0.4.13
  • protractor version: 4.0.14
  • it takes screenshots and puts "Show Screenshot" link into html file.

Issue:

  1. Screenshot has name like "<Test_name>.failed.png";
  2. html report img src = "./screenshots/<feature_name>__<test_name>.png"

P.S. There is no issue when I run test by Protractor without CodeceptJS.

mochawesome-screenshots not capturing screenshots

Hi,

Here are my cypress config options for mocha

"reporter": "mochawesome-screenshots",
"reporterOptions": {
"reportTitle": "Report",
"reportPageTitle": "AutomationReport",
"takePassedScreenshot": false,
"clearOldScreenshots": true,
"uniqueScreenshotNames": true

}
I am not getting screenshots for the failed test cases, but HTML report is coming properly.
Its even adding screenshot file name in HTML but the screenshots folder is empty.

Can you please help me on how to solve this problem ?

Not Getting Step wise Report

Hi ,

how do i get step wise report using mochawesome-screenshots.
For Ex: if i have 5 steps in my test method nad it failed at step 5 , then for step 1-4 it should give passed and for step 5 it should give me failed with reason or exception.
Is there any way to use logger.log at global level which logs report for each step .?

Issue when running parallel protractor threads

When running with multiple threads the last one to close seems to always hang. This issue does not happen with mochawesome just with mochawesome-screenshots. To try it out set shardTestFiles: parallel in capabilities in the protractor conf file

No screenshot saved in puppeteer

I am using puppeteer and have set the page variable as a global variable via a global.js file and

page = null;

When running a test I no screenshot image saving to the screenshot folder

Save and Display screenshot every Test

My project requires that I display a screenshot after every test. It'd be nice if there was a way to set that in the parameters. I think if Show Screenshots was displayed before Show Stack, you'd be able to display it for each test regardless of pass/fail

Screenshot names far too long

I'm trying to use this reporter with protractor, Mocha and Yadda, running Gherkin features.

Mochawesome works excellently with this setup, but the screenshot reporter does not, as when creating screenshots it creates the filename by combining the feature title, the scenario title and the step text, creating an enormous filename that is not accessible.

i.e. If I had the Feature

Feature: I want to test a certain aspect of my web application

    Scenario:  When I do some stuff then some other stuff happen that is good

        Given I am using my app
        When I click some buttons or something in the prescribed manner
        Then stuff should happen

if the test fails on the 'When' step of this feature then the generated screenshot name will be:

I_want_to_test_a_certain_aspect_of_my_web_application_When_I_do_some_stuff_then_some_other_stuff_happen_that_is_good_When_I_click_some_buttons_or_something_in_the_prescribed_manner.png

Is there any way to shorten these names, or create custom names? As it stands I can't use this reporter.

One Report for all Browsers

Hola!

I'm working on different browsers, and would prefer that mochawesome would generate one report with the results for the different browsers instead of creating the report for each multiCapability. The report keeps overwriting itself. Maybe a flag such as --combineBrowsers?

Feature Request: Option to capture HTML

When we were using Jasmine framework, a screenshot reporter we used had the option to capture the current HTML of the page. This was useful to be able to view the state of the app in a browser for debugging. We would be able to see attributes and formatting.

Could you add this option and add it to the report as [Open HTML] so that it opens the HTML in a new browser tab/window?

Thanks

Set multiple screenshots plus title

Hi,

Great report. I'd like to add a feature request. I pulled your code down and added a couple of changes. Unlock jasmine framework, mocha only allows one expect() per test. So I needed a way to have multiple screenshots per single failure.

I updated the setScreenshot() function to keep an array of screenshots plus an optional title for each one. So far its been working well. Its still backwards compatible to the way it currently is too. I wasn't able to create a pull request but here's what I changed. Thoughts?

lib/logReport.js

var setScreenshot = function setScreenshot() {

    if ((!arguments[0].test && !arguments[0].ctx) || !arguments[1] || typeof arguments[1] !== 'string') {
        console.log('\n[' + chalk.gray('mochawesome') + '] Error: Invalid arguments.');
        return;
    }

    if (!arguments[2]) {
        arguments[2] = '';
    }

    var test = arguments[0].test ? arguments[0].test: arguments[0];
    if (!test.customScrFileName) {
        test.customScrFileName = [ [ arguments[1], arguments[2] ] ];
    } else {
        test.customScrFileName.push([ arguments[1], arguments[2] ]);
    }
};

lib/mochawesome.js

function cleanTest (test) {

  var err = test.err ? _.pick( test.err, ['name', 'message', 'expected', 'actual', 'stack', 'scr'] ) : test.err,
    scr = '';
    if (test.customScrFileName) {
      test.customScrFileName.forEach(function (fileName) {
        if(fileName[1]) {
          scr += '<p class="test-error-message">' + fileName[1] + '</p>';
        }
        scr += '<img src="./screenshots/' + fileName[0] + '">';
      });
    } else {
      scr = '<img src="./screenshots/' + test.scrFileName + '">';
    }

Screenshots not showing up in report because filenames are too long

I am seeing an issue where my reports don't show the screenshots. When I dug in, it looks like the screenshot names are so long, they are getting truncated by OS X but the report is looking for the full filename.

For example, the source is loading: ./screenshots/48123_create_a_collection_as_a_logged_in_agent_create_collection_ui_tests_asserts_that_invalid_character_values_are_rejected_by_the_ui.png

But the screenshots folder has this file: 48123__regression___agent___boards___collections_create_a_collection_as_a_logged_in_agent_create_collection_ui_tests_asserts_that_inva.png

Also note how the filenames have double underscores around the mocha tags, but the HTML doesn't expect them.

Can we have an option to just have unique numbers as the names of the screenshots?

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.