forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[explorer] Convert some tests to localnet tests (MystenLabs#4580)
- Loading branch information
1 parent
4403ac9
commit 4c06153
Showing
6 changed files
with
101 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) 2022, Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
Cypress.config('baseUrl', 'http://localhost:3000'); | ||
|
||
describe('Address', () => { | ||
it('can be directly visted', () => { | ||
cy.task('faucet').then((address) => { | ||
cy.visit(`/addresses/${address}`); | ||
cy.get('#addressID').contains(address); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) 2022, Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
Cypress.config('baseUrl', 'http://localhost:3000'); | ||
|
||
describe('Objects', () => { | ||
it('can be reached through URL', () => { | ||
cy.task('faucet') | ||
.then((address) => cy.task('mint', address)) | ||
.then(({ effects }) => { | ||
const { objectId } = effects.created![0].reference; | ||
cy.visit(`/objects/${objectId}`); | ||
cy.get('#objectID').contains(objectId); | ||
}); | ||
}); | ||
|
||
it('displays an error when no objects', () => { | ||
cy.visit(`/objects/fakeAddress`); | ||
cy.get('#errorResult'); | ||
}); | ||
|
||
describe('Owned Objects', () => { | ||
it('link going from address to object and back', () => { | ||
cy.task('faucet') | ||
.then((address) => cy.task('mint', address)) | ||
.then(({ certificate, effects }) => { | ||
const address = certificate.data.sender; | ||
const [nft] = effects.created!; | ||
cy.visit(`/addresses/${address}`); | ||
|
||
// Find a reference to the NFT: | ||
cy.contains(nft.reference.objectId.slice(0, 4)).click(); | ||
cy.get('#objectID').contains(nft.reference.objectId); | ||
|
||
// Find a reference to the owning address: | ||
cy.contains(address).click(); | ||
cy.get('#addressID').contains(address); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
// Copyright (c) 2022, Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
/* eslint-disable @typescript-eslint/consistent-type-imports */ | ||
|
||
/// <reference types="cypress" /> | ||
|
||
declare namespace Cypress { | ||
interface Chainable { | ||
task(name: 'faucet', arg?: unknown): Chainable<string>; | ||
task( | ||
name: 'mint', | ||
address?: string | ||
): Chainable<import('@mysten/sui.js').SuiTransactionResponse>; | ||
} | ||
} |