Skip to content

Commit 0088cb2

Browse files
Added bringToFront to switch window steps (#50)
added bringToFront to switch window steps --------- Co-authored-by: Anton Shukanau <anton_shukanau@epam.com>
1 parent 1650c36 commit 0088cb2

File tree

6 files changed

+13
-5
lines changed

6 files changed

+13
-5
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ lib/
33
coverage/
44
test-e2e/report.*
55
.idea/
6-
customDir/
6+
customDir/
7+
dirToStoreTraces/

src/actions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ When('I switch to {int} window', async function (index: number) {
125125
global.page = context.pages()[index - 1];
126126
//@ts-ignore
127127
po.driver = page;
128+
await page.bringToFront();
128129
});
129130

130131
/**
@@ -140,6 +141,7 @@ When('I switch to {string} window', async function (matcher: string) {
140141
global.page = p;
141142
//@ts-ignore
142143
po.driver = p;
144+
await page.bringToFront();
143145
return;
144146
}
145147
}

test-e2e/features/actions.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Feature: actions
9595
When I click 'New Tab Link'
9696
When I wait 1000 ms
9797
When I switch to <param> window
98-
Then I expect current url to be equal '$framePage'
98+
Then I expect current url to contain 'frame.html'
9999
When I expect 'Frame Element' to be visible
100100

101101
Examples:

test-e2e/features/memory.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Feature: memory
2121

2222
Scenario: current url
2323
When I save current url as 'memory'
24-
Then I expect '$memory' memory value to be equal '$valuesPage'
24+
Then I expect '$memory' memory value to contain 'values.html'
2525

2626
Scenario: page title
2727
Then I save page title as 'memory'

test-e2e/features/validations.feature

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ Feature: validations
2929
Then I expect 'name' attribute of 'Simple Text Input' to contain 'textInputName'
3030

3131
Scenario: current url
32-
Then I expect current url to be equal '$valuesPage'
3332
Then I expect current url not to be equal 'https://qavajs.github.io/'
34-
Then I expect current url to be contain 'values'
33+
Then I expect current url to contain 'values'
3534

3635
Scenario: page title
3736
Then I expect page title to be equal '@qavajs'

test-e2e/step-definitions/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ Then('I expect {string} memory value to be equal {string}', async function(actua
1616
const expectedValue = memory.getValue(expected);
1717
expect(expectedValue).to.eql(actualValue);
1818
});
19+
20+
Then('I expect {string} memory value to contain {string}', async function(actual, expected) {
21+
const actualValue = memory.getValue(actual);
22+
const expectedValue = memory.getValue(expected);
23+
expect(actualValue).to.contain(expectedValue);
24+
});

0 commit comments

Comments
 (0)