Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2021-12-06 #1806

Merged
merged 44 commits into from
Dec 8, 2021
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
fc48fd1
add template for pull requests (#1751)
asnaith Nov 16, 2021
b21a7b8
Bump ssri from 6.0.1 to 6.0.2 (#1747)
dependabot[bot] Nov 16, 2021
92abc31
Bump merge-deep from 3.0.2 to 3.0.3 (#1744)
dependabot[bot] Nov 16, 2021
9784c12
Bump dns-packet from 1.3.1 to 1.3.4 (#1745)
dependabot[bot] Nov 16, 2021
3599ee4
Bump tmpl from 1.0.4 to 1.0.5 (#1741)
dependabot[bot] Nov 16, 2021
6337f63
Bump path-parse from 1.0.6 to 1.0.7 (#1742)
dependabot[bot] Nov 16, 2021
71e7d7e
Bump color-string from 1.5.3 to 1.6.0 (#1743)
dependabot[bot] Nov 16, 2021
4e64f03
Bump hosted-git-info from 2.8.8 to 2.8.9 (#1746)
dependabot[bot] Nov 16, 2021
9addf3e
bump cypress to v9.0 (#1749)
asnaith Nov 16, 2021
6674c0f
Bump url-parse from 1.4.7 to 1.5.3 (#1748)
dependabot[bot] Nov 16, 2021
f994607
Link sharing redesign (#1722)
Tbaut Nov 16, 2021
328b402
Resolved (#1731)
RyRy79261 Nov 16, 2021
0062f31
Add subdirectory for pr template (#1756)
asnaith Nov 17, 2021
d80d513
add test for hotkey navigation in file preview (#1755)
asnaith Nov 17, 2021
9c52fbe
fix video preview overflow (#1752)
FSM1 Nov 17, 2021
ef5e677
Share files from browser support (#1736)
tanmoyAtb Nov 18, 2021
7170268
Revert "copy working" (#1759)
FSM1 Nov 19, 2021
9dc9db8
Translations update from Hosted Weblate (#1753)
weblate Nov 22, 2021
c2ee766
[ImgBot] Optimize images (#1767)
imgbot[bot] Nov 22, 2021
4e867ca
Report modal styles and cut off fix (#1766)
tanmoyAtb Nov 23, 2021
ea0e03f
Fix Mobile Nav Drawer blocks breadcrumb (#1768)
FSM1 Nov 23, 2021
57028b1
secondary colors update (#1769)
tanmoyAtb Nov 23, 2021
99c3cce
File info modal CID and Key copy arrangements (#1773)
tanmoyAtb Nov 24, 2021
a011e6f
fix share transfer modal alignment (#1774)
FSM1 Nov 24, 2021
d1d8b62
move pr template to .github root dir (#1776)
asnaith Nov 24, 2021
484b7f1
UI fix (#1777)
tanmoyAtb Nov 25, 2021
2c1ea37
resolve double tap (#1778)
FSM1 Nov 25, 2021
1335725
Mobile sharing folder rename modal (#1779)
RyRy79261 Nov 25, 2021
ffa9706
Rename with split extension (#1760)
RyRy79261 Nov 25, 2021
d4b978e
Add ui test coverage for link creation / deletion (#1775)
asnaith Nov 26, 2021
c50aca3
Translated using Weblate (French) (#1784)
weblate Nov 29, 2021
e2dc429
Bump Cypress to 9.1 (#1785)
Tbaut Nov 30, 2021
a31313b
removing gaming dashboard from monorepo (#1790)
FSM1 Dec 1, 2021
85401e9
Fix 0 randomly appearing (#1789)
Tbaut Dec 1, 2021
44fe032
Fix typing issues that appeared with cypress v9.1 upgrade (#1791)
Tbaut Dec 1, 2021
f8e65e3
Edit PR template (#1798)
Tbaut Dec 2, 2021
f1e3828
Heic loader (#1765)
RyRy79261 Dec 2, 2021
9149d5e
change for create (#1797)
Tbaut Dec 3, 2021
9f9e397
attempt fixing storybook build (#1801)
FSM1 Dec 3, 2021
e611241
add sorting header for mobile file browser (#1786)
FSM1 Dec 6, 2021
2139dba
Add header content for selected (#1796)
FSM1 Dec 7, 2021
4674382
Translated using Weblate (French) (#1811)
weblate Dec 7, 2021
f2922a9
fix breaking tests (#1813)
FSM1 Dec 8, 2021
e3778cf
Enforce props on a new line for multiline components (#1807)
Tbaut Dec 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix typing issues that appeared with cypress v9.1 upgrade (#1791)
* no 0 anymore

* more succint

* lingui extract

* fix typing and definitions

* unneeded index.d.ts

* undo other commit

* unneeded void

* Use a new random user for every test run (#1792)

* new user every time

* banner test with old test user

Co-authored-by: GitHub Actions <actions@github.com>
Co-authored-by: Michael Yankelev <12774278+FSM1@users.noreply.github.com>
3 people authored Dec 1, 2021
commit 44fe032125fa1becedd618bcc64d53cfb4a424cf
81 changes: 53 additions & 28 deletions packages/files-ui/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -26,17 +26,16 @@
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

import { authenticationPage } from "./page-objects/authenticationPage"
import { apiTestHelper } from "./utils/apiTestHelper"
import { apiTestHelper, ClearBucketType } from "./utils/apiTestHelper"
import { ethers, Wallet } from "ethers"
import { homePage } from "./page-objects/homePage"
import { testPrivateKey, testAccountPassword, localHost } from "../fixtures/loginData"
import { CustomizedBridge } from "./utils/CustomBridge"
import "cypress-file-upload"
import "cypress-pipe"
import { BucketType } from "@chainsafe/files-api-client"
import { navigationMenu } from "./page-objects/navigationMenu"

Cypress.Commands.add("clearBucket", (bucketType: BucketType) => {
Cypress.Commands.add("clearBucket", (bucketType: ClearBucketType) => {
apiTestHelper.clearBucket(bucketType)
})

@@ -47,6 +46,7 @@ export interface Web3LoginOptions {
clearCSFBucket?: boolean
clearTrashBucket?: boolean
deleteShareBucket?: boolean
withNewUser?: boolean
}

Cypress.Commands.add(
@@ -56,40 +56,58 @@ Cypress.Commands.add(
url = localHost,
clearCSFBucket = false,
clearTrashBucket = false,
deleteShareBucket = false
deleteShareBucket = false,
withNewUser = true
}: Web3LoginOptions = {}) => {

cy.on("window:before:load", (win) => {
const provider = new ethers.providers.JsonRpcProvider(
"https://rinkeby.infura.io/v3/4bf032f2d38a4ed6bb975b80d6340847",
4
)
const signer = new Wallet(testPrivateKey, provider)
const signer = withNewUser
? Wallet.createRandom()
: new Wallet(testPrivateKey, provider)
// inject ethereum object in the global window
Object.defineProperty(win, "ethereum", {
get: () => new CustomizedBridge(signer as any, provider as any)
get: () => new CustomizedBridge(signer as any, signer.address, provider as any)
})
})

// with nothing in localstorage (and in session storage)
// the whole login flow should kick in
cy.session("web3login", () => {
cy.visit(url)
authenticationPage.web3Button().click()
authenticationPage.showMoreButton().click()
authenticationPage.detectedWallet().click()
authenticationPage.web3SignInButton().safeClick()
authenticationPage.loginPasswordButton().click()
authenticationPage.loginPasswordInput().type(`${testAccountPassword}{enter}`)

if (saveBrowser) {
// this is taking forever for test accounts
authenticationPage.saveBrowserButton().click()
} else {
authenticationPage.doNotSaveBrowserButton().click()
}
homePage.appHeaderLabel().should("be.visible")
})
if (withNewUser){
cy.session("web3loginNewUser", () => {
cy.visit(url)
authenticationPage.web3Button().click()
authenticationPage.showMoreButton().click()
authenticationPage.detectedWallet().click()
authenticationPage.web3SignInButton().safeClick()
authenticationPage.signInExplainerContinueButton().safeClick()
// we are using the testAccount password here, but we could input anything
authenticationPage.signInSetupPasswordInput().type(`${testAccountPassword}`)
authenticationPage.signInSetupPasswordVerificationInput().type(`${testAccountPassword}{enter}`)

homePage.appHeaderLabel().should("be.visible")
})
} else {
cy.session("web3loginTestUser", () => {
cy.visit(url)
authenticationPage.web3Button().click()
authenticationPage.showMoreButton().click()
authenticationPage.detectedWallet().click()
authenticationPage.web3SignInButton().safeClick()
authenticationPage.loginPasswordButton().click()
authenticationPage.loginPasswordInput().type(`${testAccountPassword}{enter}`)

if (saveBrowser) {
// this is taking forever for test accounts
authenticationPage.saveBrowserButton().click()
} else {
authenticationPage.doNotSaveBrowserButton().click()
}
homePage.appHeaderLabel().should("be.visible")
})
}


cy.visit(url)
homePage.appHeaderLabel().should("be.visible")
@@ -115,7 +133,7 @@ Cypress.Commands.add(
}
)

Cypress.Commands.add("safeClick", { prevSubject: "element" }, $element => {
Cypress.Commands.add("safeClick", { prevSubject: "element" }, ($element?: JQuery<HTMLElement>) => {
const click = ($el: JQuery<HTMLElement>) => $el.trigger("click")
return cy
.wrap($element)
@@ -137,9 +155,10 @@ declare global {
* @param {Boolean} options.clearCSFBucket - (default: false) - whether any file in the csf bucket should be deleted.
* @param {Boolean} options.clearTrashBucket - (default: false) - whether any file in the trash bucket should be deleted.
* @param {Boolean} options.deleteShareBucket - (default: false) - whether any shared bucket should be deleted.
* @param {Boolean} options.withNewUser - (default: true) - whether to create a new user for this session.
* @example cy.web3Login({saveBrowser: true, url: 'http://localhost:8080'})
*/
web3Login: (options?: Web3LoginOptions) => Chainable
web3Login: (options?: Web3LoginOptions) => void

/**
* Use this when encountering race condition issues resulting in
@@ -153,8 +172,14 @@ declare global {
* https://github.com/cypress-io/cypress/issues/7306
*
*/
safeClick: () => Chainable
safeClick: ($element?: JQuery<HTMLElement>) => Chainable

/**
* Clear a bucket.
* @param {BucketType} - what bucket type to clear for this user.
* @example cy.clearBucket("csf")
*/
clearBucket: (bucketType: ClearBucketType) => void
}
}
}
Original file line number Diff line number Diff line change
@@ -12,6 +12,10 @@ export const authenticationPage = {
// sign in section elements
loginPasswordButton: () => cy.get("[data-cy=login-password-button]", { timeout: 20000 }),
loginPasswordInput: () => cy.get("[data-cy=login-password-input]"),
signInExplainerContinueButton: () => cy.get("[data-cy=button-sign-in-explainer-continue]", { timeout: 20000 }),
signInSetupPasswordInput: () => cy.get("[data-cy=input-sign-in-password]"),
signInSetupPasswordVerificationInput: () => cy.get("[data-cy=input-sign-in-password-verification]"),
signInSetupPasswordSubmitButton: () => cy.get("[data-cy=button-sign-in-password]"),

// save browser section elements
saveBrowserButton: () => cy.get("[data-cy=save-browser-button]"),
19 changes: 13 additions & 6 deletions packages/files-ui/cypress/support/utils/CustomBridge.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { Eip1193Bridge } from "@ethersproject/experimental/lib/eip1193-bridge"
import { ethers } from "ethers"
import { toUtf8String } from "ethers/lib/utils"
import { testAddress } from "../../fixtures/loginData"

export class CustomizedBridge extends Eip1193Bridge {
expectedAddress = ""

constructor(signer: ethers.Signer, address: string, provider?: ethers.providers.Provider) {
super(signer as any, provider as any)
this.expectedAddress = address
}

async sendAsync(...args: Array<any>) {
return this.send(...args)
}
@@ -30,17 +37,17 @@ export class CustomizedBridge extends Eip1193Bridge {
const message = params[0]

if (
(addr as string).toLowerCase() !== testAddress.toLowerCase()
(addr as string).toLowerCase() !== this.expectedAddress.toLowerCase()
) {
return Promise.reject(
`Wrong address, expected ${testAddress}, but got ${addr}`
`Wrong address, expected ${this.expectedAddress}, but got ${addr}`
)
}

try {
const sig = await this.signer.signMessage(toUtf8String(message))
return sig
} catch (e) {
} catch (e: any) {
return Promise.reject(
`Error in CustomizedBridge for personal_sign: ${e.message}`
)
@@ -49,9 +56,9 @@ export class CustomizedBridge extends Eip1193Bridge {

if (method === "eth_requestAccounts" || method === "eth_accounts") {
if (isCallbackForm) {
callback({ result: [testAddress] })
callback({ result: [this.expectedAddress] })
} else {
return Promise.resolve([testAddress])
return Promise.resolve([this.expectedAddress])
}
}

3 changes: 2 additions & 1 deletion packages/files-ui/cypress/support/utils/apiTestHelper.ts
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import { homePage } from "../page-objects/homePage"
const API_BASE_USE = "https://stage.imploy.site/api/v1"
const REFRESH_TOKEN_KEY = "csf.refreshToken"

export type ClearBucketType = Exclude<BucketType, "share" | "pinning" | "fps">
const getApiClient = () => {
// Disable the internal Axios JSON deserialization as this is handled by the client
const axiosInstance = axios.create({ transformResponse: [] })
@@ -34,7 +35,7 @@ export const apiTestHelper = {
})
})
},
clearBucket(bucketType: BucketType) {
clearBucket(bucketType: ClearBucketType) {
const apiClient = getApiClient()

return new Cypress.Promise(async (resolve) => {
13 changes: 9 additions & 4 deletions packages/files-ui/cypress/tests/survey-banner-spec.ts
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ describe("Survey Banner", () => {
body: { [dismissedSurveyKey]: "false" }
})

cy.web3Login()
cy.web3Login({ withNewUser: false })
homePage.surveyBanner().should("be.visible")

// set up a spy for the POST response
@@ -42,7 +42,7 @@ describe("Survey Banner", () => {
body: { [dismissedSurveyKey]: "true" }
})

cy.web3Login()
cy.web3Login({ withNewUser: false })
homePage.surveyBanner().should("not.exist")
})

@@ -51,7 +51,7 @@ describe("Survey Banner", () => {
body: {}
})

cy.web3Login()
cy.web3Login({ withNewUser: false })
homePage.surveyBanner().should("be.visible")
})

@@ -67,7 +67,12 @@ describe("Survey Banner", () => {
body: {}
})

cy.web3Login()
cy.web3Login({ withNewUser: false })
homePage.surveyBanner().should("not.exist")
})

it("A new user should not see the banner", () => {
cy.web3Login({ withNewUser: true })
homePage.surveyBanner().should("not.exist")
})
})
3 changes: 3 additions & 0 deletions packages/files-ui/src/Components/Elements/PasswordForm.tsx
Original file line number Diff line number Diff line change
@@ -104,13 +104,15 @@ const PasswordForm = ({ buttonLabel, setPassword }: Props) => {
label={t`Password:`}
labelClassName={classes.inputLabel}
captionMessage={<StrengthIndicator fieldName="password" />}
data-cy="input-sign-in-password"
/>
<FormikTextInput
type="password"
className={classes.input}
name="confirmPassword"
label={t`Confirm Password:`}
labelClassName={classes.inputLabel}
data-cy="input-sign-in-password-verification"
/>
<Button
className={clsx(classes.button, "passwordFormButton")}
@@ -119,6 +121,7 @@ const PasswordForm = ({ buttonLabel, setPassword }: Props) => {
type="submit"
loading={loading}
disabled={loading}
data-cy="button-sign-in-password"
>
{displayLabel}
</Button>
Original file line number Diff line number Diff line change
@@ -178,6 +178,7 @@ const ConciseExplainer: React.FC<IConciseExplainerProps> = ({ className, onConti
variant="primary"
onClick={onContinue}
className={classes.continue}
data-cy="button-sign-in-explainer-continue"
>
<Trans>
Continue