Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* globals beforeAll afterAll jasmine */
import fructose from "@times-components/fructose/setup";
import path from "path";
import wd from "wd";
global.asserter = wd.asserters;
const driver = wd.promiseChainRemote({ host: "localhost", port: 4723 });
beforeAll(async () => {
await fructose.hooks.mobile.setup();
const options = {
desiredCapabilities: {
browserName: "",
platformName: "Android",
platformVersion: "5.1",
deviceName: "Nexus_5X_API_22",
app: path.join(
__dirname,
"../android/app/build/outputs/apk/release/app-release.apk"
)
},
it('should go to the Blog page and look for Featured post', () => {
return browser
.get(blogURL)
.waitForElementByCss(featuredBlogPost, wd.asserters.textInclude(blogReadmore), 15000)
.url().should.eventually.include(blogSlug);
});
it("should go to the browse page", function(done) {
browser
.elementByCss('#n-Browse > a')
.click()
.waitForElementByCss("#pageTitle", wd.asserters.textInclude('Browse pathways'), 10000)
.title()
.should.eventually.include("Browse pathways")
.nodeify(done);
});
it("should get the WP1 widget page on the production site", function(done) {
browser
.get("http://www.wikipathways.org/wpi/PathwayWidget.php?id=WP1")
.title()
.should.become("WikiPathways Pathway Viewer")
.waitForElementById("pathwayImage", wd.asserters.isDisplayed, 20000)
.saveScreenshot('tmp/WP1-' + desired.browserName + '-production.png')
.nodeify(done);
});
it("should get data-nodes test page", function(done) {
browser
.get("http://pointer.ucsf.edu/d3/r/pathvisiojs/test/one-diagram.html?gpml=http://pointer.ucsf.edu/d3/r/pathvisiojs/test/data/protocol/gpml-data-nodes.gpml.xml")
.title()
.should.become("Pathvisiojs Simple Built Production Example")
.waitForElementById("pvjs-diagram-1", wd.asserters.isDisplayed, 20000)
.saveScreenshot('tmp/data-nodes-' + desired.browserName + '-test.png')
.nodeify(done);
});
it("should run the tests", function(done) {
browser
.get("http://127.0.0.1:9999/SpecRunner.html")
.waitForElementById('out', wd.asserters.textInclude('everything'), 10000, function (err, el) {
el.text(function (err, text) {
fs.writeFileSync('./build/results/' + desired.blVersion + '.json', (text));
})
})
.nodeify(done);
});
});
it("should go to the doc page (" + i + ")", function(done) {
browser
.elementById('docsbutton')
.click()
.waitForElementByCss("#content header", wd.asserters.textInclude('Manual'), 10000)
.title()
.should.eventually.include("Manual")
.nodeify(done);
});
}).then(function() {
return browser.waitFor({
asserter: wd.asserters.jsCondition('(typeof window.__tracingData !== "undefined")', false),
timeout: 1000 * 60 * 3,
pollFreq: 1000
});
}).then(function() {
return browser.eval('window.__tracingData.results');
return browser.execute(helpers.fnCall(code)).then(function() {
return browser.waitFor({
asserter: wd.asserters.jsCondition('(typeof window.__navTimings !== "undefined")', false),
timeout: 1000 * 60 * 10,
pollFreq: 1000
});
}).then(function(res) {
return browser.eval('window.__navTimings');
})).then(function() {
debug('Waiting for Scrolling to finish');
return browser.waitFor({
asserter: wd.asserters.jsCondition('(window.__scrollActionDone === true)', false),
timeout: 1000 * 60 * 10,
pollFreq: cfg.pollFreq || 2000
});
})
};