-
-
Notifications
You must be signed in to change notification settings - Fork 737
/
Copy pathwithin_test.js
117 lines (104 loc) · 3.68 KB
/
within_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Feature('within', { retries: 3 });
Scenario('within on form @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
I.amOnPage('/form/bug1467');
I.see('TEST TEST');
within({ css: '[name=form2]' }, async () => {
await I.checkOption('Yes');
await I.seeCheckboxIsChecked({ css: 'input[name=first_test_radio]' });
});
I.seeCheckboxIsChecked({ css: 'form[name=form2] input[name=first_test_radio]' });
I.dontSeeCheckboxIsChecked({ css: 'form[name=form1] input[name=first_test_radio]' });
});
Scenario('switch iframe manually @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
I.amOnPage('/iframe');
I.switchTo('iframe');
I.fillField('rus', 'Updated');
I.click('Sign in!');
I.waitForText('Email Address');
I.switchTo();
I.see('Iframe test');
I.dontSee('Email Address');
});
Scenario('within on iframe @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
I.amOnPage('/iframe');
within({ frame: 'iframe' }, async () => {
await I.fillField('rus', 'Updated');
await I.click('Sign in!');
await I.waitForText('Email Address');
});
I.see('Iframe test');
I.dontSee('Email Address');
});
Scenario('within on iframe without iframe navigation @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
I.amOnPage('/iframe');
within({ frame: 'iframe' }, async () => {
await I.fillField('rus', 'Updated');
await I.see('Sign in!');
});
I.see('Iframe test');
I.dontSee('Sign in!');
});
Scenario('within on nested iframe without iframe navigation depth 2 @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
I.amOnPage('/iframe_nested');
within({ frame: ['[name=wrapper]', '[name=content]'] }, () => {
I.fillField('rus', 'Updated');
I.see('Sign in!');
});
I.see('Nested Iframe test');
I.dontSee('Sign in!');
});
Scenario('within on nested iframe depth 1 @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
I.amOnPage('/iframe');
within({ frame: ['[name=content]'] }, () => {
I.fillField('rus', 'Updated');
I.click('Sign in!');
I.waitForText('Email Address');
});
I.see('Iframe test');
I.dontSee('Email Address');
});
Scenario('within on nested iframe depth 2 @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
I.amOnPage('/iframe_nested');
within({ frame: ['[name=wrapper]', '[name=content]'] }, () => {
I.fillField('rus', 'Updated');
I.click('Sign in!');
I.see('Email Address');
});
I.see('Nested Iframe test');
I.dontSee('Email Address');
});
Scenario('within on nested iframe depth 2 and mixed id and xpath selector @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
I.amOnPage('/iframe_nested');
within({ frame: ['#wrapperId', '[name=content]'] }, () => {
I.fillField('rus', 'Updated');
I.click('Sign in!');
I.see('Email Address');
});
I.see('Nested Iframe test');
I.dontSee('Email Address');
});
Scenario('within on nested iframe depth 2 and mixed class and xpath selector @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
I.amOnPage('/iframe_nested');
within({ frame: ['.wrapperClass', '[name=content]'] }, () => {
I.fillField('rus', 'Updated');
I.click('Sign in!');
I.see('Email Address');
});
I.see('Nested Iframe test');
I.dontSee('Email Address');
});
Scenario('should throw exception if element not found @WebDriverIO @Puppeteer @Playwright', async ({ I }) => {
I.amOnPage('/form/textarea');
within('#grab-multiple', async () => {
return I.grabTextFrom('#first-link');
});
}).throws(/found/);
Scenario('should return a value @WebDriverIO @Puppeteer @Playwright', async ({ I }) => {
I.amOnPage('/info');
const val = await within('#grab-multiple', () => {
return I.grabTextFrom('#first-link');
});
I.fillField('rus', val);
I.pressKey('Enter');
I.see('[rus] => First');
}).retry(0);