Can Background in Cypress be used to only run with certain "Tags" set on each Scenario - cypress

So I have a Cypress Automation that we recently refactored to use Background at the top of each feature file so that it is called with each Scenario.
However, now we need only certain tests in the scenario to utilize the Background Event at the top.
I've been reviewing Cypress documentation and cannot see if this is possible but can the Cypress Background event be limited to only certain Tags used for a scenario (i.e. #NormalLoad, #HighLoad, etc.)
Currently using Cypress/Cucumber with Gherkin design.

Instead of using the Background statement, which would run in every scenario of this feature, I propose you to run a Before targeting a tag at the feature, and the script would be doing the same as Background. The main difference between background and Before is that you can run the Before on any feature that have the appropriate tag.

Related

Test GrapesJs Editor With Cypress

We are using grapesjs to create an application editor. We want to validate that all the components we create can be used in Grapesjs. To do it, we want to write e2e tests using UI to simulate a final user. I'm using Cypress for automation but didn't have any luck dropping block inside the grapes iframe. Any help regarding this would be highly appreciated.
Me and my coworker tryied for 2 weeks, both Cypress and the rest of the tools on the market couldn't drag and drop a block of GrapesJs inside it's iframe :/
You can follow the issue from GrapesJs: https://github.com/artf/grapesjs/issues/3721
And a discussion i opened in Cypress's repo:
https://github.com/cypress-io/cypress/discussions/17979
Last month, i find this option, but i didn't try to set it as false on grapesjs.init, can you test it?
https://github.com/artf/grapesjs/blob/dev/src/editor/config/config.js#L111

Cypress does not support multi window and multiple tabs so how we can handle both

I am trying to automate a website using cypress and I came across a problem where in I have to handle below tag. On click, new window gets opened which gets displayed out of the test runner.
a href="javascript:ContextTradeMenuPopup('View/Edit Trade')">View/Edit
Trade /a
I understand Cypress does not support multi window but as a workaround I can get the href tag and copy the URL and can open the URL in same runner, but in the above example there is no URL.
Can anyone help with different ways available in Cypress to handle multi window/ multiple tab behavior.
Thanks!
The work around you mentioned is currently the only work around that is available. So you should retrieve the URL of the new window/tab and visit that directly. If you can't do that you sadly can't automate it.

Jasmine SpecRunner style page for Karma

I am trying to show Jasmine SpecRunner style page using karma-jasmine, karma and gulp plugins but not able to see all the specs listing all of the test that passed on failed. I used karma-jasmine-reporter node module to get a report of the tests that ran but how can I rerun an individual test. I am looking to generate a page like this where I can see the result and rerun individual tests.
I've found that https://www.npmjs.com/package/karma-jasmine-html-reporter the karma-jasmine-html-reporter is the best UI reporter that gets close to the default jasmine html file look.
Your question is old, but it's what I was trying to find myself.
If you found a better solution since posting I'd like to know. One thing that this HTML reporter doesn't do is refresh if you updated the tests.
So if you run 'karma start' then it will run the tests, open your browser then you have to click on the debug button to show the UI reporting of your tests.
Then if you update the tests, the cmd window will refresh to reflect your new tests but the browser window will not. You must refresh it manually. Would be awesome to not have to do that.

Removing a JavaScript comment through commands?

I am currently developing a website that relies heavily on large blocks of javascript for widgets. Some of these are demanding processes, such as running timers or clocks, so I only want these scripts to activate when their corresponding widget is activated. My proposed solution is to comment out each of these blocks of scripts, and "uncomment" them when the widget is active.
For example, if I have a countdown timer widget, I would like to have my code for the widget completely commented out until the user clicks the widget. When the user opens the widget, I would like the corresponding scripts to become "uncommented" and execute.
Is there any way I can programmatically add or remove comment marks to the Javascript code on the fly? I am looking for some method or command I could use; not something that requires me to physically alter the code.
I saw this in a Google I/O Conference Presentation, so I was just wondering if anyone knew how.
There is a better way to go about it. If you're worried about clogging the event loop: make sure widgets don't have access to the event loop but have to go through your framework to get to it. This allows you to 'sleep' a widget, stop all it's events.
Another thing to keep in mind that is that when widgets are removed you must also clean up any events they have scheduled or you will run into 'dead' code. All events must therefor be scheduled through your framework so you can clean them up if the widget is unloaded.
Code is read and loaded into the JavaScript engine, modifying the code after that point will do nothing.

Selenium IDE and telling it to record actions

I am trying to make a little application to allow to record actions within a Flash and Silverlight application. In such manner that you can compile your interactive application in test-mode and then be able to click on elements which then passed the action to Selenium IDE which then adds this command to the testcase.
I am curious if this even possible and how I can achieve this in Firefox?
There is a new plugin for Se-IDE called 'Flex Pilot X' which works with External Actions exposed through Flex Pilot. Adam Christian (who wrote it) demonstrated it at the SFSE meetup last month; which was recorded and viewable at http://saucelabs.com/blog/index.php/2010/04/highlights-from-our-april-20th-selenium-testing-tools-demo-night/
-adam

Resources