PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, November 19, 2022

[FIXED] How to click on pseudo-element when testing?

 November 19, 2022     bootstrap-4, capybara, javascript, rspec, togglebutton     No comments   

Issue

I have a switch / toggle element coming from bootstrap. It works perfectly as expected but I'm having trouble when testing the feature because I don't know how I can click on it:

the toggle is handled by the pseudo-elements :before & :after. I tried many pieces of code to simulate the click on it with capybara but I didn't find a way to achieve it...

Here the snippet: https://jsfiddle.net/ynuf96qe/

enter image description here

enter image description here

Anyone has an idea? Thank you!

Sorry for this element, I didn't find a way to bypass the link error from stackoverflow... <div></div>


Solution

I finally found a way out even if I don't like it...

I changed the way the toggle is displayed in test environment: it is a simple checkbox that allows me to click on it through Capybara.

It now works fine but I'm aware that is a hack.



Answered By - raphael-allard
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing