Last active
May 2, 2018 06:24
-
-
Save negabaro/faa9b166433ba78cd82504eae29b90f8 to your computer and use it in GitHub Desktop.
I would like to different files for each test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
class FileUpload { | |
upload(path,domain) { | |
browser.url(domain); | |
browser.waitForExist('.btn-primary', 10000); | |
browser.chooseFile('#snapshot_file', path); | |
browser.element('#btn-upload').click(); | |
//browser.ignoreSynchronization = true; | |
browser.waitUntil(() => { | |
try { | |
return browser.alertText() != null; | |
} | |
catch (error) { | |
return false; | |
} | |
}, 5000); | |
browser.alertAccept(); | |
browser.pause(300); | |
browser.waitUntil(() => { | |
try { | |
return browser.alertText() != null; | |
} | |
catch (error) { | |
return false; | |
} | |
}, 5000); | |
browser.alertAccept(); | |
//browser.ignoreSynchronization = false; | |
} | |
} | |
module.exports = new FileUpload(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FileUpload from './../fileupload'; | |
const env = require('../env.js'); | |
const WAIT_TIME = 5000; | |
const assert = require("power-assert"); | |
describe('login - file upload - startoz', function() { | |
beforeEach(function() { | |
FileUpload.upload("A.json","xxx"); | |
console.log("******************************************"); | |
console.log("FileUpload2"); | |
console.log("******************************************"); | |
}); | |
it('test2', function() { | |
browser.waitForExist('.speaker-name', WAIT_TIME + 18000); | |
var speakerName = browser.getHTML('.speaker-name', false); | |
assert.equal("xxx", common.omitReactComment(speakerName)); | |
console.log("******************************************"); | |
console.log("test2"); | |
console.log("******************************************"); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FileUpload from './../fileupload'; | |
const env = require('../env.js'); | |
const WAIT_TIME = 5000; | |
const assert = require("power-assert"); | |
describe('login - file upload - startoz', function() { | |
beforeEach(function() { | |
FileUpload.upload("B.json","xxx"); | |
console.log("******************************************"); | |
console.log("FileUpload3"); | |
console.log("******************************************"); | |
}); | |
it('test3', function() { | |
browser.waitForExist('.speaker-name', WAIT_TIME + 18000); | |
var speakerName = browser.getHTML('.speaker-name', false); | |
assert.equal("xxx", common.omitReactComment(speakerName)); | |
console.log("******************************************"); | |
console.log("test3"); | |
console.log("******************************************"); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const env = require('./src/env.js'); | |
exports.config = { | |
specs: [ | |
__dirname + '/dest/specs/test-sample{2,3}.spec.js' | |
], | |
capabilities: [{ | |
browserName: 'chrome' | |
}], | |
sync: true, | |
logLevel: 'verbose', | |
coloredLogs: true, | |
screenshotPath: './screenshots/', | |
baseUrl: 'https://xx', | |
waitforTimeout: 100000, | |
connectionRetryTimeout: 100000, | |
connectionRetryCount: 3, | |
framework: 'mocha', | |
reporters: ['dot'], | |
mochaOpts: { | |
ui: 'bdd', | |
timeout: 30000 | |
}, | |
before: function (capabilities, specs) { | |
browser.url(env.TOP_DOMAIN); | |
browser.setValue('input[name=username]', "test"); | |
browser.setValue('input[name=password]', "password"); | |
browser.pause(1000); | |
browser.getUrl(); | |
browser.element('button').click(); | |
browser.getUrl(); | |
browser.pause(1000); | |
browser.url(env.TOP_DOMAIN); | |
browser.pause(1000); | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment