tst.describe("index page", function() { tst.before(function() { this.driver.get("http://localhost:5000"); }); tst.it("should have the right title", function() { this.driver.getTitle().then(function(title) { expect(title).to.equal("Webpack Examples | TypeScript"); }); }); tst.it("should have the right main heading", function() { expect("h1").dom.to.have.text("Hello webpack typescript loader!"); }); });
tst.describe("/webpack-dev-server/", function() { tst.before(function() { this.driver.get("http://localhost:5000/webpack-dev-server/"); }); tst.it("should have the webpack ok status", function() { expect("#status").dom.to.have.text("App ready."); }); tst.it("should have the right main heading", function() { this.driver.switchTo().frame("iframe"); expect("h1").dom.to.have.text("Hello webpack typescript loader!"); this.driver.switchTo().defaultContent(); }); });
tst.describe("index page", function() { tst.before(function() { this.driver.get("http://localhost:5000"); }); tst.it("should have the right title", function() { this.driver.getTitle().then(function(title) { expect(title).to.equal("Webpack Examples | Basic With HTML Plugin"); }); }); tst.it("should have the right main heading", function() { expect("h1").dom.to.have.text("Hello webpack HTML plugin!"); }); tst.it("should have a script tag without a hash", function() { expect("script").dom.to.have.attribute("src", /main.js/); }); });
describe(`app`, function() { let app; before(function(done) { this.timeout(10000); browserSync.reset(); app = browserSync.init({ server: { baseDir: path.join(baseDir, appConfig.buildDir) }, open: false, logLevel: `silent` }, done).instance; }); after(function() { app.cleanup(); }); it(`should not have broken links`, function(done) { let paths = []; let error; klaw(path.join(baseDir, appConfig.buildDir)) .on(`data`, function(item) { if (item.stats.isDirectory() || !_.endsWith(item.path, `.html`)) return; let res = fs.readFileSync(item.path, `utf-8`).match(/=["|']((\/)([a-zA-Z0-9\-_\/.]+))["|']/g); res.forEach((v, i) => { let p = v.replace(/("|')/g, ``); if (_.startsWith(p, `=`)) p = p.substr(1); if (_.isEmpty(path.extname(p)) && !_.endsWith(p, `/`)) p = `${p}/`; if (!_.startsWith(p, `//`) && !_.startsWith(p, `http`)) paths.push(p); }); }) .on(`end`, function() { async.eachSeries(_.uniq(paths), function(path, callback) { request(app.server) .get(path) .expect(200) .end(function(err, res) { if (err) { error = err; console.log(chalk.red(`Request failed for:`), path); } callback(); }); }, function() { if (error) throw error; else done(); }); }); }); });
tst.describe("index page", function() { tst.before(function() { this.driver.get("http://localhost:5000"); }); tst.it("should have the right title", function() { this.driver.getTitle().then(function(title) { expect(title).to.equal("Webpack Examples | Basic With Style and CSS"); }); }); tst.it("should have the right main heading", function() { expect("h1").dom.to.have.text("Hello webpack style and CSS loaders!"); }); tst.it("should have inline style", function() { this.driver.getPageSource().then(function(content) { expect(content).to.match(/<style[\s\S]*background-color[\s\S]*<\/style>/i); }); }); });
test.describe('JQM Demo', function () { test.it('should find title', function () { driver.getTitle().then(function (title) { return assert("Categories").equalTo(title); }); }); test.it('find all the elements below the body', function () { driver.findElement(By.tagName('body')).findElements(By.xpath('.//*')).then(function (elements) { elements.forEach(function (element, index) { element.getTagName().then(function (name) { // console.log("index" + index + ":" + name); }); }); }); }); test.it('find element being visible', function () { waitFor(driver, By.id('categories')).then(function () { // console.log("The element is visible: "); }); }); });
exam.describe('Scope', function () { exam.it('works', function () {}) })