11package io .udash .web .guide .demos .frontend
22
3+ import com .avsystem .commons .*
34import io .udash .web .SeleniumTest
45import org .openqa .selenium .By .{ByClassName , ByCssSelector , ByTagName }
5- import org .openqa .selenium .{By , Keys }
66
7- import com .avsystem .commons ._
87import scala .util .Random
98
109class FrontendFormsTest extends SeleniumTest {
@@ -23,7 +22,7 @@ class FrontendFormsTest extends SeleniumTest {
2322 el.getText == expect
2423 }) should be(true )
2524 checkboxes.findElements(new ByClassName (s " checkbox-demo- $propertyName" )).asScala.forall(el => {
26- el.getAttribute (" selected" ) == checkbox.getAttribute (" selected" )
25+ el.getDomAttribute (" selected" ) == checkbox.getDomAttribute (" selected" )
2726 }) should be(true )
2827 }
2928 }
@@ -47,10 +46,10 @@ class FrontendFormsTest extends SeleniumTest {
4746 eventually {
4847 checkButtons.findElements(new ByClassName (" check-buttons-demo-fruits" )).asScala.forall(el => {
4948 val contains = el.getText.contains(propertyName)
50- if (checkbox.getAttribute (" selected" ) != null ) contains else ! contains
49+ if (checkbox.getDomAttribute (" selected" ) != null ) contains else ! contains
5150 }) should be(true )
5251 checkButtons.findElements(new ByCssSelector (s " [data-label= $propertyName] " )).asScala.forall(el => {
53- el.findElement(new ByTagName (" input" )).getAttribute (" selected" ) == checkbox.getAttribute (" selected" )
52+ el.findElement(new ByTagName (" input" )).getDomAttribute (" selected" ) == checkbox.getDomAttribute (" selected" )
5453 }) should be(true )
5554 }
5655 }
@@ -70,10 +69,10 @@ class FrontendFormsTest extends SeleniumTest {
7069 eventually {
7170 multiSelect.findElements(new ByClassName (" multi-select-demo-fruits" )).asScala.forall(el => {
7271 val contains = el.getText.contains(propertyName)
73- if (option.getAttribute (" selected" ) != null ) contains else ! contains
72+ if (option.getDomAttribute (" selected" ) != null ) contains else ! contains
7473 }) should be(true )
7574 multiSelect.findElements(new ByTagName (" select" )).asScala.forall(el => {
76- el.findElement(new ByCssSelector (s " [value=' $propertyIdx'] " )).getAttribute (" selected" ) == option.getAttribute (" selected" )
75+ el.findElement(new ByCssSelector (s " [value=' $propertyIdx'] " )).getDomAttribute (" selected" ) == option.getDomAttribute (" selected" )
7776 }) should be(true )
7877 }
7978 }
@@ -96,8 +95,8 @@ class FrontendFormsTest extends SeleniumTest {
9695 el.getText == propertyName
9796 }) should be(true )
9897 radioButtons.findElements(new ByCssSelector (s " input " )).asScala.forall(el => {
99- val eq = el.getAttribute (" selected" ) == radio.getAttribute (" selected" )
100- if (el.getAttribute (" value" ).toInt == propertyIdx) eq else ! eq
98+ val eq = el.getDomAttribute (" selected" ) == radio.getDomAttribute (" selected" )
99+ if (el.getDomAttribute (" value" ).toInt == propertyIdx) eq else ! eq
101100 }) should be(true )
102101 }
103102 }
@@ -121,7 +120,7 @@ class FrontendFormsTest extends SeleniumTest {
121120 el.getText == propertyName
122121 }) should be(true )
123122 selectDemo.findElements(new ByTagName (s " select " )).asScala.forall(el => {
124- el.findElement(new ByCssSelector (s " [value=' $propertyIdx'] " )).getAttribute (" selected" ) == option.getAttribute (" selected" )
123+ el.findElement(new ByCssSelector (s " [value=' $propertyIdx'] " )).getDomAttribute (" selected" ) == option.getDomAttribute (" selected" )
125124 }) should be(true )
126125 }
127126 }
@@ -142,7 +141,7 @@ class FrontendFormsTest extends SeleniumTest {
142141 textArea.sendKeys(text)
143142 eventually {
144143 textAreaDemo.findElements(new ByTagName (s " textarea " )).asScala.forall(el => {
145- el.getAttribute (" value" ) == text
144+ el.getDomAttribute (" value" ) == text
146145 }) should be(true )
147146 }
148147 }
@@ -161,7 +160,7 @@ class FrontendFormsTest extends SeleniumTest {
161160 input.sendKeys(text)
162161 eventually {
163162 inputsDemo.findElements(new ByCssSelector (s " input[type= $tpe] " )).asScala.forall(el => {
164- el.getAttribute (" value" ) == text
163+ el.getDomAttribute (" value" ) == text
165164 }) should be(true )
166165 }
167166 }
0 commit comments