Skip to content

Commit 164ff2e

Browse files
author
David Haeffner
committed
Updated snapshots for a few of the e2e tests. Marked remaining ones as skip along with a TODO of what is needed
1 parent 1d8dcdc commit 164ff2e

File tree

2 files changed

+132
-134
lines changed

2 files changed

+132
-134
lines changed

packages/code-export-javascript-mocha/__test__/src/__snapshots__/index.spec.js.snap

Lines changed: 121 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,111 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
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')
147
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!\\\\\\\\\\"
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!\\\\\\\\\\"
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!\\\\\\\\\\")
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!\\\\\\\\\\")
33+
})
34+
})
3935
"
4036
`;
4137

4238
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')
5342
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+
})
112109
"
113110
`;
114111

@@ -243,33 +240,29 @@ class TestDefaultSuite():
243240
`;
244241

245242
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')
256246
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!\\\\\\\\\\"
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!\\\\\\\\\\")
264+
})
265+
})
273266
"
274267
`;
275268

packages/code-export-javascript-mocha/__test__/src/index.spec.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function readFile(filename) {
3737
)
3838
}
3939

40-
describe.skip('Code Export Java JUnit Selenium', () => {
40+
describe('Code Export Java JUnit Selenium', () => {
4141
it('should export a test', async () => {
4242
const project = readFile('single-test.side')
4343
const results = await emitTest({
@@ -58,7 +58,8 @@ describe.skip('Code Export Java JUnit Selenium', () => {
5858
expect(results.body).toBeDefined()
5959
expect(results.body).toMatchSnapshot()
6060
})
61-
it('should export a test with a reused test method', async () => {
61+
// TODO: add support for alt. terminating keyword
62+
it.skip('should export a test with a reused test method', async () => {
6263
const project = normalizeProject(readFile('test-case-reuse.side'))
6364
const results = await emitTest({
6465
baseUrl: project.url,
@@ -68,7 +69,8 @@ describe.skip('Code Export Java JUnit Selenium', () => {
6869
expect(results.body).toBeDefined()
6970
expect(results.body).toMatchSnapshot()
7071
})
71-
it('should export a suite with a reused test method', async () => {
72+
// TODO: add support for alt. terminating keyword
73+
it.skip('should export a suite with a reused test method', async () => {
7274
const project = normalizeProject(readFile('test-case-reuse.side'))
7375
const results = await emitSuite({
7476
baseUrl: project.url,
@@ -88,7 +90,8 @@ describe.skip('Code Export Java JUnit Selenium', () => {
8890
expect(results.body).toBeDefined()
8991
expect(results.body).toMatchSnapshot()
9092
})
91-
it('should export a test with commands that open a new window', async () => {
93+
// TODO: add support for alt. terminating keyword
94+
it.skip('should export a test with commands that open a new window', async () => {
9295
const project = normalizeProject(readFile('select-window.side'))
9396
const results = await emitTest({
9497
baseUrl: project.url,
@@ -98,7 +101,8 @@ describe.skip('Code Export Java JUnit Selenium', () => {
98101
expect(results.body).toBeDefined()
99102
expect(results.body).toMatchSnapshot()
100103
})
101-
it('should export a suite with commands that open a new window inside of a reused test method', async () => {
104+
// TODO: add support for alt. terminating keyword
105+
it.skip('should export a suite with commands that open a new window inside of a reused test method', async () => {
102106
const project = normalizeProject(readFile('nested-select-window.side'))
103107
const results = await emitSuite({
104108
baseUrl: project.url,
@@ -108,7 +112,8 @@ describe.skip('Code Export Java JUnit Selenium', () => {
108112
expect(results.body).toBeDefined()
109113
expect(results.body).toMatchSnapshot()
110114
})
111-
it('should export a suite with just one new window util method when there are multiple commands that open a new window', async () => {
115+
// TODO: add support for alt. terminating keyword
116+
it.skip('should export a suite with just one new window util method when there are multiple commands that open a new window', async () => {
112117
const project = normalizeProject(readFile('nested-select-window-v2.side'))
113118
const results = await emitSuite({
114119
baseUrl: project.url,

0 commit comments

Comments
 (0)