1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00
commons/cypress/integration/1_publish.spec.js

80 lines
2.5 KiB
JavaScript
Raw Normal View History

2019-06-19 15:28:31 +02:00
/// <reference types="Cypress" />
context('Publish', () => {
before(() => {
cy.visit('/publish')
2019-06-19 15:28:31 +02:00
2019-06-20 13:41:11 +02:00
cy.get('article>div', { timeout: 60000 }).should(
2019-06-19 15:28:31 +02:00
'contain',
'Essentials'
)
})
it('Publish flow', () => {
// Fill title
cy.get('input#name').type('Commons Integration Test')
2019-06-19 15:28:31 +02:00
// 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!', {
2019-06-20 13:41:11 +02:00
timeout: 12000
2019-06-19 15:28:31 +02:00
}).should('be.visible')
// Store DID
cy.get('a')
.contains('See published asset')
.invoke('attr', 'href')
.then(href => {
cy.writeFile(
'cypress/fixtures/did.txt',
href.replace('/asset/', '')
)
})
2019-06-19 15:28:31 +02:00
})
})