Skip to content

Commit 00130a3

Browse files
committed
window change scenario
1 parent fff22a5 commit 00130a3

File tree

12 files changed

+71
-107
lines changed

12 files changed

+71
-107
lines changed

.env.example

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
BASE_URL=https://letcode.in
33
ELM_TIMEOUT=30000
44
HEADLESS=N
5-
DEBUG=Y
6-
TEST_USERNAME=example
7-
TEST_PASSWORD=example
5+
DEBUG=Y

package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"@wdio/cucumber-framework": "^8.3.0",
77
"@wdio/local-runner": "^8.3.5",
88
"@wdio/spec-reporter": "^8.3.0",
9-
"chromedriver": "^111.0.0",
9+
"chromedriver": "^114.0.2",
1010
"env-cmd": "^10.1.0",
1111
"ts-node": "^10.9.1",
1212
"typescript": "^4.9.5",
@@ -24,6 +24,7 @@
2424
"alert": "env-cmd wdio run ./wdio.conf.ts --cucumberOpts.tagExpression='@alert'",
2525
"frame": "env-cmd wdio run ./wdio.conf.ts --cucumberOpts.tagExpression='@frame'",
2626
"radio": "env-cmd wdio run ./wdio.conf.ts --cucumberOpts.tagExpression='@radio'",
27+
"window": "env-cmd wdio run ./wdio.conf.ts --cucumberOpts.tagExpression='@window'",
2728
"sampletag": "env-cmd wdio run ./wdio.conf.ts --cucumberOpts.tagExpression='@sampletag'",
2829
"test-typescript": "env-cmd npx ts-node typescript-test.ts"
2930
}

wdio-test/features/login.feature

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Feature: Letcode Window Page
2+
3+
@regression @window
4+
Scenario Outline: As a user, I can print the title of new window
5+
6+
Given I am on letcode workspace page
7+
When I click window page
8+
And I click open home page button
9+
Then I print the title of new window
10+
11+
Examples:
12+
| |
13+
| |

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class LetcodeWorkspace extends Page {
88
get alertPageButton(){ return $(`//a[normalize-space()='Dialog']`) };
99
get framePageButton(){ return $(`//a[normalize-space()='Inner HTML']`) };
1010
get radioPageButton(){ return $(`//a[normalize-space()='Toggle']`) };
11+
get windowPageButton(){ return $(`//a[normalize-space()='Tabs']`) };
1112

1213
async openWorkspacePage () {
1314
await this.open('/test');
@@ -44,6 +45,12 @@ class LetcodeWorkspace extends Page {
4445
await elmRadioPageButton.scrollIntoView();
4546
await this.click(elmRadioPageButton);
4647
}
48+
49+
async clickWindowPage(){
50+
const elmWindowPageButton = await this.windowPageButton;
51+
await elmWindowPageButton.scrollIntoView();
52+
await this.click(elmWindowPageButton);
53+
}
4754
}
4855

4956
export default new LetcodeWorkspace();

wdio-test/page-objects/login.page.ts

Lines changed: 0 additions & 42 deletions
This file was deleted.

wdio-test/page-objects/secure.page.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import Page from '../page.js';
2+
3+
class WindowPage extends Page {
4+
5+
get openHomeButton(){ return $(`//button[normalize-space()='Open Home Page']`) };
6+
7+
8+
async clickOpenHomeButton(){
9+
const elmOpenHomeButton = await this.openHomeButton;
10+
await this.click(elmOpenHomeButton);
11+
}
12+
13+
async printNewWindowTitle(){
14+
const handles = await browser.getWindowHandles()
15+
await browser.switchToWindow(handles[0])
16+
console.log('WINDOW HANDLES:')
17+
console.log(await browser.getTitle())
18+
await browser.switchToWindow(handles[1])
19+
console.log(await browser.getTitle())
20+
}
21+
22+
}
23+
24+
export default new WindowPage();

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ When(/^I click frame page$/, async () => {
2828
When(/^I click radio page$/, async () => {
2929
await LetcodeWorkspacePage.clickRadioPage();
3030
});
31+
32+
When(/^I click window page$/, async () => {
33+
await LetcodeWorkspacePage.clickWindowPage();
34+
});

0 commit comments

Comments
 (0)