cleaned up integration test flow

This commit is contained in:
Danny Coates 2018-10-03 17:39:39 -07:00
parent 23d629b80b
commit 76de2b29a5
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
20 changed files with 123 additions and 1798 deletions

View file

@ -1,13 +1,13 @@
import DownloadPage from './pages/desktop/download_page';
import HomePage from './pages/desktop/home_page';
import SharePage from './pages/desktop/share_page';
/* global browser document */
const assert = require('assert');
const fs = require('fs');
const path = require('path');
describe('Firefox Send', () => {
const baseUrl = browser.options['baseUrl'];
const DownloadPage = require('./pages/desktop/download_page');
const HomePage = require('./pages/desktop/home_page');
const SharePage = require('./pages/desktop/share_page');
describe('Firefox Send', function() {
const downloadDir =
browser.desiredCapabilities['moz:firefoxOptions']['prefs'][
'browser.download.dir'
@ -15,7 +15,7 @@ describe('Firefox Send', () => {
const testFilesPath = path.join(__dirname, 'fixtures');
const testFiles = fs.readdirSync(testFilesPath);
beforeEach(() => {
beforeEach(function() {
browser.url('/');
browser.execute(() => {
document.getElementById('file-upload').style.display = 'block';
@ -24,18 +24,18 @@ describe('Firefox Send', () => {
});
testFiles.forEach(file => {
it(`should upload and download files, file: ${file}`, () => {
it(`should upload and download files, file: ${file}`, function() {
browser.execute(() => {
document.getElementById('file-upload').style.display = 'block';
});
browser.waitForExist('#file-upload');
let homePage = new HomePage();
const homePage = new HomePage();
browser.chooseFile('#file-upload', `${testFilesPath}/${file}`);
browser.click(homePage.readyToSend);
let sharePage = new SharePage();
const sharePage = new SharePage();
browser.waitForExist(sharePage.fileUrl);
browser.url(browser.getValue(sharePage.fileUrl));
let downloadPage = new DownloadPage();
const downloadPage = new DownloadPage();
downloadPage.waitForPageToLoad();
downloadPage.downloadBtn();
// Wait for download to complete
@ -45,7 +45,7 @@ describe('Firefox Send', () => {
browser.getText(downloadPage.downloadComplete) === 'DOWNLOAD COMPLETE'
);
});
assert.ok(fs.existsSync(`${downloadDir}/${file}`));
assert.ok(fs.existsSync(path.join(downloadDir, file)));
});
});
});