We are moving our applications to responsive UI [C#]. Please suggest how best to use automated testing tools [Selenium] on a responsive UI.
Asked
Active
Viewed 607 times
1 Answers
-2
I would personally consider each breakpoint a unique site within selenium.
You can set the window size using something similar to the following;
In either your base class or at the top set the various sizes you wish to test (that way if they change you need only update one place)
Dimension expectedWindowSizeMobile = new Dimension(600, 500);
Dimension expectedWindowSizeTablet = new Dimension(1024, 768);
Dimension expectedWindowSizeDesktop = new Dimension(1288, 988);
Then within your individual tests set it appropriately for example,
Test 1
driver.manage().window().setSize(expectedWindowSizeTablet)
driver.findElement(By.id("TabletMainImage")).isDisplayed()
Test 2
driver.manage().window().setSize(expectedWindowSizeMobile)
driver.findElement(By.id("MobileMainImage")).isDisplayed()
So you can have a set of tests run at each size point checking for the presence of the appropriate elements.
ECiurleo
- 2,043
- 1
- 16
- 45
-
How is this an answer ?The OP's question is directed towards suggesting tools and not towards an specific issue with code. – demouser123 Oct 28 '15 at 12:23
-
its a means of accomplishing the task via selenium (the tool suggested in the question). You already added a comment on the question saying you are "not sure what you're asking" so how can you also say my response is wrong? – ECiurleo Oct 28 '15 at 12:46