From c2e2606133879e2aac7e00d59f4a76eca40288bb Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 19 Jul 2019 16:38:29 +0200 Subject: [PATCH] run cypress tests in specific order, store and read published DID --- .gitignore | 1 + cypress.json | 5 +---- .../{publish.spec.js => 1_publish.spec.js} | 11 +++++++++++ .../integration/{search.spec.js => 2_search.spec.js} | 0 .../{consume.spec.js => 3_consume.spec.js} | 4 +++- .../integration/{faucet.spec.js => 4_faucet.spec.js} | 0 6 files changed, 16 insertions(+), 5 deletions(-) rename cypress/integration/{publish.spec.js => 1_publish.spec.js} (87%) rename cypress/integration/{search.spec.js => 2_search.spec.js} (100%) rename cypress/integration/{consume.spec.js => 3_consume.spec.js} (91%) rename cypress/integration/{faucet.spec.js => 4_faucet.spec.js} (100%) diff --git a/.gitignore b/.gitignore index 9366864..a2ec474 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ yarn-error.log* # cypress cypress/screenshots cypress/videos +cypress/fixtures/did.txt diff --git a/cypress.json b/cypress.json index dcd7dbb..17ef242 100644 --- a/cypress.json +++ b/cypress.json @@ -1,6 +1,3 @@ { - "baseUrl": "http://localhost:3000", - "env": { - "CONSUME_ASSET": "did:op:3fa4721ad643489bad77e0e52ecefe9b73166873faaf4661a02486b735eea0c8" - } + "baseUrl": "http://localhost:3000" } diff --git a/cypress/integration/publish.spec.js b/cypress/integration/1_publish.spec.js similarity index 87% rename from cypress/integration/publish.spec.js rename to cypress/integration/1_publish.spec.js index 40be219..452e3d8 100644 --- a/cypress/integration/publish.spec.js +++ b/cypress/integration/1_publish.spec.js @@ -64,5 +64,16 @@ context('Publish', () => { 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.txt', + href.replace('/asset/', '') + ) + }) }) }) diff --git a/cypress/integration/search.spec.js b/cypress/integration/2_search.spec.js similarity index 100% rename from cypress/integration/search.spec.js rename to cypress/integration/2_search.spec.js diff --git a/cypress/integration/consume.spec.js b/cypress/integration/3_consume.spec.js similarity index 91% rename from cypress/integration/consume.spec.js rename to cypress/integration/3_consume.spec.js index 95bd8b7..ddb1ef9 100644 --- a/cypress/integration/consume.spec.js +++ b/cypress/integration/3_consume.spec.js @@ -1,7 +1,9 @@ /// context('Consume', () => { before(() => { - cy.visit(`/asset/${Cypress.env('CONSUME_ASSET')}`) + cy.fixture('did').then(did => { + cy.visit(`/asset/${did}`) + }) // Alias button selector & wait for end of loading cy.get('button[name="Download"]', { timeout: 60000 }) diff --git a/cypress/integration/faucet.spec.js b/cypress/integration/4_faucet.spec.js similarity index 100% rename from cypress/integration/faucet.spec.js rename to cypress/integration/4_faucet.spec.js