-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #664 from europeana/develop
Merge Develop to Master for Sandbox v3
- Loading branch information
Showing
81 changed files
with
2,351 additions
and
1,033 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { cleanupUser, setupUser } from '../support/helpers'; | ||
|
||
context('metis-ui', () => { | ||
describe('mapping', () => { | ||
afterEach(() => { | ||
cleanupUser(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.server(); | ||
setupUser(); | ||
cy.visit('/dataset/mapping/0'); | ||
}); | ||
const force = { force: true }; | ||
const selBtnInitDefault = '[data-e2e=xslt-init-default]'; | ||
const selBtnTryDefaultXSLT = '[data-e2e=xslt-try-default]'; | ||
const selEditors = '.view-sample'; | ||
const selStatistics = '.view-statistics'; | ||
|
||
it('should show the statistics', () => { | ||
cy.get(selStatistics).should('have.length', 1); | ||
cy.get(selEditors).should('have.length', 1); | ||
}); | ||
|
||
it('should show try out XSLT', () => { | ||
const btnLabel = 'Go back to Mapping'; | ||
|
||
cy.get('button') | ||
.contains(btnLabel) | ||
.should('not.exist'); | ||
cy.url().should('not.contain', '/preview'); | ||
cy.url().should('contain', '/mapping'); | ||
|
||
cy.get(selBtnTryDefaultXSLT) | ||
.first() | ||
.click(); | ||
|
||
cy.url().should('contain', '/preview'); | ||
cy.url().should('not.contain', '/mapping'); | ||
cy.get('button') | ||
.contains(btnLabel) | ||
.should('have.length', 1); | ||
cy.get('button') | ||
.contains(btnLabel) | ||
.click(force); | ||
cy.url().should('not.contain', '/preview'); | ||
cy.url().should('contain', '/mapping'); | ||
}); | ||
|
||
it('should initialise an editor with the default XSLT', () => { | ||
cy.get(selBtnInitDefault).should('have.length', 0); | ||
cy.visit('/dataset/mapping/1'); | ||
cy.get(selBtnInitDefault).should('have.length', 1); | ||
|
||
cy.get(selEditors).should('have.length', 1); | ||
cy.get(selBtnInitDefault).click(); | ||
cy.get(selEditors).should('have.length', 2); | ||
|
||
cy.get('button') | ||
.contains('Cancel') | ||
.should('have.length', 1); | ||
cy.get('button') | ||
.contains('Reset to default XSLT') | ||
.should('have.length', 1); | ||
cy.get('button') | ||
.contains('Save') | ||
.should('have.length', 1); | ||
cy.get('button') | ||
.contains('Save XSLT & Try it out') | ||
.should('have.length', 1); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { cleanupUser, setupUser } from '../support/helpers'; | ||
|
||
context('metis-ui', () => { | ||
describe('report', () => { | ||
const force = { force: true }; | ||
const selectorModal = '.modal'; | ||
const selectorOpener = '.table-grid [data-e2e=open-report]'; | ||
const selectorDownloadLink = `${selectorModal} .btn-download`; | ||
const selectorDownloadError = `${selectorModal} .download-error`; | ||
|
||
beforeEach(() => { | ||
cy.server(); | ||
setupUser(); | ||
cy.visit('/dataset/log/0'); | ||
cy.wait(1000); | ||
}); | ||
|
||
afterEach(() => { | ||
cleanupUser(); | ||
}); | ||
|
||
it('should open the report', () => { | ||
cy.get(selectorModal).should('not.exist'); | ||
cy.get(selectorOpener).should('have.length.gt', 1); | ||
cy.get(selectorOpener) | ||
.eq(2) | ||
.click(force); | ||
cy.get(selectorModal).should('have.length', 1); | ||
}); | ||
|
||
it('should offer downloads for non-harvest topologies', () => { | ||
cy.get(selectorOpener) | ||
.first() | ||
.click(force); | ||
cy.get(selectorDownloadLink).should('have.length', 3); | ||
}); | ||
|
||
it('should not offer downloads for harvest topologies', () => { | ||
cy.get(selectorOpener) | ||
.last() | ||
.click(force); | ||
cy.get(selectorDownloadLink).should('not.exist'); | ||
}); | ||
|
||
it('should handle downloads', () => { | ||
cy.get(selectorOpener) | ||
.first() | ||
.click(force); | ||
cy.get(selectorDownloadLink) | ||
.last() | ||
.click(force); | ||
cy.get(selectorDownloadError).should('not.exist'); | ||
}); | ||
|
||
it('should handle download fails', () => { | ||
cy.get(selectorOpener) | ||
.first() | ||
.click(force); | ||
cy.get(selectorDownloadLink) | ||
.first() | ||
.click(force); | ||
cy.get(selectorDownloadError).should('have.length', 1); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { XmlSample } from '../_models'; | ||
|
||
export function triggerXmlDownload(xml?: XmlSample): void { | ||
if (xml) { | ||
const anchor = document.createElement('a'); | ||
anchor.href = `data:text/xml,${encodeURIComponent(xml.xmlRecord)}`; | ||
anchor.target = '_blank'; | ||
anchor.download = `record-${xml.ecloudId}.xml`; | ||
document.body.appendChild(anchor); | ||
anchor.click(); | ||
document.body.removeChild(anchor); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.