@@ -1894,4 +1894,81 @@ export function tests() {
18941894 await I . see ( 'Software Engineer' )
18951895 } )
18961896 } )
1897+
1898+ describe ( 'aria selectors without role locators' , ( ) => {
1899+ it ( 'should find clickable elements by aria-label' , async ( ) => {
1900+ await I . amOnPage ( '/form/role_elements' )
1901+
1902+ await I . click ( 'Reset' )
1903+ await I . dontSeeInField ( 'Title' , 'Test' )
1904+
1905+ await I . click ( 'Submit Form' )
1906+ await I . see ( 'Form Submitted!' )
1907+ } )
1908+
1909+ it ( 'should click elements by aria-label' , async ( ) => {
1910+ await I . amOnPage ( '/form/role_elements' )
1911+
1912+ await I . fillField ( 'Title' , 'Test Title' )
1913+ await I . fillField ( 'Name' , 'John Doe' )
1914+
1915+ await I . click ( 'Submit Form' )
1916+ await I . see ( 'Form Submitted!' )
1917+ await I . see ( 'Test Title' )
1918+ await I . see ( 'John Doe' )
1919+ } )
1920+
1921+ it ( 'should fill fields by aria-label without specifying role' , async ( ) => {
1922+ await I . amOnPage ( '/form/role_elements' )
1923+
1924+ await I . fillField ( 'Title' , 'Senior Developer' )
1925+ await I . seeInField ( 'Title' , 'Senior Developer' )
1926+
1927+ await I . fillField ( 'Name' , 'Jane Smith' )
1928+ await I . seeInField ( 'Name' , 'Jane Smith' )
1929+
1930+ await I . fillField ( 'Category' , 'Engineering' )
1931+ await I . seeInField ( 'Category' , 'Engineering' )
1932+
1933+ await I . fillField ( 'your@email.com' , 'test@example.com' )
1934+ await I . seeInField ( 'your@email.com' , 'test@example.com' )
1935+
1936+ await I . fillField ( 'Enter your message' , 'Hello World' )
1937+ await I . seeInField ( 'Enter your message' , 'Hello World' )
1938+ } )
1939+
1940+ it ( 'should check options by aria-label' , async ( ) => {
1941+ if ( ! isHelper ( 'WebDriver' ) ) return
1942+
1943+ await I . amOnPage ( '/form/role_elements' )
1944+
1945+ await I . dontSeeCheckboxIsChecked ( 'I agree to the terms and conditions' )
1946+ await I . checkOption ( 'I agree to the terms and conditions' )
1947+ await I . seeCheckboxIsChecked ( 'I agree to the terms and conditions' )
1948+
1949+ await I . dontSeeCheckboxIsChecked ( 'Subscribe to newsletter' )
1950+ await I . checkOption ( 'Subscribe to newsletter' )
1951+ await I . seeCheckboxIsChecked ( 'Subscribe to newsletter' )
1952+ } )
1953+
1954+ it ( 'should interact with multiple elements using aria-label' , async ( ) => {
1955+ await I . amOnPage ( '/form/role_elements' )
1956+
1957+ await I . fillField ( 'Title' , 'Product Manager' )
1958+ await I . fillField ( 'Name' , 'Bob Johnson' )
1959+ await I . fillField ( 'Category' , 'Product' )
1960+ await I . fillField ( 'your@email.com' , 'bob@company.com' )
1961+ await I . fillField ( 'Enter your message' , 'Test message' )
1962+
1963+ if ( isHelper ( 'WebDriver' ) ) {
1964+ await I . checkOption ( 'Subscribe to newsletter' )
1965+ }
1966+
1967+ await I . click ( 'Submit Form' )
1968+ await I . see ( 'Form Submitted!' )
1969+ await I . see ( 'Product Manager' )
1970+ await I . see ( 'Bob Johnson' )
1971+ await I . see ( 'Product' )
1972+ } )
1973+ } )
18971974}
0 commit comments