Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into tsmith/automate-release
Browse files Browse the repository at this point in the history
# Conflicts:
#	release-please.manifest.json
  • Loading branch information
Bento007 committed Aug 20, 2024
2 parents 6f73e27 + 3d8c0d5 commit ffc240d
Show file tree
Hide file tree
Showing 75 changed files with 2,570 additions and 1,982 deletions.
54 changes: 54 additions & 0 deletions frontend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
# Changelog

## [1.22.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.21.0...web-v1.22.0) (2024-08-16)


### ✨ Features

* add filter panel to single deposition page ([#1030](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1030)) ([d378e7c](https://github.com/chanzuckerberg/cryoet-data-portal/commit/d378e7c2be0c51595bef36ab2adde0647145ce95))

## [1.21.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.20.0...web-v1.21.0) (2024-08-15)


### ✨ Features

* Update Tomogram Processing field format and query ([#1031](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1031)) ([80e1b51](https://github.com/chanzuckerberg/cryoet-data-portal/commit/80e1b51995094f2ee42768c36e6499d11be5b936))

## [1.20.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.19.1...web-v1.20.0) (2024-08-15)


### ✨ Features

* Implement collapsing Annotated Objects list ([#1024](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1024)) ([9343d12](https://github.com/chanzuckerberg/cryoet-data-portal/commit/9343d1215a60632696efba551c9272aa7ce98b85))


### 🧹 Miscellaneous Chores

* Add e2e test for errors on Neuroglancer site ([#1027](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1027)) ([572972d](https://github.com/chanzuckerberg/cryoet-data-portal/commit/572972d915a20338d9a4a59742233f855e3720c8))

## [1.19.1](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.19.0...web-v1.19.1) (2024-08-13)


### 🐞 Bug Fixes

* Dedupe authors ([#1018](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1018)) ([bdbc034](https://github.com/chanzuckerberg/cryoet-data-portal/commit/bdbc034dd20d9db42536e8a84e312545148e6a55)), closes [#752](https://github.com/chanzuckerberg/cryoet-data-portal/issues/752)
* Fix Neuroglancer URL bug ([#1026](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1026)) ([377d6dc](https://github.com/chanzuckerberg/cryoet-data-portal/commit/377d6dcd38870190601ac28d8ddd695f2e8adfb5)), closes [#1025](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1025)

## [1.19.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.18.0...web-v1.19.0) (2024-08-12)


### ✨ Features

* Add Tomograms table ([#988](https://github.com/chanzuckerberg/cryoet-data-portal/issues/988)) ([420acdd](https://github.com/chanzuckerberg/cryoet-data-portal/commit/420acdd2999e4261214a9475c9a6d37b1c85ef28))
* Enable pagination of Annotations table with temporary hacky query ([#992](https://github.com/chanzuckerberg/cryoet-data-portal/issues/992)) ([79f7247](https://github.com/chanzuckerberg/cryoet-data-portal/commit/79f724798caacab162eb89a0a4ce57a7b19f5e2d))


### ♻️ Code Refactoring

* download dialog tests ([#1011](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1011)) ([f0ece55](https://github.com/chanzuckerberg/cryoet-data-portal/commit/f0ece552004cad1d3847691aab0bfd8b0ab6b8e3)), closes [#962](https://github.com/chanzuckerberg/cryoet-data-portal/issues/962)

## [1.18.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.17.0...web-v1.18.0) (2024-08-02)


### ✨ Features

* Add Tomograms tab to Run page ([#983](https://github.com/chanzuckerberg/cryoet-data-portal/issues/983)) ([c357e6e](https://github.com/chanzuckerberg/cryoet-data-portal/commit/c357e6e804ac31a854a5012295a459c3be19e6e6))

## [1.17.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.16.0...web-v1.17.0) (2024-07-31)


Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web",
"version": "1.17.0",
"version": "1.22.0",
"scripts": {
"preinstall": "npx only-allow pnpm",
"build": "pnpm -r build",
Expand Down
35 changes: 35 additions & 0 deletions frontend/packages/data-portal/_templates/e2e/new/pageActor.cjs.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
to: e2e/pageObjects/<%= name %>/<%= name %>Actor.ts
---
/**
* This file contains combinations of page interactions or data fetching. Remove if not needed.
*/
import { <%= h.changeCase.pascal(name) %>Page } from 'e2e/pageObjects/<%= name %>/<%= name %>Page'

export class <%= h.changeCase.pascal(name) %>Actor {
private <%= name %>Page: <%= h.changeCase.pascal(name) %>Page

constructor(<%= name %>Page: <%= h.changeCase.pascal(name) %>Page) {
this.<%= name %>Page = <%= name %>Page
}
// #region Navigate
// #endregion Navigate

// #region Click
// #endregion Click

// #region Hover
// #endregion Hover

// #region Get
// #endregion Get

// #region Macro
// #endregion Macro

// #region Validation
// #endregion Validation

// #region Bool
// #endregion Bool
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
to: e2e/pageObjects/<%= name %>/<%= name %>Page.ts
---
import { expect } from '@playwright/test'
import { BasePage } from 'e2e/pageObjects/basePage'

export class <%= h.changeCase.pascal(name) %>Page extends BasePage {
Expand Down
11 changes: 9 additions & 2 deletions frontend/packages/data-portal/_templates/e2e/new/testFile.cjs.t
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
---
to: e2e/<%= name %>.test.ts
---
import { ApolloClient, NormalizedCacheObject } from '@apollo/client'
import { test } from '@playwright/test'
import { <%= h.changeCase.pascal(name) %>Page } from 'e2e/pageObjects/<%= name %>/<%= name %>Page'

test.describe('<%= name %>', () => {
test('should work', async ({ page }) => {
const <%= name %>Page = new <%= h.changeCase.pascal(name) %>Page(page)
let client: ApolloClient<NormalizedCacheObject>
let <%= name %>Page: <%= h.changeCase.pascal(name) %>Page

test.beforeEach(({page}) => {
<%= name %>Page = new <%= h.changeCase.pascal(name) %>Page(page)
})

test('should work', async () => {
await <%= name %>Page.goTo('https://playwright.dev/')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -18,108 +18,140 @@ const AUTHOR_MAP = Object.fromEntries(
DEFAULT_AUTHORS.map((author) => [author.name, author]),
)

it('should render authors', () => {
render(<AuthorList authors={DEFAULT_AUTHORS} />)
describe('non-compact', () => {
it('should render authors', () => {
render(<AuthorList authors={DEFAULT_AUTHORS} />)

DEFAULT_AUTHORS.forEach((author) =>
expect(screen.getByText(author.name)).toBeInTheDocument(),
)
})
DEFAULT_AUTHORS.forEach((author) =>
expect(screen.getByText(author.name)).toBeInTheDocument(),
)
})

it('should sort primary authors', () => {
render(<AuthorList authors={DEFAULT_AUTHORS} />)
const authorNode = screen.getByRole('paragraph')
const authors = (authorNode.textContent ?? '').split(', ')
it('should sort primary authors', () => {
render(<AuthorList authors={DEFAULT_AUTHORS} />)
const authors = findAuthorStrings()

expect(AUTHOR_MAP[authors[0]].primary_author_status).toBe(true)
expect(AUTHOR_MAP[authors[1]].primary_author_status).toBe(true)
})
expect(AUTHOR_MAP[authors[0]].primary_author_status).toBe(true)
expect(AUTHOR_MAP[authors[1]].primary_author_status).toBe(true)
})

it('should sort other authors', () => {
render(<AuthorList authors={DEFAULT_AUTHORS} />)
const authorNode = screen.getByRole('paragraph')
const authors = (authorNode.textContent ?? '').split(', ')
const otherAuthors = authors.slice(2, -2)
it('should sort other authors', () => {
render(<AuthorList authors={DEFAULT_AUTHORS} />)
const authors = findAuthorStrings()
const otherAuthors = authors.slice(2, -2)

otherAuthors.forEach((author) => {
expect(AUTHOR_MAP[author].primary_author_status).toBeUndefined()
expect(AUTHOR_MAP[author].corresponding_author_status).toBeUndefined()
otherAuthors.forEach((author) => {
expect(AUTHOR_MAP[author].primary_author_status).toBeUndefined()
expect(AUTHOR_MAP[author].corresponding_author_status).toBeUndefined()
})
})
})

it('should sort corresponding authors', () => {
render(<AuthorList authors={DEFAULT_AUTHORS} />)
const authorNode = screen.getByRole('paragraph')
const authors = (authorNode.textContent ?? '').split(', ')

expect(AUTHOR_MAP[authors.at(-1) ?? ''].corresponding_author_status).toBe(
true,
)
expect(AUTHOR_MAP[authors.at(-2) ?? ''].corresponding_author_status).toBe(
true,
)
})
it('should sort corresponding authors', () => {
render(<AuthorList authors={DEFAULT_AUTHORS} />)
const authors = findAuthorStrings()

it('should render author links', () => {
const authors = DEFAULT_AUTHORS.map((author, idx) => ({
...author,
orcid: `0000-0000-0000-000${idx}`,
}))
expect(AUTHOR_MAP[authors.at(-1) ?? ''].corresponding_author_status).toBe(
true,
)
expect(AUTHOR_MAP[authors.at(-2) ?? ''].corresponding_author_status).toBe(
true,
)
})

render(<AuthorList authors={authors} AuthorLinkComponent={MockAuthorLink} />)
it('should render author links', () => {
const authors = DEFAULT_AUTHORS.map((author, idx) => ({
...author,
orcid: `0000-0000-0000-000${idx}`,
}))

render(
<AuthorList authors={authors} AuthorLinkComponent={MockAuthorLink} />,
)

authors.forEach((author) =>
expect(
screen.getByRole('link', { name: `${author.name}` }),
).toBeInTheDocument(),
)
})

authors.forEach((author) =>
expect(
screen.getByRole('link', { name: `${author.name}` }),
).toBeInTheDocument(),
)
it('should not display any author more than once', () => {
render(
<AuthorList
authors={[
{
name: 'One',
primary_author_status: true,
corresponding_author_status: true,
},
{
name: 'Two',
},
]}
/>,
)

const authors = findAuthorStrings()

expect(authors.length).toBe(2)
expect(authors[0]).toBe('One')
expect(authors[1]).toBe('Two')
})
})

it('should not render author links when compact', () => {
const authors = DEFAULT_AUTHORS.map((author, idx) => ({
...author,
orcid: `0000-0000-0000-000${idx}`,
}))

render(
<AuthorList
authors={authors}
AuthorLinkComponent={MockAuthorLink}
compact
/>,
)

expect(screen.queryByRole('link')).not.toBeInTheDocument()
})
describe('compact', () => {
it('should not render author links when compact', () => {
const authors = DEFAULT_AUTHORS.map((author, idx) => ({
...author,
orcid: `0000-0000-0000-000${idx}`,
}))

render(
<AuthorList
authors={authors}
AuthorLinkComponent={MockAuthorLink}
compact
/>,
)

expect(screen.queryByRole('link')).not.toBeInTheDocument()
})

it('should not render other authors when compact', () => {
render(<AuthorList authors={DEFAULT_AUTHORS} compact />)
const authorNode = screen.getByRole('paragraph')
const authors = (authorNode.textContent ?? '').split(', ')
const otherAuthors = authors.slice(2, -2)
it('should not render other authors when compact', () => {
render(<AuthorList authors={DEFAULT_AUTHORS} compact />)
const authorNode = screen.getByRole('paragraph')
const authors = (authorNode.textContent ?? '').split(', ')
const otherAuthors = authors.slice(2, -2)

otherAuthors.forEach((author) =>
expect(screen.queryByText(author)).not.toBeInTheDocument(),
)
})
otherAuthors.forEach((author) =>
expect(screen.queryByText(author)).not.toBeInTheDocument(),
)
})

it('should render comma if compact and has corresponding authors', () => {
render(<AuthorList authors={DEFAULT_AUTHORS} compact />)
expect(screen.getByText((text) => text.includes('... ,'))).toBeInTheDocument()
})
it('should render comma if compact and has corresponding authors', () => {
render(<AuthorList authors={DEFAULT_AUTHORS} compact />)
expect(
screen.getByText((text) => text.includes('... ,')),
).toBeInTheDocument()
})

it('should not render comma for others if compact and no corresponding authors', () => {
render(
<AuthorList
authors={DEFAULT_AUTHORS.filter(
(author) => !author.corresponding_author_status,
)}
compact
/>,
)

expect(screen.getByText((text) => text.includes('...'))).toBeInTheDocument()
expect(
screen.queryByText((text) => text.includes('... ,')),
).not.toBeInTheDocument()
it('should not render comma for others if compact and no corresponding authors', () => {
render(
<AuthorList
authors={DEFAULT_AUTHORS.filter(
(author) => !author.corresponding_author_status,
)}
compact
/>,
)

expect(screen.getByText((text) => text.includes('...'))).toBeInTheDocument()
expect(
screen.queryByText((text) => text.includes('... ,')),
).not.toBeInTheDocument()
})
})

function findAuthorStrings(): string[] {
return (screen.getByRole('paragraph').textContent ?? '').split(', ')
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,18 @@ export function AuthorList({
large?: boolean
subtle?: boolean
}) {
// TODO: make the below grouping more efficient and/or use GraphQL ordering
const authorsPrimary = authors.filter(
(author) => author.primary_author_status,
)
const authorsCorresponding = authors.filter(
(author) => author.corresponding_author_status,
)
const authorsOther = authors.filter(
(author) =>
!(author.primary_author_status || author.corresponding_author_status),
)
const authorsPrimary = []
const authorsOther = []
const authorsCorresponding = []
for (const author of authors) {
if (author.primary_author_status) {
authorsPrimary.push(author)
} else if (author.corresponding_author_status) {
authorsCorresponding.push(author)
} else {
authorsOther.push(author)
}
}

const otherCollapsed = useMemo<string | null>(() => {
const ellipsis = '...'
Expand Down
Loading

0 comments on commit ffc240d

Please sign in to comment.