-
Notifications
You must be signed in to change notification settings - Fork 4
/
execute-query.spec.js
53 lines (46 loc) · 1.92 KB
/
execute-query.spec.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
const CookieBar = require('./components/cookiebar.component');
const ExecuteQueryPage = require('./pages/execute-query.page');
describe('Execute Query Page tests', function() {
let cookiebar = new CookieBar();
let querypage = new ExecuteQueryPage();
let EC = protractor.ExpectedConditions;
beforeAll(function() {
browser.get("#!/jdbc/execute-query");
browser.wait(EC.visibilityOf(querypage.queryField), 100000);
});
beforeEach(function() {
cookiebar.closeIfPresent();
});
it('Should return a result after executing a query', function() {
querypage.sendQuery("CREATE TABLE IF NOT EXISTS bla(bla1 int, bla2 int)");
querypage.btnReset.click();
querypage.sendQuery("select * from bla");
browser.wait(EC.visibilityOf(querypage.result), 2000);
querypage.result.getText().then(function(text) {
expect(text).toBe('BLA1,BLA2');
});
});
it('When result has special characters then result escaped', function() {
querypage.btnReset.click();
querypage.sendQuery("SELECT char(44) AS result");
browser.wait(EC.visibilityOf(querypage.result), 2000);
querypage.result.getText().then(function(text) {
expect(text).toBe("RESULT\n\",\"");
});
});
it('Should reset the form when clicking the reset button', function() {
querypage.queryField.sendKeys('Bla bla bla');
querypage.btnReset.click();
querypage.queryField.getText().then(function(text) {
expect(text).toBe('');
});
});
it('Should return an error when executing a false query', function() {
querypage.queryField.sendKeys('This is a false query');
querypage.btnSend.click();
browser.wait(EC.visibilityOf(querypage.warning), 1000);
querypage.warning.getText().then(function(text) {
expect(text).toContain('Error');
});
});
});