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

Run NFTs e2e tests on a controlled wallet address #3487

Merged
merged 4 commits into from
Jun 20, 2023

Conversation

michalinacienciala
Copy link
Contributor

@michalinacienciala michalinacienciala commented Jun 19, 2023

Previously we run tests by importing bravonaver.eth address as a read-only account. We don't control that address and can't guarantee that it's state won't change (changes may lead to unstable tests). Now we're switching to importing the third address of the testertesting.eth account (0x6f1b1f1feb01235e15a7962f16c389c7f8218ed6) as a read-only. We control this address and can decide on its state.

Latest build: extension-builds-3487 (as of Tue, 20 Jun 2023 20:39:00 GMT).

Previously we run tests by importing `bravonaver.eth` address as a read-only
account. We don't control that address and can't guarantee that it's state won't
change (changes may lead to unstable tests). Now we're switching to importing
the third address of the `testertesting.eth` account
(`0x6f1b1f1feb01235e15a7962f16c389c7f8218ed6`) as a read-only. We control this
address and can decide on its state.
@michalinacienciala michalinacienciala marked this pull request as ready for review June 19, 2023 07:44
@michalinacienciala michalinacienciala requested a review from a team June 19, 2023 07:44
@michalinacienciala
Copy link
Contributor Author

I re-run the workflow with tests a couple of times to make sure it's not randomly failing - all executions were green: https://github.com/tahowallet/extension/actions/runs/5308837549.

@michalinacienciala michalinacienciala self-assigned this Jun 19, 2023
jagodarybacka
jagodarybacka previously approved these changes Jun 19, 2023
Copy link
Contributor

@jagodarybacka jagodarybacka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great, some ideas for improvements but non-blocking, lmk if you want to apply it here or later 😄

@@ -36,10 +36,30 @@ test.describe("NFTs", () => {
}
})

await walletPageHelper.onboarding.addReadOnlyAccount("bravonaver.eth")
await walletPageHelper.onboarding.addReadOnlyAccount(
"0x6f1b1f1feb01235e15a7962f16c389c7f8218ed6"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we plan to reuse that address for other e2e tests? Then we can make it a variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a particular test in mind yet where we would reuse it. Let's leave it as it is for now - if we introduce the test which uses the same account, we can parametrize this then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should put it in a named constant regardless—no magic strings please!

Comment on lines 48 to 52
await page.getByTestId("top_menu_network_switcher").last().click()
await page.getByText(/^Optimism$/).click()
await expect(
page.getByTestId("top_menu_network_switcher").last()
).toHaveText(/^Optimism$/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about making it a util function where you just specify what network you want to switch to?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I'll add this in this PR once I finish other work I'm doing rn.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 602e12b.

@@ -70,7 +90,9 @@ test.describe("NFTs", () => {

await page
.getByTestId("nft_account_filters")
.filter({ hasText: "bravonaver.eth" })
.filter({
hasText: /^(Phoenix|Matilda|Sirius|Topa|Atos|Sport|Lola|Foz)$/,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to buy/mint maybe a unstoppable domains address for this account so we can use it as a label?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good point, displaying the label based on UNS/ENS is a functionality related to NFTs, so it makes sense to test it in this test. Will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I will be able to buy the domain myself, but had to ask Ops. Let's maybe not wait for that to get processed and merge the PR as it is... I'll update the account name in a separate PR once we have the domain secured - wdyt?

Copy link
Contributor

@Shadowfiend Shadowfiend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapproving because I did it too soon <_<

@Shadowfiend Shadowfiend merged commit 98bf4ef into main Jun 20, 2023
@Shadowfiend Shadowfiend deleted the fix-failing-nft-e2e-test branch June 20, 2023 20:32
@jagodarybacka jagodarybacka mentioned this pull request Jun 22, 2023
jagodarybacka added a commit that referenced this pull request Jun 23, 2023
## What's Changed
* Repeater Connection: Forward requests to new default when default is
switched off during dApp connection flow by @Shadowfiend in
#3462
* Auto-Not-So-Matic: Fix two matic.network URLs to polygon.technology by
@Shadowfiend in #3483
* v0.38.0 by @kkosiorowska in
#3480
* Case Dismissed: Forcibly show DAppConnectionInfoBar popover on first
dApp connection by @Shadowfiend in
#3464
* Add Hardhat Fork Functionality by @0xDaedalus in
#3247
* Faded Jeans: Rename fadeIn class to fade_in by @Shadowfiend in
#3485
* Fix issue for discovery transaction hash by @kkosiorowska in
#3458
* Full Sweep: Drop the USE_UPDATED_SIGNING_UI feature flag by
@Shadowfiend in #3475
* Token Discovery - Remap redux asset balances by @hyphenized in
#3195
* Make specific warnings for adding custom asset by @kkosiorowska in
#3478
* Run NFTs e2e tests on a controlled wallet address by
@michalinacienciala in #3487
* v0.38.1 by @jagodarybacka in
#3484


**Full Changelog**:
v0.38.1...v0.39.0
Latest build:
[extension-builds-3496](https://github.com/tahowallet/extension/suites/13792957673/artifacts/764738599)
(as of Thu, 22 Jun 2023 14:27:32 GMT).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants