diff --git a/.gitignore b/.gitignore
index f0d1969..5132172 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,4 +26,5 @@ yarn-error.log*
cypress/screenshots
cypress/videos
cypress/fixtures/did.txt
+cypress/fixtures/did-ipfs.txt
artifacts
diff --git a/cypress/integration/1_publish.spec.js b/cypress/integration/1_publish.spec.js
index 000ea74..cab9160 100644
--- a/cypress/integration/1_publish.spec.js
+++ b/cypress/integration/1_publish.spec.js
@@ -1,6 +1,6 @@
///
-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/', '')
+ )
+ })
+ })
})
diff --git a/cypress/integration/2_search.spec.js b/cypress/integration/2_search.spec.js
index 577b9db..e41695f 100644
--- a/cypress/integration/2_search.spec.js
+++ b/cypress/integration/2_search.spec.js
@@ -1,12 +1,12 @@
///
-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
diff --git a/cypress/integration/3_consume.spec.js b/cypress/integration/3_consume.spec.js
index 07f37ef..187dff1 100644
--- a/cypress/integration/3_consume.spec.js
+++ b/cypress/integration/3_consume.spec.js
@@ -1,6 +1,6 @@
///
-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
diff --git a/cypress/integration/4_faucet.spec.js b/cypress/integration/4_faucet.spec.js
index 7b44ff1..0581727 100644
--- a/cypress/integration/4_faucet.spec.js
+++ b/cypress/integration/4_faucet.spec.js
@@ -1,5 +1,5 @@
///
-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')