Added webdriverio integration tests
This commit is contained in:
parent
bd02b7db8e
commit
23d629b80b
40 changed files with 10815 additions and 4163 deletions
51
test/integration/download-tests.js
Normal file
51
test/integration/download-tests.js
Normal file
|
@ -0,0 +1,51 @@
|
|||
import DownloadPage from './pages/desktop/download_page';
|
||||
import HomePage from './pages/desktop/home_page';
|
||||
import SharePage from './pages/desktop/share_page';
|
||||
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
describe('Firefox Send', () => {
|
||||
const baseUrl = browser.options['baseUrl'];
|
||||
const downloadDir =
|
||||
browser.desiredCapabilities['moz:firefoxOptions']['prefs'][
|
||||
'browser.download.dir'
|
||||
];
|
||||
const testFilesPath = path.join(__dirname, 'fixtures');
|
||||
const testFiles = fs.readdirSync(testFilesPath);
|
||||
|
||||
beforeEach(() => {
|
||||
browser.url('/');
|
||||
browser.execute(() => {
|
||||
document.getElementById('file-upload').style.display = 'block';
|
||||
});
|
||||
browser.waitForExist('#file-upload');
|
||||
});
|
||||
|
||||
testFiles.forEach(file => {
|
||||
it(`should upload and download files, file: ${file}`, () => {
|
||||
browser.execute(() => {
|
||||
document.getElementById('file-upload').style.display = 'block';
|
||||
});
|
||||
browser.waitForExist('#file-upload');
|
||||
let homePage = new HomePage();
|
||||
browser.chooseFile('#file-upload', `${testFilesPath}/${file}`);
|
||||
browser.click(homePage.readyToSend);
|
||||
let sharePage = new SharePage();
|
||||
browser.waitForExist(sharePage.fileUrl);
|
||||
browser.url(browser.getValue(sharePage.fileUrl));
|
||||
let downloadPage = new DownloadPage();
|
||||
downloadPage.waitForPageToLoad();
|
||||
downloadPage.downloadBtn();
|
||||
// Wait for download to complete
|
||||
browser.waitUntil(() => {
|
||||
browser.waitForExist(downloadPage.downloadComplete);
|
||||
return (
|
||||
browser.getText(downloadPage.downloadComplete) === 'DOWNLOAD COMPLETE'
|
||||
);
|
||||
});
|
||||
assert.ok(fs.existsSync(`${downloadDir}/${file}`));
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue