Skip to content

Commit

Permalink
ic: e2e enriching with new reference file tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Jul 16, 2017
1 parent c6aa230 commit b89e91a
Showing 1 changed file with 73 additions and 81 deletions.
154 changes: 73 additions & 81 deletions tests/e2e/data/data1.js
@@ -1,3 +1,48 @@
// DISPLAY BROWSER'S LOGS
// ----------------------
// .getLog('browser', function(result) {
// console.log(result);
// })

// DISPLAY WEBPAGE'S SOURCE
// ----------------------
// .source(function (result){
// // Source will be stored in result.value
// console.log(result.value);
// })

// EXECUTE JAVASCRIPT
// ----------------------
// .execute(function() {
// var sel = document.getElementById('colors.multiple')
// sel.options[2].selected = true;
// console.log(sel.options[1].value)
// var evt = document.createEvent("HTMLEvents");
// evt.initEvent("change", false, true);
// sel.dispatchEvent(evt);
// })

// MOVE MOUSE AND CLICK
// ----------------------
// .moveToElement('//*[@id="colors.multiple"]/option[2]', 0, 0)
// .mouseButtonClick(0)

// USE KEYBOARD
// ----------------------
// '\uE015' down array key
// '\uE006'] enter key
//.keys(['\uE015', '\uE015', '\uE006'])

// SET VARIABLE AND REUSE IT
// ----------------------
// .getText('//*[@id="colors"]', function(result) {
// elementValue = result.value;
// //console.log(result)
// })
// .perform(function() {
// console.log('elementValue', elementValue);
// })

describe('Abe', function() {

describe('data', function() {
Expand Down Expand Up @@ -37,6 +82,10 @@ describe('Abe', function() {
client
.useXpath()
.url('http://localhost:3003/abe/editor/autocomplete.html')
// colors single
.click('//*[@id="colors.single"]/option[3]')
.assert.containsText('//*[@id="colors.single"]', "vert")
// colors multiple
.click('//*[@id="colors.multiple"]/option[2]')
.waitForElementVisible('//*[@data-parent-id="colors.multiple"]', 1000)
.assert.containsText('//*[@data-parent-id="colors.multiple"]', 'rouge')
Expand All @@ -57,87 +106,30 @@ describe('Abe', function() {
.assert.elementNotPresent('//*[@data-parent-id="colors.colors_autocomplete"]')
});

// it('autocomplete: Abe type data reference json', function(client) {
// client
// .useXpath()
// .url('http://localhost:3003/abe/editor/autocomplete.html')
// .waitForElementVisible('//body')
// .pause(1000)
// .click('//*[@id="abeForm"]/ul/li[2]/a')
// .waitForElementVisible('//*[@id="reference"]/div')
// .click('//*[@id="reference.single"]/option[2]')
// .click('//*[@id="reference.multiple"]/option[3]')
// .setValue('//*[@id="reference.autocomplete"]', 'rouge')
// .waitForElementVisible('//*[@id="reference"]/div/div/div/div[3]/div[2]', 2000)
// .click('//*[@id="reference"]/div/div/div/div[3]/div[2]/div[1]')
// .waitForElementVisible('//*[@id="reference"]/div/div/div/div[3]/div/div', 2000);
// });
//


// .getLog('browser', function(result) {
// console.log(result);
// })
// .source(function (result){
// // Source will be stored in result.value
// console.log(result.value);
// })
// .waitForElementVisible('//*[@id="colors.multiple"]', 2000)
// .execute(function() {
// var sel = document.getElementById('colors.multiple')
// if ("createEvent" in document) {
// var evt = document.createEvent("HTMLEvents");
// evt.initEvent("focus", false, true);
// sel.dispatchEvent(evt);
// }
// else {
// sel.fireEvent("focus");
// }
// sel.options[2].selected = true;
// console.log(sel.options[1].value)

// if ("createEvent" in document) {
// var evt = document.createEvent("HTMLEvents");
// evt.initEvent("change", false, true);
// sel.dispatchEvent(evt);
// }
// else {
// sel.fireEvent("onchange");
// }
// })
// .click('//*[@id="colors.multiple"]/option[2]')
// .moveToElement('//*[@id="colors.multiple"]/option[2]', 0, 0)
// .mouseButtonClick(0)
// .click('//*[@id="colors.multiple"]')
// .keys(['\uE015', '\uE015', '\uE006'])
// .click('//*[@id="colors.multiple"]')
// .pause(1000)
// .click('//*[@id="colors.multiple"]/option[2]') //selects the option but doesn't click
// .pause(5000)
// .keys(['\uE006'])
// .useCss()
// .click('#colors.multiple option[2]')
// .useXpath()
// .setValue('//*[@data-parent-id="colors.multiple"]', 'rouge')
// .getLog('browser', function(result) {
// console.log(result);
// })
// .getText('//*[@id="colors"]', function(result) {
// elementValue = result.value;
// //console.log(result)
// })
// .perform(function() {
// console.log('elementValue', elementValue);
// })
// // .source(function (result){
// // // Source will be stored in result.value
// // console.log(result.value);
// // })
// .waitForElementVisible('//*[@data-parent-id="colors.multiple"]', 1000)
// .assert.containsText('//*[@data-parent-id="colors.multiple"]', 'rouge')
// .click('//*[@data-parent-id="colors.multiple"]/span')
// .assert.elementNotPresent('//*[@data-parent-id="colors.multiple"]')

it('autocomplete: Abe type data reference json', function(client) {
client
.useXpath()
.url('http://localhost:3003/abe/editor/autocomplete.html')
.click('//ul[@class="nav nav-tabs"]/li[2]/a')
.waitForElementVisible('//*[@id="reference"]/div')
// reference single
.click('//*[@id="reference.single"]/option[2]')
.assert.containsText('//*[@id="reference.single"]', "test 1")
// reference multiple
.click('//*[@id="reference.multiple"]/option[3]')
.waitForElementVisible('//*[@data-parent-id="reference.multiple"]', 1000)
.assert.containsText('//*[@data-parent-id="reference.multiple"]', 'test 2')
// reference autocomplete
.setValue('//*[@id="reference.autocomplete"]', 'test 2')
.waitForElementVisible('//*[@id="reference"]/div/div/div/div[3]/div/div[2]/div', 1000)
.click('//*[@id="reference"]/div/div/div/div[3]/div/div[2]/div')
.waitForElementVisible('//*[@data-parent-id="reference.autocomplete"]', 1000)
.assert.containsText('//*[@data-parent-id="reference.autocomplete"]', 'test 2')
.click('//*[@data-parent-id="reference.autocomplete"]/span')
.assert.elementNotPresent('//*[@data-parent-id="reference.autocomplete"]');

});

it('autocomplete: The autocomplete article is deleted in the manager', function(client) {
client
.useXpath()
Expand Down

0 comments on commit b89e91a

Please sign in to comment.