mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
IPFS publish & consume integration tests
This commit is contained in:
parent
c6f5f8561c
commit
752498d6b3
1
.gitignore
vendored
1
.gitignore
vendored
@ -26,4 +26,5 @@ yarn-error.log*
|
||||
cypress/screenshots
|
||||
cypress/videos
|
||||
cypress/fixtures/did.txt
|
||||
cypress/fixtures/did-ipfs.txt
|
||||
artifacts
|
||||
|
@ -1,6 +1,6 @@
|
||||
/// <reference types="Cypress" />
|
||||
context('Publish', () => {
|
||||
before(() => {
|
||||
describe('Publish', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/publish')
|
||||
|
||||
cy.get('article>div', { timeout: 60000 }).should(
|
||||
@ -9,7 +9,7 @@ context('Publish', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('Publish flow', () => {
|
||||
it('should publish https:// file', () => {
|
||||
// Fill title
|
||||
cy.get('input#name').type('Commons Integration Test')
|
||||
// Open Add a file form
|
||||
@ -76,4 +76,72 @@ context('Publish', () => {
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
it('should publish ipfs:// file', () => {
|
||||
// Fill title
|
||||
cy.get('input#name').type('Commons Integration IPFS Test')
|
||||
// Open Add a file form
|
||||
cy.get('button')
|
||||
.contains('+ From URL')
|
||||
.click()
|
||||
// Fill url of file
|
||||
cy.get('input#url').type(
|
||||
'ipfs://QmX5LRpEVocfks9FNDnRoK2imf2fy9mPpP4wfgaDVXWfYD/video.mp4'
|
||||
)
|
||||
// Add file to main form
|
||||
cy.get('button')
|
||||
.contains('Add File')
|
||||
.click()
|
||||
// Verify and nove to next step
|
||||
cy.get('button')
|
||||
.contains('Next →')
|
||||
.should('not.be.disabled')
|
||||
.click()
|
||||
// Verify we are on next step
|
||||
cy.get('article>div').should('contain', 'Information')
|
||||
// Fill description
|
||||
cy.get('textarea#description').type('This is test description')
|
||||
// Pick category
|
||||
cy.get('select#categories').select('Biology')
|
||||
// Verify and move to next step
|
||||
cy.get('button')
|
||||
.contains('Next →')
|
||||
.should('not.be.disabled')
|
||||
.click()
|
||||
// Verify we are on next step
|
||||
cy.get('article>div').should('contain', 'Authorship')
|
||||
// Fill author
|
||||
cy.get('input#author').type('Super Author')
|
||||
// Fill copyright holder
|
||||
cy.get('input#copyrightHolder').type('Super Copyright Holder')
|
||||
// Pick author
|
||||
cy.get('select#license').select('Public Domain')
|
||||
// Verify and move to next step
|
||||
cy.get('button')
|
||||
.contains('Next →')
|
||||
.should('not.be.disabled')
|
||||
.click()
|
||||
// Verify we are on next step
|
||||
cy.get('article>div').should('contain', 'Register')
|
||||
// Start publish process
|
||||
cy.get('button')
|
||||
.contains('Register asset')
|
||||
.should('not.be.disabled')
|
||||
.click()
|
||||
// Wait for finish
|
||||
cy.contains('Your asset is published!', {
|
||||
timeout: 12000
|
||||
}).should('be.visible')
|
||||
|
||||
// Store DID
|
||||
cy.get('a')
|
||||
.contains('See published asset')
|
||||
.invoke('attr', 'href')
|
||||
.then(href => {
|
||||
cy.writeFile(
|
||||
'cypress/fixtures/did-ipfs.txt',
|
||||
href.replace('/asset/', '')
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -1,12 +1,12 @@
|
||||
/// <reference types="Cypress" />
|
||||
context('Search', () => {
|
||||
describe('Search', () => {
|
||||
before(() => {
|
||||
cy.visit('/')
|
||||
// Wait for end of loading
|
||||
cy.get('button', { timeout: 60000 }).should('have.length', 1)
|
||||
})
|
||||
|
||||
it('Search for assets from homepage', () => {
|
||||
it('should search for assets from homepage', () => {
|
||||
// Fill search phrase
|
||||
cy.get('input#search').type('Title test')
|
||||
// Start search
|
||||
|
@ -1,6 +1,6 @@
|
||||
/// <reference types="Cypress" />
|
||||
context('Consume', () => {
|
||||
before(() => {
|
||||
describe('Consume', () => {
|
||||
beforeEach(() => {
|
||||
cy.fixture('did').then(did => {
|
||||
cy.visit(`/asset/${did}`)
|
||||
})
|
||||
@ -15,7 +15,38 @@ context('Consume', () => {
|
||||
cy.get('button[name="Download"]').should('not.be.disabled')
|
||||
})
|
||||
|
||||
it('Consume asset and check if there is no error', () => {
|
||||
it('should consume https:// file', () => {
|
||||
// eslint-disable-next-line
|
||||
cy.wait(10000)
|
||||
// Wait for faucet
|
||||
// Click consume button
|
||||
cy.get('button[name="Download"]').click()
|
||||
// Wait consume process to end
|
||||
cy.get('button[name="Download"]', { timeout: 600000 }).should(
|
||||
'contain',
|
||||
'Get file'
|
||||
)
|
||||
// check if there is no error
|
||||
cy.get('article>div').should(
|
||||
'not.contain',
|
||||
'. Sorry about that, can you try again?'
|
||||
)
|
||||
// eslint-disable-next-line
|
||||
cy.wait(10000)
|
||||
// wait for file to download before closing browser
|
||||
// to prevent alert poping up
|
||||
})
|
||||
|
||||
it('should consume ipfs:// file', () => {
|
||||
cy.fixture('did-ipfs').then(did => {
|
||||
cy.visit(`/asset/${did}`)
|
||||
})
|
||||
|
||||
// Alias button selector & wait for end of loading
|
||||
cy.get('button[name="Download"]', { timeout: 60000 })
|
||||
.first()
|
||||
.should('have.length', 1)
|
||||
|
||||
// eslint-disable-next-line
|
||||
cy.wait(10000)
|
||||
// Wait for faucet
|
||||
|
@ -1,5 +1,5 @@
|
||||
/// <reference types="Cypress" />
|
||||
context('Faucet', () => {
|
||||
describe('Faucet', () => {
|
||||
before(() => {
|
||||
cy.visit('/faucet')
|
||||
// Wait for end of loading
|
||||
@ -21,7 +21,7 @@ context('Faucet', () => {
|
||||
.should('not.be.disabled')
|
||||
})
|
||||
|
||||
it('Execute faucet call', () => {
|
||||
it('should execute faucet call', () => {
|
||||
// Execute call
|
||||
cy.get('@button')
|
||||
.contains('Request ETH')
|
||||
|
Loading…
Reference in New Issue
Block a user