I am using Cucumber JS and I want to print logs (console logs or any type of log) on the report as well. Is there any way to achieve this?
Related
I am trying to create a custom dashboard on the angular app I am building. I want to use the data from Google Analytics 4 using Google Analytics Data API. I've successfully ran the scripts provided in their tutorial Using Node.JS client libraries (https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries?hl=en_US).
I've ran the quickstart script they have provided using Node.JS and was able to get the expected response. However, when I try to ran the same script on my angular app via importing the script to fetch returned values, "ng serve" returns webpack 5 errors.
The issue was importing the BetaAnalyticsDataClient. Whenever I import it, the nodemon returns webpack errors.
The structure is like this:
simple component structure
I have a 'site-statistics.component' with its html and scss files.
I have a script named 'google-analytics.ts' inside the subfolder "services".
site-statistics.component imports an exported function from google-analytics.ts
If the issue is my usage of the Google Analytics Data API client library, I want to know how I would be able get the response from the script and send it to my angular component.
Options I've tried, but failed:
Tried adding a resolve.fallback on webpack.config.ts. However, issue still persists.
Tried setting paths to each packages on my TSCONFIG.JSON.
Tried using react-scripts-rewired
If the issue is the way I use the Google Analytics Data API client library, I want to know how I would be able get the response from the script and send it to my angular component.
I've looked at the work done with jest-circus and the new Reporter handler: onTestCaseResult but it doesn't give me what I need. I want to capture the console logging for each test case to allow for better analysis of errors when running large test suites against other people's API implementations. At present the console logs are only available on the TestResult object in the onTestResult handler but I would need it in the TestCaseResult object.
Thanks
I am writing automation using Nightwatch node js. I have a test for uploading a file in my application and testing it locally works perfectly. However, when I test it using BrowserStack, BrowserStack cannot access the file in my local machine.
I have also tried setting FileDetector but it gives error saying setFileDetector is not a function on browser object.
I know this function is available for selenium driver object but I am javascript browser object for writing test scripts.
browser.setFileDetector(new remote.FileDetector());
I see that you want to perform the File Upload Operation for a file available on your local machine. You can review the link: https://www.browserstack.com/automate/node#enhancements-uploads-downloads for more details.
I've been looking around at somehow disabling console.log in my application while running unit tests, and I found answers that say you can override the console.log like this:
console.log = function(){};
I tried putting this in app.js, and it overrides console.log when I'm running the app, but not when running unit tests, so I tried adding it the to test file, but then it overrides mocha / chai's console.log, and I get a blank screen.
Is there a way to override the console.log in all files except the one running?
What you would probably want to do instead is use a logging library like Loggly or Bunyan. With these you pass the message you want to log to the client and then you can output those logs based on the environment you are in. In your case you want to log during production but not during testing (kindof odd, but whatever). So you would set process.NODE_ENV to dev or prod accordingly and the logger would take care of the logging for you. Here's an overview of some loggers.
I can use the following code to attach a log file to my Gallio 3.2 acceptance test report:
TestLog.AttachPlainText("Attached log file", File.ReadAllText(path));
When I run my tests locally I can see the log file contents by viewing the report in my web browser. So, I want to be able to view the attachments in CCNET. I have my CCNET project running MsBuild, which produces the test log (Regression.Acceptance.tests.xml) and attachments (which are arranged in the folder Regression.Acceptance.tests). I can see that these exist after CCNET runs the build.
I have added the following to merge the results and attached files into my build log:
<merge>
<files>
<file>Source\Reports\Regression.Acceptance.tests.xml</file>
<file action="Copy">Source\Reports\Regression.Acceptance.tests</file>
</files>
</merge>
If I look at the CCNET server log I see the following line where it merges in the test results:
2010-05-26 13:39:36,359 [DashboardAcceptanceTests:INFO] Merging file 'Regression.Acceptance.tests.xml'
But there is no mention of the attachments folder, and if I look in the artefacts folder I can see the merged build log but there is no folder with the attachments, and I get the following error when I try to browse to an attached file in the report via the web dashboard:
Exception Message
The attachment was not inlined into the XML report.
Exception Full Details
System.InvalidOperationException: The attachment was not inlined into the XML report.
at CCNet.Gallio.WebDashboard.Plugin.GallioAttachmentBuildAction.CreateResponseFromAttachment(XPathNavigator attachmentNavigator)
at CCNet.Gallio.WebDashboard.Plugin.GallioAttachmentBuildAction.Execute(ICruiseRequest cruiseRequest)
at ThoughtWorks.CruiseControl.WebDashboard.MVC.Cruise.ServerCheckingProxyAction.Execute(ICruiseRequest cruiseRequest)
at ThoughtWorks.CruiseControl.WebDashboard.MVC.Cruise.BuildCheckingProxyAction.Execute(ICruiseRequest cruiseRequest)
at ThoughtWorks.CruiseControl.WebDashboard.MVC.Cruise.ProjectCheckingProxyAction.Execute(ICruiseRequest cruiseRequest)
at ThoughtWorks.CruiseControl.WebDashboard.MVC.Cruise.CruiseActionProxyAction.Execute(IRequest request)
at ThoughtWorks.CruiseControl.WebDashboard.MVC.Cruise.CachingActionProxy.Execute(IRequest request)
at ThoughtWorks.CruiseControl.WebDashboard.MVC.Cruise.ExceptionCatchingActionProxy.Execute(IRequest request)
I get similar results when I try to embed the file instead with:
TestLog.EmbedPlainText("Embedded log file", File.ReadAllText(path));
Is it possible to get this working? As I understand it, the directory structure within the Regression.Acceptance.tests folder needs to be preserved when copied by the merge task, but the documentation is a little vague and I haven't got it to do anything yet!