Skip to content

Commit be43cc6

Browse files
committed
accept terms and conditions scenario
1 parent eba0aad commit be43cc6

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

wdio-test/features/radio-features/radio.feature

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,23 @@ Feature: Letcode Radio Page
6161
| |
6262

6363
@regression @radio
64-
Scenario Outline: As a user, I can verify that last option is disabled
64+
Scenario Outline: As a user, I can verify that checkbox is selected
6565

6666
Given I am on letcode workspace page
6767
When I click radio page
6868
And I verify that checkbox is selected
6969

70+
Examples:
71+
| |
72+
| |
73+
74+
@regression @radio
75+
Scenario Outline: As a user, I can accept the terms and conditions
76+
77+
Given I am on letcode workspace page
78+
When I click radio page
79+
And I click checkbox to accept the terms and conditions
80+
7081
Examples:
7182
| |
7283
| |

wdio-test/page-objects/radio-pages/radio.page.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ class RadioPage extends Page {
88
get radioNoBugOption(){ return $(`//input[@id='nobug']`) };
99
get radioBugOption(){ return $(`//input[@id='bug']`) };
1010
get fooBarOptions(){ return $$(`//input[@name='foobar']`) };
11-
get disabledOptions(){ return $$(`//input[@id='maybe']`) };
12-
get selectedCheckbox(){ return $$(`//input[@id='maybe']`) };
11+
get disabledOptions(){ return $(`//input[@id='maybe']`) };
12+
get selectedCheckbox(){ return $(`//label[normalize-space()='Remember me']//input`) };
13+
get agreeToTerms(){ return $(`//label[contains(text(),'I agree')]//input`) };
1314

1415
//1. select one radio option
1516
async selectFirstRadio(){
@@ -82,8 +83,14 @@ class RadioPage extends Page {
8283

8384
//6. verify selected checkbox
8485
async verifyCheckboxSelected(){
85-
const elmDisabledOptions = await this.disabledOptions;
86-
await expect(elmDisabledOptions).toBeDisabled();
86+
const elmSelectedCheckbox = await this.selectedCheckbox;
87+
await expect(elmSelectedCheckbox).toBeSelected();
88+
}
89+
90+
//7. accept terms and conditions
91+
async checkSelectedCheckbox(){
92+
const elmAgreeToTerms = await this.agreeToTerms;
93+
await this.click(elmAgreeToTerms);
8794
}
8895
}
8996

wdio-test/step-definitions/radio-steps/radio.step.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,10 @@ When(/^I verify that last radio option is disabled$/, async () => {
4848

4949
//6. verify selected checkbox
5050
When(/^I verify that checkbox is selected$/, async () => {
51-
await RadioPage.verifyRadioDisabled();
51+
await RadioPage.verifyCheckboxSelected();
52+
});
53+
54+
//7. accept terms and conditions
55+
When(/^I click checkbox to accept the terms and conditions$/, async () => {
56+
await RadioPage.checkSelectedCheckbox();
5257
});

0 commit comments

Comments
 (0)