Skip to content
Snippets Groups Projects
Commit d241622b authored by David Beniamine's avatar David Beniamine
Browse files

Merge branch '4-integrate-upstream-tests' into 'annotation-on-video'

Integrate upstream tests into gitlab ci

Closes #4

See merge request iiif/mirador-video-annotation!4
parents 95e5ece6 b2c6ff20
No related branches found
No related tags found
No related merge requests found
Showing
with 72 additions and 29 deletions
......@@ -7,7 +7,6 @@
"page": true,
"document": true
},
"parser": "babel-eslint",
"plugins": ["jest"],
"rules": {
"import/prefer-default-export": "off",
......@@ -29,7 +28,16 @@
"natural": false
}],
"react/jsx-props-no-spreading": "off",
"react/function-component-definition": "off",
"default-param-last": "off",
"arrow-parens": "off",
"import/no-anonymous-default-export": "off"
"import/no-anonymous-default-export": "off",
"max-len": ["error", {
"code": 120,
"ignoreComments": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}]
}
}
......@@ -12,13 +12,16 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 17.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: ${{ matrix.node-version }}
- run: npm install -g codecov
- run: npm install
- run: npm test
......
dist/
coverage/
node_modules/
package-lock.json
*.log
*.tgz
upstream_tests:
image: ghcr.io/puppeteer/puppeteer:latest
before_script:
- npm ci
script:
- npm run test:ci
artifacts:
when: always
paths:
- junit.xml
reports:
junit: junit.xml
......@@ -39,6 +39,14 @@ If you are interested in integrating Mirador with plugins into your project, we
[https://github.com/ProjectMirador/mirador-integration](https://github.com/ProjectMirador/mirador-integration)
If you want to simply embed Mirador in an HTML page without further customization, include the Mirador UMD build:
```
<script src="https://unpkg.com/mirador@latest/dist/mirador.min.js"></script>
```
More examples of embedding Mirador can be found at [https://github.com/ProjectMirador/mirador/wiki/M3-Embedding-in-Another-Environment#in-an-html-document-with-javascript](https://github.com/ProjectMirador/mirador/wiki/M3-Embedding-in-Another-Environment#in-an-html-document-with-javascript).
## Adding translations to Mirador
For help with adding a translation, see [src/locales/README.md](src/locales/README.md)
......
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "http://example.com/iiif/manifest/related-urls.json",
"@type": "sc:Manifest",
"related": [
"http://example.com/related1",
{
"@id": "http://example.com/related2"
},
{
"@id": "http://example.com/related3",
"format": "text/html",
"label": "Something related"
}
]
}
......@@ -6,7 +6,7 @@ describe('Companion Windows', () => {
await expect(page).toFill('#manifestURL', 'http://127.0.0.1:4488/__tests__/fixtures/version-2/001.json');
await expect(page).toClick('#fetchBtn');
await expect(page).toClick('[data-manifestid="http://127.0.0.1:4488/__tests__/fixtures/version-2/001.json"] button');
await page.waitFor(300);
await page.waitForTimeout(300);
await expect(page).toMatchElement('.mirador-window');
});
......
......@@ -38,7 +38,7 @@
{ manifestId: "https://iiif.biblissima.fr/chateauroux/B360446201_MS0005/manifest.json", provider: "Biblissima"},
{ manifestId: "https://iiif.durham.ac.uk/manifests/trifle/32150/t1/m4/q7/t1m4q77fr328/manifest", provider: "Durham University Library"},
//{ manifestId: "https://iiif.vam.ac.uk/collections/O1023003/manifest.json", provider: "Ocean liners"},
{ manifestId: "https://zavicajna.digitalna.rs/iiif/iiif/api/presentation/3/96571949-03d6-478e-ab44-a2d5ad68f935%252F00000001%252Fostalo01%252F00000071/manifest", provider: "Библиотека 'Милутин Бојић'"},
{ manifestId: "https://zavicajna.digitalna.rs/iiif/api/presentation/3/96571949-03d6-478e-ab44-a2d5ad68f935%252F00000001%252Fostalo01%252F00000071/manifest", provider: "Библиотека 'Милутин Бојић'"},
]
});
</script>
......
......@@ -8,7 +8,7 @@ describe('Mirador Invalid API Response Handler Test', () => {
await page.evaluate(() => {
document.querySelector('.mirador-add-resource-button').click();
});
await page.waitFor(50);
await page.waitForTimeout(50);
await expect(page).toFill('#manifestURL', uri);
await expect(page).toClick('#fetchBtn');
......@@ -25,16 +25,12 @@ describe('Mirador Invalid API Response Handler Test', () => {
it('renders an error message when a manifest cannot be loaded (and allows it to be dismissed)', async () => {
await fetchManifest('http://127.0.0.1:4488/__tests__/fixtures/version-2/broken');
await expect(page).toMatchElement(
'p', { text: 'The resource cannot be added:', timeout: 2000 },
);
await expect(page).toMatchElement(
'p', { text: 'http://127.0.0.1:4488/__tests__/fixtures/version-2/broken' },
);
await expect(page).toMatchElement('p', { text: 'The resource cannot be added:', timeout: 2000 });
await expect(page).toMatchElement('p', { text: 'http://127.0.0.1:4488/__tests__/fixtures/version-2/broken' });
await expect(page).toClick('button', { text: 'Dismiss' });
await page.waitFor(() => !document.querySelector('li[data-manifestid="http://127.0.0.1:4488/__tests__/fixtures/version-2/broken"]'));
await page.waitForFunction(() => !document.querySelector('li[data-manifestid="http://127.0.0.1:4488/__tests__/fixtures/version-2/broken"]'));
await expect(page).not.toMatchElement(
'p',
......
......@@ -16,7 +16,7 @@ describe('Language Switching', () => {
await expect(page).toMatchElement('[aria-label="Start Here"]');
await expect(page).not.toMatchElement('[aria-label="Hier starten"]');
await expect(page).toClick('li', { text: 'Deutsch' });
await page.waitFor(1000);
await page.waitForTimeout(1000);
await expect(page).not.toMatchElement('[aria-label="Start Here"]');
await expect(page).toMatchElement('[aria-label="Hier starten"]');
});
......
......@@ -2,7 +2,7 @@ describe('add two plugins to <WorkspaceControlPanelButtons>', () => {
beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/add.html');
await expect(page).toMatchElement('.mirador-viewer');
await page.waitFor(1000);
await page.waitForTimeout(1000);
});
it('all add plugins will be added to <WorkspaceControlPanelButtons>', async () => {
......
......@@ -2,13 +2,13 @@ describe('add plugins for companion windows', () => {
beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/companionWindow.html');
await expect(page).toMatchElement('.mirador-viewer');
await page.waitFor(1000);
await page.waitForTimeout(1000);
});
it('added a plugin to the window sidebar and companion window', async () => {
await expect(page).toClick('button[aria-label="Toggle sidebar"]');
await page.waitFor(1000);
await page.waitForTimeout(1000);
await expect(page).toMatchElement('.mirador-companion-window-left.mirador-window-sidebar-info-panel');
await expect(page).toMatchElement('#add-plugin-companion-window-button');
......
......@@ -2,7 +2,7 @@ describe('try to apply 2 add plugins and 2 wrap plugins to <WorkspaceControlPane
beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/priority.html');
await expect(page).toMatchElement('.mirador-viewer');
await page.waitFor(1000);
await page.waitForTimeout(1000);
});
it('only apply the first wrap plugin', async () => {
......
......@@ -4,7 +4,7 @@ describe('how plugins relate to state', () => {
beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/state.html');
await expect(page).toMatchElement('.mirador-viewer');
await page.waitFor(1000);
await page.waitForTimeout(1000);
});
it('plugin can read from state', async () => {
......
......@@ -2,7 +2,7 @@ describe('pass valid and invalid plugins to <WorkspaceControlPanelButtons>', ()
beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/validate.html');
await expect(page).toMatchElement('.mirador-viewer');
await page.waitFor(1000);
await page.waitForTimeout(1000);
});
it('valid plugins will be applied <WorkspaceControlPanelButtons>', async () => {
......
......@@ -2,7 +2,7 @@ describe('wrap <WorkspaceControlPanelButtons> by a plugin', () => {
beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/wrap.html');
await expect(page).toMatchElement('.mirador-viewer');
await page.waitFor(1000);
await page.waitForTimeout(1000);
});
it('wraps <WorkspaceControlPanelButtons>', async () => {
......
......@@ -12,7 +12,7 @@ describe('Thumbnail navigation', () => {
miradorInstance.store.getState().windows
));
expect(Object.values(windows)[0].canvasId).toBe('https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174892'); // test harness in index.html starts at 2
await page.waitFor(1000);
await page.waitForTimeout(1000);
await expect(page).toClick('.mirador-thumbnail-nav-canvas-1 img');
await expect(page).toMatchElement('.mirador-thumbnail-nav-canvas-1.mirador-current-canvas-grouping', { timeout: 1500 });
windows = await page.evaluate(() => (
......
......@@ -12,12 +12,12 @@ describe('Window actions', () => {
await expect(page).toClick('[data-manifestid="http://127.0.0.1:4488/__tests__/fixtures/version-2/sn904cj3429.json"] button');
await expect(page).toMatchElement('.mirador-window');
await page.waitFor(1000);
await page.waitForTimeout(1000);
await expect(page).toClick('.mirador-window-close');
const numWindows = await page.evaluate(page => (
document.querySelectorAll('.mirador-window').length
)); // only default configed windows found
await page.waitFor(1000);
await page.waitForTimeout(1000);
await expect(numWindows).toBe(0);
});
});
......@@ -20,7 +20,7 @@ describe('AccessTokenSender', () => {
it('renders nothing if there is no url', () => {
wrapper = createWrapper({});
expect(wrapper.matchesElement(<></>)).toBe(true);
expect(wrapper.isEmptyRender()).toBe(true);
});
it('renders properly', () => {
......
......@@ -59,7 +59,7 @@ describe('LabelValueMetadata', () => {
it('renders an empty fragment instead of an empty dl', () => {
expect(wrapper.find('dl').length).toEqual(0);
expect(wrapper.matchesElement(<></>)).toBe(true);
expect(wrapper.isEmptyRender()).toBe(true);
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment