Testing night mode on a website


#1

Hi, I’m trying to write a test to check that our “night mode” button is working properly.

Right now the only change that happens in the code when the button is pressed is that it goes from:

< body id=“ourwebsite” class >

to

< body id=“ourwebsite” class=“darkness” >

I’ve tried using the feature “Verify Text Present” but got the error message “Text ‘darkness’ is not present on page”. Is there another way to test going from day to night mode (and back) that I’m possibly missing?


#2

#3

Have you tried to 'WebUI.getAttribute(objectName,‘class’)?


#4

Try this:

WebUI.verifyElementPresent("Page/Darkness", 5)

And your test object could use this CSS selector:

.darkness