"Fossies" - the Fresh Open Source Software Archive 
Member "selenium-selenium-4.8.1/javascript/atoms/test/interactable_size_test.html" (17 Feb 2023, 2466 Bytes) of package /linux/www/selenium-selenium-4.8.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) HTML source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>interactable_size_test</title>
5
6 <script src="test_bootstrap.js" type="text/javascript"></script>
7 <script type="text/javascript">
8 goog.require('bot');
9 goog.require('bot.locators');
10 goog.require('bot.userAgent');
11 goog.require('bot.window');
12 goog.require('goog.testing.jsunit');
13 goog.require('goog.userAgent');
14 </script>
15
16 <script type="text/javascript">
17
18 function getSizeOfFrameWithId(id) {
19 var frame = bot.locators.findElement({id: id});
20
21 var win = goog.dom.getFrameContentWindow(frame);
22 return bot.window.getInteractableSize(win);
23 }
24
25 function testShouldReturnViewportSizeIfThatIsLargest() {
26 var size = getSizeOfFrameWithId('set_size');
27
28 assertEquals(110, size.width);
29 assertEquals(100, size.height);
30 }
31
32 function testShouldReturnDocumentSizeIfThatIsGreatestAndInStandardsMode() {
33 var size = getSizeOfFrameWithId('doc_size');
34
35 assertEquals(700, size.width);
36 assertEquals(500, size.height);
37 }
38
39 function testShouldReturnDocumentSizeIfThatIsGreatestAndInQuirksMode() {
40 var size = getSizeOfFrameWithId('quirks_size');
41
42 // In quirks mode IE limits the size of the frame to the content
43 var width = bot.userAgent.IE_DOC_PRE9 ? 110 : 700;
44 var height = bot.userAgent.IE_DOC_PRE9 ? 100 : 500;
45
46 assertEquals(width, size.width);
47 assertEquals(height, size.height);
48 }
49
50 function testSizeShouldBeBasedOnLargestElementInThePage() {
51 var size = getSizeOfFrameWithId('table_size');
52
53 // We can't be sure of the size of the window, but it's at least these
54 // values, which are based on the table size in the doc.
55 assertTrue('Width needs to be at least 349px. It is: ' + size.width,
56 size.width > 349);
57 assertTrue('Height needs to be at least 199px. It is: ' + size.height,
58 size.height > 199);
59 }
60 </script>
61 </head>
62 <body>
63
64 <!-- IE will include the size of the border for this frame and test. To avoid
65 this issue we remove the border -->
66 <iframe id="set_size" src="testdata/blank_page.html" frameBorder="0" width="110" height="100"></iframe>
67
68 <iframe id="doc_size" src="testdata/styled_size.html" width="110" height="100"></iframe>
69
70 <iframe id="quirks_size" src="testdata/quirks_mode_size.html" width="110" height="100"></iframe>
71
72 <iframe id="table_size" src="testdata/table_size.html" width="110" height="100"></iframe>
73 </body>
74 </html>