Skip to content

Commit

Permalink
Merge branch 'release/0.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
nwtgck committed Dec 31, 2022
2 parents 111aad5 + 40fbd1d commit 932ea1b
Show file tree
Hide file tree
Showing 21 changed files with 874 additions and 526 deletions.
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

## [Unreleased]

## [0.13.0] - 2022-12-31
### Changed
- Passwordless protection by default
- Make verification optional in passwordless protection
- Update dependencies
- Mitigate path collision in passwordless protection
- Use numbers, which are the universal language, as secret path by default
- Allow users to input both files and text without switching
- Streaming upload for multiple files with zip
- Improve error messages

### Fixed
- Show decrypted loaded byte size not encrypted one

### Added
- Detect download block and open retry-download dialog especially for Safari

## [0.12.1] - 2022-12-27
### Fixed
- Solve memory leak when downloading
Expand Down Expand Up @@ -426,7 +443,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
### Added
- First release

[Unreleased]: https://github.com/nwtgck/piping-ui-web/compare/v0.12.1...HEAD
[Unreleased]: https://github.com/nwtgck/piping-ui-web/compare/v0.13.0...HEAD
[0.13.0]: https://github.com/nwtgck/piping-ui-web/compare/v0.12.1...v0.13.0
[0.12.1]: https://github.com/nwtgck/piping-ui-web/compare/v0.12.0...v0.12.1
[0.12.0]: https://github.com/nwtgck/piping-ui-web/compare/v0.11.0...v0.12.0
[0.11.0]: https://github.com/nwtgck/piping-ui-web/compare/v0.10.0...v0.11.0
Expand Down
14 changes: 7 additions & 7 deletions e2e-test/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"devDependencies": {
"@types/mocha": "^10.0.1",
"@types/power-assert": "^1.5.8",
"@types/selenium-webdriver": "^4.1.9",
"@types/selenium-webdriver": "^4.1.10",
"mocha": "^10.2.0",
"power-assert": "^1.6.1",
"selenium-webdriver": "^4.7.1",
Expand Down
75 changes: 54 additions & 21 deletions e2e-test/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,31 @@ function findElements(driver: WebDriver) {
return {
fileInput: async () => driver.findElement(webdriver.By.css("[data-testid=file_input] input[type=file]")),
secretPathInput: async () => driver.findElement(webdriver.By.css("[data-testid=secret_path_input]")),
secretPathClearButton: async () => driver.findElement(webdriver.By.css("[data-testid=secret_path_input] ~ * [aria-label='clear icon']")),
passwordlessSendAndVerifySwitch: async () => driver.findElement(webdriver.By.css("[data-testid=passwordless_send_and_verify_switch]")),
sendButton: async () => driver.findElement(webdriver.By.css("[data-testid=send_button]")),
getMenuButton: async () => driver.findElement(webdriver.By.css("[data-testid=get_menu_button]")),
downloadButton: async () => driver.findElement(webdriver.By.css("[data-testid=download_button]")),
viewButton: async () => driver.findElement(webdriver.By.css("[data-testid=view_button]")),
image0InView: async () => driver.findElement(webdriver.By.xpath("//*[@data-testid='expand_panel_0']//*[@data-testid='image' and contains(@src, 'blob:')]")),
passwordlessSwitch: async () => driver.findElement(webdriver.By.css("[data-testid=passwordless_switch]")),
verifySendButton0: async () => driver.findElement(webdriver.By.css("[data-testid=expand_panel_0] [data-testid=verify_and_send_button]")),
passwordlessVerifiedButton0: async () => driver.findElement(webdriver.By.css("[data-testid=expand_panel_0] [data-testid=passwordless_verified_button]")),
moreOptionsButton: async () => driver.findElement(webdriver.By.css("[data-testid=more_options_button]")),
passwordSwitch: async () => driver.findElement(webdriver.By.css("[data-testid=password_switch]")),
passwordInput: async () => driver.findElement(webdriver.By.css("[data-testid=password_input]")),
} as const;
}

function getActions(driver: WebDriver) {
const elements = findElements(driver);
return {
async inputSecretPath(path: string) {
await (await elements.secretPathClearButton()).click();
await (await elements.secretPathInput()).sendKeys(path);
},
};
}

describe('Piping UI', () => {
const afterCallbacks: (() => void | Promise<void>)[] = [];
afterEach(async () => {
Expand All @@ -71,12 +84,15 @@ describe('Piping UI', () => {
defer(() => driver.quit());
await driver.get(PIPING_UI_URL);
const elements = findElements(driver);
const actions = getActions(driver);

const transferFilePath = path.join(sharePath, "mydata.dat");
fs.writeFileSync(transferFilePath, transferContent);
defer(() => fs.rmSync(transferFilePath));
await (await elements.fileInput()).sendKeys(path.join(sharePathInDocker, "mydata.dat"));
await (await elements.secretPathInput()).sendKeys(secretPath);
await actions.inputSecretPath(secretPath);
// NOTE: e.click() causes "Element <input id="..." type="checkbox"> is not clickable at point because another element <div class="..."> obscures it"
await nativeClick(driver, await elements.passwordlessSwitch());
await new Promise(resolve => setTimeout(resolve, 1000));
await (await elements.sendButton()).click();
}
Expand All @@ -86,9 +102,12 @@ describe('Piping UI', () => {
defer(() => driver.quit());
await driver.get(PIPING_UI_URL);
const elements = findElements(driver);
const actions = getActions(driver);

await (await elements.getMenuButton()).click();
await (await elements.secretPathInput()).sendKeys(secretPath);
await actions.inputSecretPath(secretPath);
// NOTE: e.click() causes "Element <input id="..." type="checkbox"> is not clickable at point because another element <div class="..."> obscures it"
await nativeClick(driver, await elements.passwordlessSwitch());
await new Promise(resolve => setTimeout(resolve, 1000));
await (await elements.downloadButton()).click();

Expand All @@ -111,12 +130,15 @@ describe('Piping UI', () => {
defer(() => driver.quit());
await driver.get(PIPING_UI_URL);
const elements = findElements(driver);
const actions = getActions(driver);

const transferFilePath = path.join(sharePath, "myimg.png");
fs.writeFileSync(transferFilePath, rayTracingPngImage);
defer(() => fs.rmSync(transferFilePath));
await (await elements.fileInput()).sendKeys(path.join(sharePathInDocker, "myimg.png"));
await (await elements.secretPathInput()).sendKeys(secretPath);
await actions.inputSecretPath(secretPath);
// NOTE: e.click() causes "Element <input id="..." type="checkbox"> is not clickable at point because another element <div class="..."> obscures it"
await nativeClick(driver, await elements.passwordlessSwitch());
await new Promise(resolve => setTimeout(resolve, 1000));
await (await elements.sendButton()).click();
}
Expand All @@ -126,9 +148,12 @@ describe('Piping UI', () => {
defer(() => driver.quit());
await driver.get(PIPING_UI_URL);
const elements = findElements(driver);
const actions = getActions(driver);

await (await elements.getMenuButton()).click();
await (await elements.secretPathInput()).sendKeys(secretPath);
await actions.inputSecretPath(secretPath);
// NOTE: e.click() causes "Element <input id="..." type="checkbox"> is not clickable at point because another element <div class="..."> obscures it"
await nativeClick(driver, await elements.passwordlessSwitch());
await new Promise(resolve => setTimeout(resolve, 1000));
await (await elements.viewButton()).click();

Expand All @@ -152,12 +177,14 @@ describe('Piping UI', () => {
defer(() => driver.quit());
await driver.get(PIPING_UI_URL);
const elements = findElements(driver);
const actions = getActions(driver);

const transferFilePath = path.join(sharePath, "mydata.dat");
fs.writeFileSync(transferFilePath, transferContent);
defer(() => fs.rmSync(transferFilePath));
await (await elements.fileInput()).sendKeys(path.join(sharePathInDocker, "mydata.dat"));
await (await elements.secretPathInput()).sendKeys(secretPath);
await actions.inputSecretPath(secretPath);
await (await elements.moreOptionsButton()).click();
// NOTE: passwordElement.click() causes "Element <input id="..." type="checkbox"> is not clickable at point because another element <div class="..."> obscures it"
await nativeClick(driver, (await elements.passwordSwitch()));
await (await elements.passwordInput()).sendKeys(filePassword);
Expand All @@ -170,9 +197,11 @@ describe('Piping UI', () => {
defer(() => driver.quit());
await driver.get(PIPING_UI_URL);
const elements = findElements(driver);
const actions = getActions(driver);

await (await elements.getMenuButton()).click();
await (await elements.secretPathInput()).sendKeys(secretPath);
await actions.inputSecretPath(secretPath);
await (await elements.moreOptionsButton()).click();
// NOTE: passwordElement.click() causes "Element <input id="..." type="checkbox"> is not clickable at point because another element <div class="..."> obscures it"
await nativeClick(driver, await elements.passwordSwitch());
await (await elements.passwordInput()).sendKeys(filePassword);
Expand Down Expand Up @@ -200,12 +229,14 @@ describe('Piping UI', () => {
defer(() => driver.quit());
await driver.get(PIPING_UI_URL);
const elements = findElements(driver);
const actions = getActions(driver);

const transferFilePath = path.join(sharePath, "myimg.png");
fs.writeFileSync(transferFilePath, rayTracingPngImage);
defer(() => fs.rmSync(transferFilePath));
await (await elements.fileInput()).sendKeys(path.join(sharePathInDocker, "myimg.png"));
await (await elements.secretPathInput()).sendKeys(secretPath);
await actions.inputSecretPath(secretPath);
await (await elements.moreOptionsButton()).click();
// NOTE: passwordElement.click() causes "Element <input id="..." type="checkbox"> is not clickable at point because another element <div class="..."> obscures it"
await nativeClick(driver, (await elements.passwordSwitch()));
await (await elements.passwordInput()).sendKeys(filePassword);
Expand All @@ -218,9 +249,11 @@ describe('Piping UI', () => {
defer(() => driver.quit());
await driver.get(PIPING_UI_URL);
const elements = findElements(driver);
const actions = getActions(driver);

await (await elements.getMenuButton()).click();
await (await elements.secretPathInput()).sendKeys(secretPath);
await actions.inputSecretPath(secretPath);
await (await elements.moreOptionsButton()).click();
// NOTE: passwordElement.click() causes "Element <input id="..." type="checkbox"> is not clickable at point because another element <div class="..."> obscures it"
await nativeClick(driver, await elements.passwordSwitch());
await (await elements.passwordInput()).sendKeys(filePassword);
Expand All @@ -245,31 +278,31 @@ describe('Piping UI', () => {
defer(() => senderDriver.quit());
await senderDriver.get(PIPING_UI_URL);
const senderElements = findElements(senderDriver);
const senderActions = getActions(senderDriver);

const transferFilePath = path.join(sharePath, "mydata.dat");
fs.writeFileSync(transferFilePath, transferContent);
defer(() => fs.rmSync(transferFilePath));
await (await senderElements.fileInput()).sendKeys(path.join(sharePathInDocker, "mydata.dat"));
await (await senderElements.secretPathInput()).sendKeys(secretPath);
await senderActions.inputSecretPath(secretPath);
// NOTE: e.click() causes "Element <input id="..." type="checkbox"> is not clickable at point because another element <div class="..."> obscures it"
await nativeClick(senderDriver, (await senderElements.passwordlessSwitch()));
await nativeClick(senderDriver, await senderElements.passwordlessSendAndVerifySwitch());
await new Promise(resolve => setTimeout(resolve, 1000));
await (await senderElements.sendButton()).click();

const receiverDriver = createDriver();
defer(() => receiverDriver.quit());
await receiverDriver.get(PIPING_UI_URL);
const receiverElements = findElements(receiverDriver);
const receiverActions = getActions(receiverDriver);

await (await receiverElements.getMenuButton()).click();
await (await receiverElements.secretPathInput()).sendKeys(secretPath);
// NOTE: e.click() causes "Element <input id="..." type="checkbox"> is not clickable at point because another element <div class="..."> obscures it"
await nativeClick(receiverDriver, await receiverElements.passwordlessSwitch());
await receiverActions.inputSecretPath(secretPath);
await new Promise(resolve => setTimeout(resolve, 1000));
await (await receiverElements.downloadButton()).click();

await new Promise(resolve => setTimeout(resolve, 2000));
await (await senderElements.verifySendButton0()).click();
await (await senderElements.passwordlessVerifiedButton0()).click();

const downloadedFilePath = path.join(downloadPath, secretPath);
await waitForDownload(downloadedFilePath);
Expand All @@ -289,31 +322,31 @@ describe('Piping UI', () => {
defer(() => senderDriver.quit());
await senderDriver.get(PIPING_UI_URL);
const senderElements = findElements(senderDriver);
const senderActions = getActions(senderDriver);

const transferFilePath = path.join(sharePath, "myimg.png");
fs.writeFileSync(transferFilePath, rayTracingPngImage);
defer(() => fs.rmSync(transferFilePath));
await (await senderElements.fileInput()).sendKeys(path.join(sharePathInDocker, "myimg.png"));
await (await senderElements.secretPathInput()).sendKeys(secretPath);
await senderActions.inputSecretPath(secretPath);
// NOTE: e.click() causes "Element <input id="..." type="checkbox"> is not clickable at point because another element <div class="..."> obscures it"
await nativeClick(senderDriver, (await senderElements.passwordlessSwitch()));
await nativeClick(senderDriver, await senderElements.passwordlessSendAndVerifySwitch());
await new Promise(resolve => setTimeout(resolve, 1000));
await (await senderElements.sendButton()).click();

const receiverDriver = createDriver();
defer(() => receiverDriver.quit());
await receiverDriver.get(PIPING_UI_URL);
const receiverElements = findElements(receiverDriver);
const receiverActions = getActions(receiverDriver);

await (await receiverElements.getMenuButton()).click();
await (await receiverElements.secretPathInput()).sendKeys(secretPath);
// NOTE: e.click() causes "Element <input id="..." type="checkbox"> is not clickable at point because another element <div class="..."> obscures it"
await nativeClick(receiverDriver, await receiverElements.passwordlessSwitch());
await receiverActions.inputSecretPath(secretPath);
await new Promise(resolve => setTimeout(resolve, 1000));
await (await receiverElements.viewButton()).click();

await new Promise(resolve => setTimeout(resolve, 2000));
await (await senderElements.verifySendButton0()).click();
await (await senderElements.passwordlessVerifiedButton0()).click();

const imageBlobUrl = await (await waitFor(() => receiverElements.image0InView())).getAttribute("src");
const shownFileContent = await getBufferByBlobUrl(receiverDriver, imageBlobUrl);
Expand Down
Loading

0 comments on commit 932ea1b

Please sign in to comment.