Skip to content

Commit

Permalink
Merge pull request #3214 from responsible-ai-collaborative/staging
Browse files Browse the repository at this point in the history
Deploy to Production
  • Loading branch information
cesarvarela authored Nov 13, 2024
2 parents b7150d2 + 977b466 commit 4b56030
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
5 changes: 3 additions & 2 deletions site/gatsby-site/playwright/e2e-full/cite.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ test.describe('Cite pages', () => {
await page.goto(url);

const date = format(new Date(), 'MMMMd,y');
const retrievedDate = format(new Date(), 'MMMMyyyy')

await page.locator('button:has-text("Citation Info")').click();

Expand All @@ -290,8 +291,8 @@ test.describe('Cite pages', () => {
const bibText = bibTextElement.replace(/(\r\n|\n|\r| |\s)/g, '');

expect(bibText).toBe(
`@article{aiid:3,author={Olsson,Catherine},editor={McGregor,Sean},journal={AIIncidentDatabase},publisher={ResponsibleAICollaborative},title={IncidentNumber3},url={https://incidentdatabase.ai/cite/3},year={2014},urldate={${date}}}`
);
`@article{aiid:3,author={Olsson,Catherine},editor={McGregor,Sean},journal={AIIncidentDatabase},publisher={ResponsibleAICollaborative},title={IncidentNumber3:KronosSchedulingAlgorithmAllegedlyCausedFinancialIssuesforStarbucksEmployees},url={https://incidentdatabase.ai/cite/3},year={2014},urldate={${date}},note={Retrieved${retrievedDate}from\\url{https://incidentdatabase.ai/cite/3}}}`
);
});

test('Should display similar incidents', async ({ page }) => {
Expand Down
3 changes: 2 additions & 1 deletion site/gatsby-site/playwright/e2e/signup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ test.describe('Signup', () => {
await expect(page.locator('[data-cy="toast"]').getByText(`Verification email sent to ${email}`)).toBeVisible();
});

test('Should display the error toast message if the user already exists', async ({ page, skipOnEmptyEnvironment }) => {
// Adding the login fixture to the test to skip it on production
test('Should display the error toast message if the user already exists', async ({ page, skipOnEmptyEnvironment, login }) => {
await page.goto(url);

await page.locator('[data-cy="signup-btn"]').click();
Expand Down
1 change: 1 addition & 0 deletions site/gatsby-site/src/components/cite/CitationFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function CitationFormat({ incidentReports, incident }) {
nodes={incidentReports}
incidentDate={incident.date}
incident_id={incident.incident_id}
incidentTitle={incident.title}
editors={incident.editors}
/>
);
Expand Down
10 changes: 6 additions & 4 deletions site/gatsby-site/src/components/cite/citationTypes/BibTex.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { faCopy } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Trans, useTranslation } from 'react-i18next';

const BibTex = ({ nodes, incidentDate, incident_id, editors }) => {
const BibTex = ({ nodes, incidentDate, incident_id, incidentTitle, editors }) => {
const addToast = useToastContext();

const { t } = useTranslation();
Expand All @@ -34,14 +34,16 @@ const BibTex = ({ nodes, incidentDate, incident_id, editors }) => {
editor = {${last_name}, ${first_name}},
journal = {AI Incident Database},
publisher = {Responsible AI Collaborative},
title = {Incident Number ${incident_id}},
title = {Incident Number ${incident_id}: ${incidentTitle}},
url = {https://incidentdatabase.ai/cite/${incident_id}},
year = {${incidentDate.substring(0, 4)}},
urldate = {${format(new Date(), 'MMMM d, y')}}`.replace(/^ +/, '\t') +
urldate = {${format(new Date(), 'MMMM d, y')}},
note = {Retrieved ${format(new Date(), 'MMMM yyyy')} from
\\url{https://incidentdatabase.ai/cite/${incident_id}}}`.replace(/^ +/, '\t') +
'\n' +
'}';

const jsx = <code style={{ whiteSpace: 'pre' }}>{bibTex}</code>;
const jsx = <code style={{ whiteSpace: 'pre-wrap' }}>{bibTex}</code>;

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, { useEffect, useState } from 'react';
import { Trans, useTranslation } from 'react-i18next';
import { getFormattedName } from '../../../utils/typography';

const Citation = ({ nodes, incidentDate, incident_id, editors }) => {
const Citation = ({ nodes, incidentDate, incident_id, incidentTitle, editors }) => {
const docs = [...nodes];

// Sort the docs according to their submit date
Expand Down Expand Up @@ -48,14 +48,15 @@ const Citation = ({ nodes, incidentDate, incident_id, editors }) => {
const editorFirstNameInitial = first_name[0] + '.';

const text = t(
'{{submitterCite}}. ({{incidentDate}}) Incident Number {{incidentId}}. in {{editorLastName}}, {{editorFirstNameInitial}} (ed.) <i>Artificial Intelligence Incident Database.</i> Responsible AI Collaborative. {{retrievalString}}',
'{{submitterCite}}. ({{incidentDate}}) Incident Number {{incidentId}}: {{incidentTitle}}. in {{editorLastName}}, {{editorFirstNameInitial}} (ed.) <i>Artificial Intelligence Incident Database.</i> Responsible AI Collaborative. {{retrievalString}}',
{
submitterCite,
incidentDate,
incidentId: incident_id,
editorLastName,
editorFirstNameInitial,
retrievalString,
incidentTitle,
}
);

Expand Down

0 comments on commit 4b56030

Please sign in to comment.