|
1 | 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP |
2 | 2 |
|
3 | 3 | exports[`Code Export Java JUnit Selenium should export a suite 1`] = ` |
4 | | -"# Generated by Selenium IDE |
5 | | -import pytest |
6 | | -import time |
7 | | -import json |
8 | | -from selenium import webdriver |
9 | | -from selenium.webdriver.common.by import By |
10 | | -from selenium.webdriver.common.action_chains import ActionChains |
11 | | -from selenium.webdriver.support import expected_conditions |
12 | | -from selenium.webdriver.support.wait import WebDriverWait |
13 | | -from selenium.webdriver.common.keys import Keys |
| 4 | +"// Generated by Selenium IDE |
| 5 | +const { Builder, By, Key, until } = require('selenium-webdriver') |
| 6 | +const assert = require('assert') |
14 | 7 |
|
15 | | -class TestLogin(): |
16 | | - def setup_method(self, method): |
17 | | - self.driver = webdriver.Firefox() |
18 | | - self.vars = {} |
19 | | - |
20 | | - def teardown_method(self, method): |
21 | | - self.driver.quit(); |
22 | | - |
23 | | - def test_validcredentials(self): |
24 | | - self.driver.get(\\"http://the-internet.herokuapp.com/login\\") |
25 | | - self.driver.set_window_size(1440, 1177) |
26 | | - self.driver.find_element(By.ID, \\"username\\").send_keys(\\"tomsmith\\") |
27 | | - self.driver.find_element(By.ID, \\"password\\").send_keys(\\"SuperSecretPassword!\\") |
28 | | - self.driver.find_element(By.CSS_SELECTOR, \\"#login button\\").click() |
29 | | - assert self.driver.find_element(By.CSS_SELECTOR, \\".flash.success\\").text == \\"You logged into a secure area!\\\\\\\\n×\\" |
30 | | - |
31 | | - def test_invalidcredentials(self): |
32 | | - self.driver.get(\\"http://the-internet.herokuapp.com/login\\") |
33 | | - self.driver.set_window_size(1440, 1177) |
34 | | - self.driver.find_element(By.ID, \\"username\\").send_keys(\\"blah\\") |
35 | | - self.driver.find_element(By.ID, \\"password\\").send_keys(\\"blah\\") |
36 | | - self.driver.find_element(By.CSS_SELECTOR, \\"#login button\\").click() |
37 | | - assert self.driver.find_element(By.ID, \\"flash\\").text == \\"Your username is invalid!\\\\\\\\n×\\" |
38 | | - |
| 8 | +describe('login', function() { |
| 9 | + let driver |
| 10 | + let vars |
| 11 | + beforeEach(async function() { |
| 12 | + driver = await new Builder().forBrowser('firefox').build() |
| 13 | + vars = {} |
| 14 | + }) |
| 15 | + afterEach(async function() { |
| 16 | + await driver.quit(); |
| 17 | + }) |
| 18 | + it('validcredentials', async function() { |
| 19 | + await driver.get(\\"http://the-internet.herokuapp.com/login\\") |
| 20 | + await driver.setRect(1440, 1177) |
| 21 | + await driver.findElement(By.id(\\"username\\")).sendKeys(\\"tomsmith\\") |
| 22 | + await driver.findElement(By.id(\\"password\\")).sendKeys(\\"SuperSecretPassword!\\") |
| 23 | + await driver.findElement(By.css(\\"#login button\\")).click() |
| 24 | + assert(await driver.findElement(By.css(\\".flash.success\\")).getText() == \\"You logged into a secure area!\\\\\\\\n×\\") |
| 25 | + }) |
| 26 | + it('invalidcredentials', async function() { |
| 27 | + await driver.get(\\"http://the-internet.herokuapp.com/login\\") |
| 28 | + await driver.setRect(1440, 1177) |
| 29 | + await driver.findElement(By.id(\\"username\\")).sendKeys(\\"blah\\") |
| 30 | + await driver.findElement(By.id(\\"password\\")).sendKeys(\\"blah\\") |
| 31 | + await driver.findElement(By.css(\\"#login button\\")).click() |
| 32 | + assert(await driver.findElement(By.id(\\"flash\\")).getText() == \\"Your username is invalid!\\\\\\\\n×\\") |
| 33 | + }) |
| 34 | +}) |
39 | 35 | " |
40 | 36 | `; |
41 | 37 |
|
42 | 38 | exports[`Code Export Java JUnit Selenium should export a suite that uses control flow commands 1`] = ` |
43 | | -"# Generated by Selenium IDE |
44 | | -import pytest |
45 | | -import time |
46 | | -import json |
47 | | -from selenium import webdriver |
48 | | -from selenium.webdriver.common.by import By |
49 | | -from selenium.webdriver.common.action_chains import ActionChains |
50 | | -from selenium.webdriver.support import expected_conditions |
51 | | -from selenium.webdriver.support.wait import WebDriverWait |
52 | | -from selenium.webdriver.common.keys import Keys |
| 39 | +"// Generated by Selenium IDE |
| 40 | +const { Builder, By, Key, until } = require('selenium-webdriver') |
| 41 | +const assert = require('assert') |
53 | 42 |
|
54 | | -class TestControlflow(): |
55 | | - def setup_method(self, method): |
56 | | - self.driver = webdriver.Firefox() |
57 | | - self.vars = {} |
58 | | - |
59 | | - def teardown_method(self, method): |
60 | | - self.driver.quit(); |
61 | | - |
62 | | - def test_controlflowif(self): |
63 | | - self.vars[\\"myVar\\"] = self.driver.execute_script(\\"return 'a'\\") |
64 | | - if self.driver.execute_script(\\"return (arguments[0] === 'a')\\", self.vars[\\"myVar\\"]): |
65 | | - self.vars[\\"output\\"] = self.driver.execute_script(\\"return 'a'\\") |
66 | | - elif self.driver.execute_script(\\"return (arguments[0] === 'b')\\", self.vars[\\"myVar\\"]): |
67 | | - self.vars[\\"output\\"] = self.driver.execute_script(\\"return 'b'\\") |
68 | | - else: |
69 | | - self.vars[\\"output\\"] = self.driver.execute_script(\\"return 'c'\\") |
70 | | - assert(self.vars[\\"output\\"] == \\"a\\") |
71 | | - |
72 | | - def test_controlflowelseif(self): |
73 | | - self.vars[\\"myVar\\"] = self.driver.execute_script(\\"return 'b'\\") |
74 | | - if self.driver.execute_script(\\"return (arguments[0] === 'a')\\", self.vars[\\"myVar\\"]): |
75 | | - self.vars[\\"output\\"] = self.driver.execute_script(\\"return 'a'\\") |
76 | | - elif self.driver.execute_script(\\"return (arguments[0] === 'b')\\", self.vars[\\"myVar\\"]): |
77 | | - self.vars[\\"output\\"] = self.driver.execute_script(\\"return 'b'\\") |
78 | | - else: |
79 | | - self.vars[\\"output\\"] = self.driver.execute_script(\\"return 'c'\\") |
80 | | - assert(self.vars[\\"output\\"] == \\"b\\") |
81 | | - |
82 | | - def test_controlflowelse(self): |
83 | | - self.vars[\\"myVar\\"] = self.driver.execute_script(\\"return 'c'\\") |
84 | | - if self.driver.execute_script(\\"return (arguments[0] === 'a')\\", self.vars[\\"myVar\\"]): |
85 | | - self.vars[\\"output\\"] = self.driver.execute_script(\\"return 'a'\\") |
86 | | - elif self.driver.execute_script(\\"return (arguments[0] === 'b')\\", self.vars[\\"myVar\\"]): |
87 | | - self.vars[\\"output\\"] = self.driver.execute_script(\\"return 'b'\\") |
88 | | - else: |
89 | | - self.vars[\\"output\\"] = self.driver.execute_script(\\"return 'c'\\") |
90 | | - assert(self.vars[\\"output\\"] == \\"c\\") |
91 | | - |
92 | | - def test_controlflowdo(self): |
93 | | - self.vars[\\"check\\"] = self.driver.execute_script(\\"return 1\\") |
94 | | - condition = True |
95 | | - while condition: |
96 | | - self.vars[\\"check\\"] = self.driver.execute_script(\\"return arguments[0] + 1\\", self.vars[\\"check\\"]) |
97 | | - condition = self.driver.execute_script(\\"return (arguments[0] < 3)\\", self.vars[\\"check\\"]) |
98 | | - assert(self.vars[\\"check\\"] == 3) |
99 | | - |
100 | | - def test_controlflowtimes(self): |
101 | | - self.vars[\\"check\\"] = self.driver.execute_script(\\"return 1\\") |
102 | | - for i in range(0, 2): |
103 | | - self.vars[\\"check\\"] = self.driver.execute_script(\\"return arguments[0] + 1\\", self.vars[\\"check\\"]) |
104 | | - assert(self.vars[\\"check\\"] == 3) |
105 | | - |
106 | | - def test_controlflowwhile(self): |
107 | | - self.vars[\\"check\\"] = self.driver.execute_script(\\"return 1\\") |
108 | | - while self.driver.execute_script(\\"return (arguments[0] < 3)\\", self.vars[\\"check\\"]): |
109 | | - self.vars[\\"check\\"] = self.driver.execute_script(\\"return arguments[0] + 1\\", self.vars[\\"check\\"]) |
110 | | - assert(self.vars[\\"check\\"] == 3) |
111 | | - |
| 43 | +describe('controlflow', function() { |
| 44 | + let driver |
| 45 | + let vars |
| 46 | + beforeEach(async function() { |
| 47 | + driver = await new Builder().forBrowser('firefox').build() |
| 48 | + vars = {} |
| 49 | + }) |
| 50 | + afterEach(async function() { |
| 51 | + await driver.quit(); |
| 52 | + }) |
| 53 | + it('controlflowif', async function() { |
| 54 | + vars[\\"myVar\\"] = await driver.executeScript(\\"return 'a'\\") |
| 55 | + if (!!await driver.executeScript(\\"return (arguments[0] === 'a')\\", vars[\\"myVar\\"])) { |
| 56 | + vars[\\"output\\"] = await driver.executeScript(\\"return 'a'\\") |
| 57 | + } else if (!!await driver.executeScript(\\"return (arguments[0] === 'b')\\", vars[\\"myVar\\"])) { |
| 58 | + vars[\\"output\\"] = await driver.executeScript(\\"return 'b'\\") |
| 59 | + } else { |
| 60 | + vars[\\"output\\"] = await driver.executeScript(\\"return 'c'\\") |
| 61 | + } |
| 62 | + assert(vars[\\"output\\"] == \\"a\\") |
| 63 | + }) |
| 64 | + it('controlflowelseif', async function() { |
| 65 | + vars[\\"myVar\\"] = await driver.executeScript(\\"return 'b'\\") |
| 66 | + if (!!await driver.executeScript(\\"return (arguments[0] === 'a')\\", vars[\\"myVar\\"])) { |
| 67 | + vars[\\"output\\"] = await driver.executeScript(\\"return 'a'\\") |
| 68 | + } else if (!!await driver.executeScript(\\"return (arguments[0] === 'b')\\", vars[\\"myVar\\"])) { |
| 69 | + vars[\\"output\\"] = await driver.executeScript(\\"return 'b'\\") |
| 70 | + } else { |
| 71 | + vars[\\"output\\"] = await driver.executeScript(\\"return 'c'\\") |
| 72 | + } |
| 73 | + assert(vars[\\"output\\"] == \\"b\\") |
| 74 | + }) |
| 75 | + it('controlflowelse', async function() { |
| 76 | + vars[\\"myVar\\"] = await driver.executeScript(\\"return 'c'\\") |
| 77 | + if (!!await driver.executeScript(\\"return (arguments[0] === 'a')\\", vars[\\"myVar\\"])) { |
| 78 | + vars[\\"output\\"] = await driver.executeScript(\\"return 'a'\\") |
| 79 | + } else if (!!await driver.executeScript(\\"return (arguments[0] === 'b')\\", vars[\\"myVar\\"])) { |
| 80 | + vars[\\"output\\"] = await driver.executeScript(\\"return 'b'\\") |
| 81 | + } else { |
| 82 | + vars[\\"output\\"] = await driver.executeScript(\\"return 'c'\\") |
| 83 | + } |
| 84 | + assert(vars[\\"output\\"] == \\"c\\") |
| 85 | + }) |
| 86 | + it('controlflowdo', async function() { |
| 87 | + vars[\\"check\\"] = await driver.executeScript(\\"return 1\\") |
| 88 | + do { |
| 89 | + vars[\\"check\\"] = await driver.executeScript(\\"return arguments[0] + 1\\", vars[\\"check\\"]) |
| 90 | + } while(!!await driver.executeScript(\\"return (arguments[0] < 3)\\", vars[\\"check\\"])) |
| 91 | + assert(vars[\\"check\\"] == \\"3\\") |
| 92 | + }) |
| 93 | + it('controlflowtimes', async function() { |
| 94 | + vars[\\"check\\"] = await driver.executeScript(\\"return 1\\") |
| 95 | + const times = 2 |
| 96 | + for(let i = 0; i < times; i++) { |
| 97 | + vars[\\"check\\"] = await driver.executeScript(\\"return arguments[0] + 1\\", vars[\\"check\\"]) |
| 98 | + } |
| 99 | + assert(vars[\\"check\\"] == \\"3\\") |
| 100 | + }) |
| 101 | + it('controlflowwhile', async function() { |
| 102 | + vars[\\"check\\"] = await driver.executeScript(\\"return 1\\") |
| 103 | + while(!!await driver.executeScript(\\"return (arguments[0] < 3)\\", vars[\\"check\\"])) { |
| 104 | + vars[\\"check\\"] = await driver.executeScript(\\"return arguments[0] + 1\\", vars[\\"check\\"]) |
| 105 | + } |
| 106 | + assert(vars[\\"check\\"] == \\"3\\") |
| 107 | + }) |
| 108 | +}) |
112 | 109 | " |
113 | 110 | `; |
114 | 111 |
|
@@ -243,33 +240,29 @@ class TestDefaultSuite(): |
243 | 240 | `; |
244 | 241 |
|
245 | 242 | exports[`Code Export Java JUnit Selenium should export a test 1`] = ` |
246 | | -"# Generated by Selenium IDE |
247 | | -import pytest |
248 | | -import time |
249 | | -import json |
250 | | -from selenium import webdriver |
251 | | -from selenium.webdriver.common.by import By |
252 | | -from selenium.webdriver.common.action_chains import ActionChains |
253 | | -from selenium.webdriver.support import expected_conditions |
254 | | -from selenium.webdriver.support.wait import WebDriverWait |
255 | | -from selenium.webdriver.common.keys import Keys |
| 243 | +"// Generated by Selenium IDE |
| 244 | +const { Builder, By, Key, until } = require('selenium-webdriver') |
| 245 | +const assert = require('assert') |
256 | 246 |
|
257 | | -class TestLogin(): |
258 | | - def setup_method(self, method): |
259 | | - self.driver = webdriver.Firefox() |
260 | | - self.vars = {} |
261 | | - |
262 | | - def teardown_method(self, method): |
263 | | - self.driver.quit(); |
264 | | - |
265 | | - def test_login(self): |
266 | | - self.driver.get(\\"http://the-internet.herokuapp.com/login\\") |
267 | | - self.driver.set_window_size(1440, 1177) |
268 | | - self.driver.find_element(By.ID, \\"username\\").send_keys(\\"tomsmith\\") |
269 | | - self.driver.find_element(By.ID, \\"password\\").send_keys(\\"SuperSecretPassword!\\") |
270 | | - self.driver.find_element(By.CSS_SELECTOR, \\"#login button\\").click() |
271 | | - assert self.driver.find_element(By.CSS_SELECTOR, \\".flash.success\\").text == \\"You logged into a secure area!\\\\\\\\n×\\" |
272 | | - |
| 247 | +describe('login', function() { |
| 248 | + let driver |
| 249 | + let vars |
| 250 | + beforeEach(async function() { |
| 251 | + driver = await new Builder().forBrowser('firefox').build() |
| 252 | + vars = {} |
| 253 | + }) |
| 254 | + afterEach(async function() { |
| 255 | + await driver.quit(); |
| 256 | + }) |
| 257 | + it('login', async function() { |
| 258 | + await driver.get(\\"http://the-internet.herokuapp.com/login\\") |
| 259 | + await driver.setRect(1440, 1177) |
| 260 | + await driver.findElement(By.id(\\"username\\")).sendKeys(\\"tomsmith\\") |
| 261 | + await driver.findElement(By.id(\\"password\\")).sendKeys(\\"SuperSecretPassword!\\") |
| 262 | + await driver.findElement(By.css(\\"#login button\\")).click() |
| 263 | + assert(await driver.findElement(By.css(\\".flash.success\\")).getText() == \\"You logged into a secure area!\\\\\\\\n×\\") |
| 264 | + }) |
| 265 | +}) |
273 | 266 | " |
274 | 267 | `; |
275 | 268 |
|
|
0 commit comments