File tree 1 file changed +49
-0
lines changed
src/test/java/io/github/mfaisalkhatri/tests 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ package io .github .mfaisalkhatri .tests ;
2
+
3
+ import com .microsoft .playwright .*;
4
+ import org .testng .annotations .AfterClass ;
5
+ import org .testng .annotations .BeforeClass ;
6
+ import org .testng .annotations .Test ;
7
+
8
+ import static com .microsoft .playwright .assertions .PlaywrightAssertions .assertThat ;
9
+
10
+ public class RadioButtonTests {
11
+
12
+ private Playwright playwright ;
13
+ private Page page ;
14
+
15
+
16
+ @ BeforeClass
17
+ public void setup () {
18
+ this .playwright = Playwright .create ();
19
+ final Browser browser = playwright .chromium ().launch (new BrowserType .LaunchOptions ().setHeadless (false ).setChannel ("chrome" ));
20
+ this .page = browser .newPage ();
21
+ }
22
+
23
+ @ Test
24
+ public void testRadioButtonIsChecked () {
25
+ page .navigate ("https://www.lambdatest.com/selenium-playground/radiobutton-demo" );
26
+ Locator maleRadioBtn = page .getByLabel ("Male" ).first ();
27
+ maleRadioBtn .click ();
28
+ assertThat (maleRadioBtn ).isChecked ();
29
+ }
30
+
31
+ @ Test
32
+ public void testRadioButtonIsNotChecked () {
33
+ page .navigate ("https://www.lambdatest.com/selenium-playground/radiobutton-demo" );
34
+ Locator femaleRadioBtn = page .getByLabel ("Female" ).first ();
35
+ femaleRadioBtn .click ();
36
+ assertThat (femaleRadioBtn ).isChecked ();
37
+
38
+ Locator maleRadioBtn = page .getByLabel ("Male" ).first ();
39
+ assertThat (maleRadioBtn ).not ().isChecked ();
40
+ }
41
+
42
+
43
+ @ AfterClass
44
+ public void tearDown () {
45
+ this .page .close ();
46
+ this .playwright .close ();
47
+ }
48
+
49
+ }
You can’t perform that action at this time.
0 commit comments