Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
215 changes: 213 additions & 2 deletions CI/e2e/frontend.config.e2e.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@
],
"conditions": []
},

"labelsLocalization": {
"datasetDefault": {},
"datasetCustom": {
Expand Down Expand Up @@ -237,5 +236,217 @@
"Metadata": "Additional Information"
}
},
"dateFormat": "yyyy-MM-dd HH:mm"
"dateFormat": "yyyy-MM-dd HH:mm",
"datasetDetailComponent": {
"enableCustomizedComponent": false,
"customization": [
{
"type": "regular",
"label": "General Information",
"order": 0,
"row": 1,
"col": 8,
"fields": [
{
"element": "text",
"source": "scientificMetadata.start_time",
"order": 0
},
{
"element": "copy",
"source": "scientificMetadata.run_number.value",
"order": 1
},
{
"element": "text",
"source": "creationTime",
"order": 2
},
{
"element": "text",
"source": "type",
"order": 3
},
{
"element": "text",
"source": "datasetName",
"order": 4
},
{
"element": "tag",
"source": "keywords",
"order": 5
}
]
},
{
"type": "attachments",
"label": "Gallery",
"order": 1,
"col": 2,
"row": 2,
"options": {
"limit": 5,
"size": "medium"
}
},
{
"type": "regular",
"label": "Contact Information",
"order": 2,
"col": 2,
"row": 1,
"fields": [
{
"element": "text",
"source": "principalInvestigator",
"order": 0
},
{
"element": "linky",
"source": "contactEmail",
"order": 1
}
]
},
{
"type": "regular",
"label": "Files Information",
"order": 3,
"col": 2,
"row": 1,
"fields": [
{
"element": "text",
"source": "scientificMetadata.runnumber",
"order": 0
},
{
"element": "text",
"source": "sourceFolderHost",
"order": 1
},
{
"element": "text",
"source": "numberOfFiles",
"order": 2
},
{
"element": "text",
"source": "size",
"order": 3
},
{
"element": "text",
"source": "numberOfFilesArchived",
"order": 4
},
{
"element": "text",
"source": "packedSize",
"order": 5
}
]
},
{
"type": "regular",
"label": "Related Documents",
"order": 4,
"col": 4,
"row": 1,
"fields": [
{
"element": "internalLink",
"source": "proposalIds",
"order": 0
},
{
"element": "internalLink",
"source": "instrumentIds",
"order": 1
},
{
"element": "tag",
"source": "sampleIds",
"order": 2
},
{
"element": "tag",
"source": "inputDatasets",
"order": 3
},
{
"element": "internalLink",
"source": "creationLocation",
"order": 4
}
]
},
{
"type": "attachments",
"label": "Gallery",
"order": 5,
"col": 1,
"row": 1,
"options": {
"limit": 2,
"size": "small"
}
},
{
"type": "scientificMetadata",
"label": "Scientific Metadata Table",
"viewMode": "table",
"order": 6,
"col": 9,
"row": 1
},
{
"type": "scientificMetadata",
"label": "Scientific Metadata JSON",
"viewMode": "json",
"order": 6
},
{
"type": "scientificMetadata",
"label": "Scientific Metadata Tree",
"viewMode": "tree",
"order": 6
},
{
"type": "datasetJsonView",
"label": "Dataset Json View",
"order": 7,
"col": 10,
"row": 2
}
]
},
"defaultMainPage": {
"nonAuthenticatedUser": "DATASETS",
"authenticatedUser": "PROPOSALS"
},
"siteHeaderLogoUrl": "https://my.facility.site",
"mainMenu": {
"nonAuthenticatedUser": {
"datasets": true,
"files": false,
"instruments": true,
"jobs": false,
"policies": false,
"proposals": true,
"publishedData": true,
"samples": false
},
"authenticatedUser": {
"datasets": true,
"files": true,
"instruments": true,
"jobs": true,
"policies": false,
"proposals": true,
"publishedData": true,
"samples": true
}
}
}
98 changes: 98 additions & 0 deletions cypress/e2e/mainPage/main-page.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import { testData } from "../../fixtures/testData";

describe("Main Page", () => {
beforeEach(() => {
cy.login(Cypress.env("username"), Cypress.env("password"));
cy.createDataset(
"raw",
"Main Page Dataset Public",
"20150729",
"small",
true,
);
cy.createDataset(
"raw",
"Main Page Dataset Non Public",
"20150729",
"small",
false,
);
});

after(() => {
cy.removeDatasets();
});

describe("Main page configuration as non authenticated user", () => {
it("should visit main page correctly configured", () => {
const username = Cypress.env("username");

cy.visit("/");
cy.finishedLoading();

cy.get(".user-button").should("contain.text", username).click();

cy.get("[data-cy=logout-button]").click();

cy.finishedLoading();
cy.visit("/");

cy.finishedLoading();

cy.get("breadcrumb > div > span > a").should('contain', "Datasets");

cy.get("div.header mat-toolbar.mat-toolbar.mat-elevation-z1.mat-primary.mat-toolbar-single-row a").eq(0).should('have.attr','href','/datasets');
cy.get("div.header mat-toolbar.mat-toolbar.mat-elevation-z1.mat-primary.mat-toolbar-single-row a").eq(1).should('have.attr','href','https://my.facility.site');

cy.get("div.main-menu").click()

cy.get('button.mat-mdc-menu-item:nth-child(1) > span:nth-child(2) > span:nth-child(1)').should('contain','Datasets')
cy.get('button.mat-mdc-menu-item:nth-child(4) > span:nth-child(2) > span:nth-child(1)').should('contain','Published Data')

cy.get('[data-cy="login-button"]').should('exist');

//cy.get("mat-row").contains("Main Page Dataset Public").click();
});
});

describe("Main page configuration as authenticated user", () => {
it("should visit main page correctly configured", () => {
const username = Cypress.env("username");
const password = Cypress.env("password");

// cy.visit("/login");

// cy.finishedLoading();

// cy.url().should("include", "/login");

// cy.get('mat-tab-group [role="tab"]').contains("Local").click();

// cy.get("#usernameInput").type(username).should("have.value", username);
// cy.get("#passwordInput").type(password).should("have.value", password);

// cy.get("button[type=submit]").click();

cy.visit("/");
cy.finishedLoading();

cy.url().should("include", "/proposals");

cy.get("breadcrumb > div > span > a").should('contain', "Proposals");

cy.get("div.header mat-toolbar.mat-toolbar.mat-elevation-z1.mat-primary.mat-toolbar-single-row a").eq(0).should('have.attr','href','/proposals');
cy.get("div.header mat-toolbar.mat-toolbar.mat-elevation-z1.mat-primary.mat-toolbar-single-row a").eq(1).should('have.attr','href','https://my.facility.site');

cy.get("div.main-menu").click()

cy.get('button.mat-mdc-menu-item:nth-child(2) > span:nth-child(2) > span:nth-child(1)').should('contain','Files')

cy.get("div.main-menu").click()

cy.get('[data-cy="login-button"]').should('not.exist');
cy.get('.user-button').should('exist');

});
});

});
8 changes: 7 additions & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,19 @@ Cypress.Commands.add(
datasetName = testData.rawDataset.datasetName,
proposalId = "20170266",
dataFileSize = "small",
isPublished = false,
) => {
cy.getCookie("user").then((userCookie) => {
const user = JSON.parse(decodeURIComponent(userCookie.value));

cy.getToken().then((token) => {
if (type === "raw") {
const dataset = { ...testData.rawDataset, datasetName, proposalId };
const dataset = {
...testData.rawDataset,
datasetName,
proposalId,
isPublished,
};
cy.log("Raw Dataset 1: " + JSON.stringify(dataset, null, 2));
cy.log("User: " + JSON.stringify(user, null, 2));

Expand Down
Loading
Loading