Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring Latest Development into Master #201

Merged
merged 16 commits into from
Jan 11, 2024
Merged
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
62 changes: 46 additions & 16 deletions __tests__/e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe("SDS Viewer e2e Test: Sparc Dataset", () => {
await page.waitForSelector(selectors.EMPTY_DATASET_VIEWER_SELECTOR);
});


test("Home Page", async () => {
await page.waitForSelector(selectors.EMPTY_DATASET_VIEWER_SELECTOR);

Expand All @@ -56,24 +57,24 @@ describe("SDS Viewer e2e Test: Sparc Dataset", () => {
customSnapshotIdentifier: 'Home Page'
});


});


test('Choose from SPARC Dataset List', async () => {
test('Choose SPARC Dataset List', async () => {

console.log('Opening SPARC Datasets')

await page.waitForSelector(selectors.LOAD_BUTTONS_SELECTOR)

const load_dataset_button = await page.$$(selectors.LOAD_BUTTONS_SELECTOR)

for (var i = 0; i < load_dataset_button.length; i++) {
load_dataset_button[1].click()
load_dataset_button[0].click()

}

await page.waitForSelector(selectors.DATASET_LIST_SELECTOR)
await page.waitForSelector(selectors.DATASET_ITEM_SELECTOR)
await page.waitForTimeout(ONE_SECOND * 3)
await page.waitForSelector(selectors.DATASET_LIST_SELECTOR, {timeout: 60000})
await page.waitForSelector(selectors.DATASET_ITEM_SELECTOR, {timeout: 60000})
await page.waitForSelector(selectors.DONE_BUTTON_SELECTOR, { disabled: true })
const sparc_dataset_counts = await page.$$eval(selectors.DATASET_COUNT_NUMBER_SELECTOR, sparc_dataset_counts => {
return sparc_dataset_counts.map(sparc_dataset_count => sparc_dataset_count.innerHTML);
Expand Down Expand Up @@ -107,8 +108,15 @@ describe("SDS Viewer e2e Test: Sparc Dataset", () => {
const folder_lenght = folder.length

expect(folder_lenght).toBe(1)

await page.waitForTimeout(3000)
await page.waitForSelector(selectors.OPEN_FOLDER_BUTTON_SELECTOR)
await page.click(selectors.OPEN_FOLDER_BUTTON_SELECTOR)
await page.waitForSelector(selectors.SUBFOLDERS_SELECTOR)
await page.waitForTimeout(3000)

const folder_after_click = await page.$$(selectors.LOADED_DATASET_SELECTOR)
const folder_lenght_after_click = folder_after_click.length
expect(folder_lenght_after_click).toBeGreaterThan(folder_lenght)

const data_folders = await page.$$eval(selectors.LOADED_DATASET_SELECTOR, data_folders => {
return data_folders.map(data_folder => data_folder.innerHTML);
Expand All @@ -119,9 +127,14 @@ describe("SDS Viewer e2e Test: Sparc Dataset", () => {
expect(data_folders).toContain('derivative')
expect(data_folders).toContain('subjects.xlsx')

})

await console.log('... taking snapshot ...')
expect(await page.screenshot())
.toMatchImageSnapshot({
...SNAPSHOT_OPTIONS,
customSnapshotIdentifier: 'Dataset Loaded'
});

})

test('Load another SPARC Dataset', async () => {

Expand All @@ -130,7 +143,7 @@ describe("SDS Viewer e2e Test: Sparc Dataset", () => {
const load_dataset_button = await page.$$(selectors.LOAD_BUTTONS_SELECTOR)

for (var i = 0; i < load_dataset_button.length; i++) {
load_dataset_button[1].click()
load_dataset_button[0].click()

}

Expand All @@ -152,13 +165,20 @@ describe("SDS Viewer e2e Test: Sparc Dataset", () => {
console.log('Dataset loaded')

await page.waitForSelector(selectors.GRAPH_SELECTOR)
await page.waitForTimeout(ONE_MINUTE * 1.5)
await page.waitForTimeout(10000)
const folder = await page.$$(selectors.LOADED_DATASET_SELECTOR)
const folder_lenght = folder.length

expect(folder_lenght).toBe(2)
})
expect(folder_lenght).toBeGreaterThan(2)

await console.log('... taking snapshot ...')
expect(await page.screenshot())
.toMatchImageSnapshot({
...SNAPSHOT_OPTIONS,
customSnapshotIdentifier: '2 Datasets Loaded'
});

})

test('Open Dataset through its ID', async () => {

Expand All @@ -180,9 +200,16 @@ describe("SDS Viewer e2e Test: Sparc Dataset", () => {

expect(data_ids[0]).toBe(DATASET_ID)

await console.log('... taking snapshot ...')
expect(await page.screenshot())
.toMatchImageSnapshot({
...SNAPSHOT_OPTIONS,
customSnapshotIdentifier: 'Dataset Loaded'
});

})

//SDS Viewer has a bug on this section
// No Longer applicable
test.skip('Load Dataset through URL', async () => {
await page.goto(DEV_URL)
await page.waitForSelector(selectors.EMPTY_DATASET_LIST_SELECTOR);
Expand All @@ -203,7 +230,7 @@ describe("SDS Viewer e2e Test: Sparc Dataset", () => {

})

//SDS Viewer has a bug on this section
// No Longer applicable
test.skip('Load Dataset from Local System', async () => {
await page.goto(DEV_URL)
await page.waitForSelector(selectors.EMPTY_DATASET_LIST_SELECTOR);
Expand Down Expand Up @@ -253,4 +280,7 @@ describe("SDS Viewer e2e Test: Sparc Dataset", () => {
})


})
})



3 changes: 2 additions & 1 deletion __tests__/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ export const DATASET_COUNT_NUMBER_SELECTOR = 'p[class="MuiTypography-root MuiTyp
export const SPARC_DATASET_LIST_SELECTOR = 'li[class="MuiListItem-root dataset_item MuiListItem-gutters"]';
export const ENABLED_DONE_BUTTON_SELECTOR = 'button[class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-disableElevation MuiButton-fullWidth"]';
export const LOADED_DATASET_SELECTOR = 'p[class="MuiTypography-root labelText MuiTypography-body2"]';
export const GRAPH_SELECTOR = '#graph-2d';
export const GRAPH_SELECTOR = '.graph-view';
export const OPEN_FOLDER_BUTTON_SELECTOR = 'span[class="MuiTypography-root labelCaption MuiTypography-caption MuiTypography-colorInherit"]';
export const SUBFOLDERS_SELECTOR = 'ul[class="MuiCollapse-root MuiTreeItem-group MuiCollapse-entered"]'
export const FELINE_DATASET_IMG_SELECTOR = 'img[alt="Feline brainstem neuron extracellular potential recordings"]';
export const DATA_ID_SELECTOR = 'h6[class="MuiTypography-root breadcrumb_selected MuiTypography-subtitle2"]';
export const URL_UPLOADER_SELECTOR = '#url-uploader';
Expand Down
Binary file added __tests__/snapshots/2 Datasets Loaded-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/snapshots/Dataset Loaded-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/graph/age.png
Binary file not shown.
38 changes: 38 additions & 0 deletions public/images/graph/age.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/graph/sex.png
Binary file not shown.
33 changes: 33 additions & 0 deletions public/images/graph/sex.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/graph/species.png
Binary file not shown.
Loading
Loading