Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { defineConfig } = require('cypress');
module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
supportFile: false,
supportFile: 'cypress/support/index.js',
experimentalStudio: true,
retries: process.env.CI ? 2 : 0,
},
Expand Down
60 changes: 60 additions & 0 deletions cypress/e2e/phase_1/admin_display.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { teardown } from '../../support/authentication';
import * as datasetImportPage from '../../support/datasetImportPage';
import * as fields from '../../support/fields';
import * as menu from '../../support/menu';

describe('Home Page', () => {
beforeEach(() => {
teardown();
menu.openAdvancedDrawer();
menu.goToAdminDashboard();

datasetImportPage.importDataset('dataset/film.csv');
});

it('should automatically bind home page field icon', () => {
cy.findByRole('link', {
name: /Display/,
}).click();

fields.createNewField();

cy.findByRole('gridcell', {
name: /newField/,
timeout: 1000,
})
.should('be.visible')
.then((parent) => {
cy.findByTestId('HomeIcon', {
container: parent,
timeout: 500,
}).should('be.visible');
});
});

it('should automatically bind main resource page field icon', () => {
cy.findByRole('link', {
name: /Display/,
timeout: 1000,
}).click();

cy.findByRole('menuitem', {
name: /Main resource/,
timeout: 1000,
}).click();

fields.createNewField();

cy.findByRole('gridcell', {
name: /newField/,
timeout: 1000,
})
.should('be.visible')
.then((parent) => {
cy.findByTestId('ArticleIcon', {
container: parent,
timeout: 500,
}).should('be.visible');
});
});
});
58 changes: 58 additions & 0 deletions cypress/e2e/phase_1/subresource_ark.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { teardown } from '../../support/authentication';
import * as datasetImportPage from '../../support/datasetImportPage';
import * as menu from '../../support/menu';

describe('Ark subresource', () => {
beforeEach(() => {
teardown();
menu.openAdvancedDrawer();
menu.goToAdminDashboard();
datasetImportPage.importDataset('dataset/subresources-ark-data.json');
datasetImportPage.importModel('model/subresources-ark-model.tar');
});

it('should display a back button when going to subresource', () => {
datasetImportPage.publish();
datasetImportPage.goToPublishedResources();

cy.findByRole('link', {
name: /Search/,
timeout: 500,
})
.should('be.visible')
.click();

cy.findByText('Publication n°1', {
timeout: 500,
})
.should('be.visible')
.click();

cy.findByText('Publication n°1', {
timeout: 500,
})
.should('be.visible')
.click();

cy.findByRole('link', {
name: 'uid:/2acebfc7a1e13123df28821e41424d80',
timeout: 500,
}).click();

cy.findByText('Canidae', {
timeout: 500,
}).should('be.visible');

cy.findByRole('button', {
name: 'Go back to resource',
timeout: 500,
})
.should('be.visible')
.click();

cy.findByRole('link', {
name: 'uid:/2acebfc7a1e13123df28821e41424d80',
timeout: 500,
}).should('be.visible');
});
});
26 changes: 26 additions & 0 deletions cypress/fixtures/dataset/subresources-ark-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"uri": "ark:/67375/WNG-J6G37RM9-Q",
"name": "Publication n°1",
"most_found_animal_species": {
"id": 90,
"name": "Canidae"
}
},
{
"uri": "ark:/67375/WNG-J6G37RM9-R",
"name": "Publication n°2",
"most_found_animal_species": {
"id": 91,
"name": "Felinae"
}
},
{
"uri": "ark:/67375/WNG-J6G37RM9-S",
"name": "Publication n°3",
"most_found_animal_species": {
"id": 90,
"name": "Canidae"
}
}
]
Binary file not shown.
1 change: 1 addition & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/cypress/add-commands';
22 changes: 22 additions & 0 deletions cypress/support/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,25 @@ export function setFieldLanguage(fieldName, languageCode) {

cy.wait(1000);
}

export function createNewField() {
cy.findByRole('button', {
name: /New field/,
}).click();

cy.findByRole('textbox', {
name: /Label/,
}).should('be.visible', {
timeout: 1000,
});

cy.findByRole('button', {
name: /Arbitrary value/,
}).click();

cy.findByPlaceholderText('Enter an arbitrary value').type('FIELD');

cy.findByRole('button', {
name: /Save/,
}).click();
}
1 change: 1 addition & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './commands';
3 changes: 2 additions & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"module": "commonjs",
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"jsx": "react"
"jsx": "react",
"types": ["cypress", "@testing-library/cypress"]
},
"exclude": ["src/build", "node_modules"]
}
173 changes: 171 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
"compression-webpack-plugin": "10.0.0",
"copy-webpack-plugin": "11.0.0",
"cypress": "13.6.4",
"@testing-library/cypress": "10.0.2",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.8",
"eslint": "^8.56.0",
Expand Down
Loading