Skip to content

Commit bca48da

Browse files
Merge pull request #17 from mrnjii/letcode-frame
frame scenario
2 parents 825040f + def7c37 commit bca48da

File tree

8 files changed

+85
-8
lines changed

8 files changed

+85
-8
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"button": "env-cmd wdio run ./wdio.conf.ts --cucumberOpts.tagExpression='@button'",
2323
"dropdown": "env-cmd wdio run ./wdio.conf.ts --cucumberOpts.tagExpression='@dropdown'",
2424
"alert": "env-cmd wdio run ./wdio.conf.ts --cucumberOpts.tagExpression='@alert'",
25+
"frame": "env-cmd wdio run ./wdio.conf.ts --cucumberOpts.tagExpression='@frame'",
2526
"sampletag": "env-cmd wdio run ./wdio.conf.ts --cucumberOpts.tagExpression='@sampletag'",
2627
"test-typescript": "env-cmd npx ts-node typescript-test.ts"
2728
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Feature: Letcode Frame Page
2+
3+
@regression @frame
4+
Scenario Outline: As a user, I can input full name and email in the text field
5+
6+
Given I am on letcode workspace page
7+
When I click frame page
8+
And I go to frame and input first name <firstName> and last name <lastName> in the text field
9+
And The frame full name should be combination of <firstName> and <lastName>
10+
Then I should be able to input email: <email> in the inner html
11+
12+
Examples:
13+
| firstName | lastName | email |
14+
| Jimuel Renzo | Medrano | test@email.com |

wdio-test/features/input-features/input.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Feature: Letcode Input Page
44
Scenario Outline: As a user, I can input full name in the text field
55

66
Given I am on letcode workspace page
7-
When I click input edit button
7+
When I click input page
88
And I input first name <firstName> and last name <lastName> in the text field
99
Then The first input field text should be equal to the combination of <firstName> and <lastName>
1010

@@ -16,7 +16,7 @@ Feature: Letcode Input Page
1616
Scenario Outline: As a user, I can append text in the field and press tab
1717

1818
Given I am on letcode workspace page
19-
When I click input edit button
19+
When I click input page
2020
And I append the text: `<append>` inside the input field and press tab
2121
Then The second input field text should include the appended text: `<append>`
2222

@@ -28,7 +28,7 @@ Feature: Letcode Input Page
2828
Scenario Outline: As a user, I can verify the text inside the input field
2929

3030
Given I am on letcode workspace page
31-
When I click input edit button
31+
When I click input page
3232
Then The third input field text should include the text: `<text>`
3333

3434
Examples:
@@ -39,7 +39,7 @@ Feature: Letcode Input Page
3939
Scenario Outline: As a user, I can clear the text inside the input field
4040

4141
Given I am on letcode workspace page
42-
When I click input edit button
42+
When I click input page
4343
And I clear the text of the fourth input field
4444
Then The fourth input field text should be blank after clearing the value
4545

@@ -51,7 +51,7 @@ Feature: Letcode Input Page
5151
Scenario Outline: As a user, I can verify that the input field is disabled
5252

5353
Given I am on letcode workspace page
54-
When I click input edit button
54+
When I click input page
5555
Then The fifth input field text should be disabled
5656

5757
Examples:
@@ -62,7 +62,7 @@ Feature: Letcode Input Page
6262
Scenario Outline: As a user, I can verify that the input field is read only
6363

6464
Given I am on letcode workspace page
65-
When I click input edit button
65+
When I click input page
6666
Then The sixth input field text should be read only
6767

6868
Examples:
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import Page from '../page.js';
2+
3+
class FramePage extends Page {
4+
5+
get firstNameInput(){ return $(`//input[@name='fname']`) };
6+
get lastNameInput(){ return $(`//input[@name='lname']`) };
7+
get contentFrame(){ return $(`//iframe[@id='firstFr']`) };
8+
get innerFrame(){ return $(`//iframe[@src='innerFrame']`) };
9+
get fullNameMessage(){ return $(`//p[@class='title has-text-info']`) };
10+
get emailInput(){ return $(`//input[@name='email']`) };
11+
12+
//1. input full name and email
13+
async inputFullName(firstName,lastName){
14+
const elmContentFrame = await this.contentFrame;
15+
await browser.switchToFrame(elmContentFrame);
16+
const elmFirstNameInput = await this.firstNameInput;
17+
const elmLastNameInput = await this.lastNameInput;
18+
await this.inputText(elmFirstNameInput,firstName);
19+
await this.inputText(elmLastNameInput,lastName);
20+
await browser.pause(1000);
21+
}
22+
23+
async checkFrameMessage(firstName,lastName){
24+
const elmFullNameMessage = await this.fullNameMessage;
25+
const fullName = firstName + ' ' + lastName
26+
await expect(elmFullNameMessage).toHaveTextContaining(fullName);
27+
}
28+
29+
async inputEmail(email){
30+
const elmInnerFrame = await this.innerFrame;
31+
await browser.switchToFrame(elmInnerFrame);
32+
const elmEmailInput = await this.emailInput;
33+
await this.inputText(elmEmailInput,email);
34+
await browser.pause(2000)
35+
}
36+
37+
}
38+
39+
export default new FramePage();

wdio-test/page-objects/letcode-workspace.page.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class LetcodeWorkspace extends Page {
66
get buttonPageButton(){ return $(`//a[normalize-space()='Click']`) };
77
get dropdownPageButton(){ return $(`//a[normalize-space()='Drop-Down']`) };
88
get alertPageButton(){ return $(`//a[normalize-space()='Dialog']`) };
9+
get framePageButton(){ return $(`//a[normalize-space()='Inner HTML']`) };
910

1011
async openWorkspacePage () {
1112
await this.open('/test');
@@ -30,6 +31,11 @@ class LetcodeWorkspace extends Page {
3031
const elmAlertPageButton = await this.alertPageButton;
3132
await this.click(elmAlertPageButton);
3233
}
34+
35+
async clickFramePage(){
36+
const elmFramePageButton = await this.framePageButton;
37+
await this.click(elmFramePageButton);
38+
}
3339
}
3440

3541
export default new LetcodeWorkspace();

wdio-test/page-objects/page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default class Page {
3434

3535
async inputText(element: WebdriverIO.Element, text: string){
3636
//wait for the element to be clickable before interacting
37-
await element.waitForClickable({timeout: parseInt(this.elmTimeout)});
37+
await element.waitForDisplayed({timeout: parseInt(this.elmTimeout)});
3838
await element.setValue(text);
3939
}
4040

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Given, When, Then } from '@wdio/cucumber-framework';
2+
import FramePage from '../../page-objects/frame-pages/frame.page.js';
3+
4+
When(/^I go to frame and input first name (.*) and last name (.*) in the text field$/, async (firstName,lastName) => {
5+
await FramePage.inputFullName(firstName,lastName);
6+
});
7+
8+
When(/^The frame full name should be combination of (.*) and (.*)$/, async (firstName,lastName) => {
9+
await FramePage.checkFrameMessage(firstName,lastName);
10+
});
11+
12+
Then(/^I should be able to input email: (.*) in the inner html$/, async (email) => {
13+
await FramePage.inputEmail(email);
14+
});

wdio-test/step-definitions/letcode-workspace.step.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Given(/^I am on letcode workspace page$/, async () => {
55
await LetcodeWorkspacePage.openWorkspacePage();
66
});
77

8-
When(/^I click input edit button$/, async () => {
8+
When(/^I click input page$/, async () => {
99
await LetcodeWorkspacePage.clickInputEditButton();
1010
});
1111

@@ -21,3 +21,6 @@ When(/^I click alert page$/, async () => {
2121
await LetcodeWorkspacePage.clickAlertPage();
2222
});
2323

24+
When(/^I click frame page$/, async () => {
25+
await LetcodeWorkspacePage.clickFramePage();
26+
});

0 commit comments

Comments
 (0)