Strip tracking url parameters
This commit is contained in:
parent
0daa03e04c
commit
114068c531
|
@ -72,7 +72,9 @@ module.exports = function(state, emit) {
|
||||||
const password = el.value;
|
const password = el.value;
|
||||||
if (password.length > 0) {
|
if (password.length > 0) {
|
||||||
document.getElementById('password-btn').disabled = true;
|
document.getElementById('password-btn').disabled = true;
|
||||||
state.fileInfo.url = window.location.href;
|
// Strip any url parameters between fileId and secretKey
|
||||||
|
const fileInfoUrl = window.location.href.replace(/\?.+#/, '#');
|
||||||
|
state.fileInfo.url = fileInfoUrl;
|
||||||
state.fileInfo.password = password;
|
state.fileInfo.password = password;
|
||||||
emit('getMetadata');
|
emit('getMetadata');
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,4 +82,29 @@ describe('Firefox Send', function() {
|
||||||
// check if upload and download file sizes are equal
|
// check if upload and download file sizes are equal
|
||||||
assert.equal(uploadSize, downloadSize);
|
assert.equal(uploadSize, downloadSize);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it(`should upload and download file with added tracking parameter`, function() {
|
||||||
|
const trackingUrl =
|
||||||
|
'?fbclid=IaMFak3Tr4ck1ng1d_SDlP0shBk8SM2EN3cCLFKpHVl-k-Pvv0sf9Zy0tnTu9srqVY';
|
||||||
|
const password = 'strongpassword';
|
||||||
|
|
||||||
|
browser.chooseFile(
|
||||||
|
homePage.uploadInput,
|
||||||
|
`${testFilesPath}/${testFiles[0]}`
|
||||||
|
);
|
||||||
|
browser.waitForExist(homePage.addPassword);
|
||||||
|
browser.click(homePage.addPassword);
|
||||||
|
browser.waitForExist(homePage.passwordInput);
|
||||||
|
browser.setValue(homePage.passwordInput, password);
|
||||||
|
browser.click(homePage.uploadButton);
|
||||||
|
browser.waitForExist(homePage.shareUrl);
|
||||||
|
const shareUrl = browser.getValue(homePage.shareUrl);
|
||||||
|
const downloadPage = new DownloadPage(
|
||||||
|
shareUrl.replace('#', `${trackingUrl}#`)
|
||||||
|
);
|
||||||
|
downloadPage.open();
|
||||||
|
downloadPage.downloadUsingPassword(password);
|
||||||
|
browser.waitForExist(downloadPage.downloadComplete);
|
||||||
|
assert.ok(fs.existsSync(path.join(downloadDir, testFiles[0])));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,23 +4,22 @@ const Page = require('./page');
|
||||||
class DownloadPage extends Page {
|
class DownloadPage extends Page {
|
||||||
constructor(path) {
|
constructor(path) {
|
||||||
super(path);
|
super(path);
|
||||||
this.fileId = /download\/(\w+)\/#/.exec(path)[1];
|
this.fileId = /download\/(\w+)\/\??.*#/.exec(path)[1];
|
||||||
this.downloadButton = '#download-btn';
|
this.downloadButton = '#download-btn';
|
||||||
this.downloadComplete = '#download-complete';
|
this.downloadComplete = '#download-complete';
|
||||||
|
this.passwordInput = '#password-input';
|
||||||
|
this.passwordButton = '#password-btn';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
downloadUsingPassword(password) {
|
||||||
* @function waitForPageToLoad
|
browser.waitForExist(this.passwordInput);
|
||||||
* @returns {Object} An object representing the page.
|
browser.setValue(this.passwordInput, password);
|
||||||
* @throws ElementNotFound
|
browser.click(this.passwordButton);
|
||||||
*/
|
return browser.click(this.downloadButton);
|
||||||
waitForPageToLoad() {
|
|
||||||
super.waitForPageToLoad();
|
|
||||||
browser.waitForExist(this.downloadButton);
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
download() {
|
download() {
|
||||||
|
browser.waitForExist(this.downloadButton);
|
||||||
return browser.click(this.downloadButton);
|
return browser.click(this.downloadButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@ class HomePage extends Page {
|
||||||
this.progress = 'progress';
|
this.progress = 'progress';
|
||||||
this.shareUrl = '#share-url';
|
this.shareUrl = '#share-url';
|
||||||
this.downloadCountSelect = '#expire-after-dl-count-select';
|
this.downloadCountSelect = '#expire-after-dl-count-select';
|
||||||
|
this.addPassword = '#add-password';
|
||||||
|
this.passwordInput = '#password-input';
|
||||||
|
this.passwordButton = '#password-btn';
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForPageToLoad() {
|
waitForPageToLoad() {
|
||||||
|
|
Loading…
Reference in New Issue