Skip to content

Commit e2c41cb

Browse files
author
Dumitru Deveatii
committed
feat: add step to switch frame
1 parent b91efd8 commit e2c41cb

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/steps/when.ts

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { selectOptionByIndex } from '../support/action/selectOptionByIndex';
1515
import { setCookie } from '../support/action/setCookie';
1616
import { setInputField } from '../support/action/setInputField';
1717
import { setPromptText } from '../support/action/setPromptText';
18+
import { switchToFrame } from '../support/action/switchToIframe';
1819

1920
When(
2021
/^I (click|doubleclick) on the (link|button|element) "([^"]*)?"$/,
@@ -95,3 +96,9 @@ When(
9596
/^I move to element "([^"]*)?"(?: with an offset of (\d+),(\d+))*$/,
9697
moveTo,
9798
);
99+
100+
101+
When(
102+
/^I switch to iframe "([^"]*)?"$/,
103+
switchToFrame,
104+
);

src/support/action/switchToIframe.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function switchToFrame(selector: string) {
2+
browser.switchToFrame($(selector));
3+
}

src/support/check/checkEqualsText.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { expect } from 'chai';
2+
13
/**
24
* Check if the given elements text is the same as the given text
35
* @param {String} elementType Element type (element or button)
@@ -31,11 +33,11 @@ export function checkEqualsText(elementType: string, selector: string, falseCase
3133
boolFalseCase = true;
3234
}
3335

34-
const text = browser[command](selector);
36+
const text = $(selector)[command]();
3537

3638
if (boolFalseCase) {
37-
parsedExpectedText.should.not.equal(text);
39+
expect(parsedExpectedText).to.not.equal(text);
3840
} else {
39-
parsedExpectedText.should.equal(text);
41+
expect(parsedExpectedText).to.equal(text);
4042
}
4143
}

0 commit comments

Comments
 (0)