1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00
commons/cypress/integration/publish.spec.js
Jernej Pregelj 643d5a3c84 squid 0.6.1
2019-06-25 10:17:43 +02:00

85 lines
2.8 KiB
JavaScript

/// <reference types="Cypress" />
import Web3 from 'web3'
import HDWalletProvider from 'truffle-hdwallet-provider'
context('Publish', () => {
before(() => {
cy.on('window:before:load', win => {
const provider = new HDWalletProvider(
Cypress.env('SEEDPHRASE')
? Cypress.env('SEEDPHRASE')
: 'taxi music thumb unique chat sand crew more leg another off lamp',
Cypress.env('NODE_URI')
? Cypress.env('NODE_URI')
: 'https://pacific.oceanprotocol.com'
)
win.web3 = new Web3(provider)
win.ethereum = win.web3
})
cy.visit('http://localhost:3000/publish')
cy.get('article>div', { timeout: 60000 }).should(
'contain',
'Essentials'
)
})
it('Publish flow', () => {
// Fill title
cy.get('input#name').type('Title test')
// Open Add a file form
cy.get('button')
.contains('+ Add a file')
.click()
// Fill url of file
cy.get('input#url').type(
'https://oceanprotocol.com/tech-whitepaper.pdf'
)
// 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')
})
})