Skip to content

Commit

Permalink
Merge pull request #2644 from responsible-ai-collaborative/staging
Browse files Browse the repository at this point in the history
Deploy to Production – 2024-02-22
  • Loading branch information
kepae authored Feb 22, 2024
2 parents 5e15f16 + 01b49c2 commit 152c5c0
Show file tree
Hide file tree
Showing 28 changed files with 436 additions and 160 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ jobs:
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: npm ci

- name: Use new netlify.toml
run: |
rm -f netlify.toml
mv deploy-netlify.toml netlify.toml
- name: Use deploy specific netlify.toml
run: mv deploy-netlify.toml netlify.toml

- name: Install Netlify CLI
run: npm install netlify-cli -g
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ jobs:
install-command: npm ci

- name: Use tests specific netlify.toml
run: |
rm -f netlify.toml
mv tests-netlify.toml netlify.toml
run: mv tests-netlify.toml netlify.toml
working-directory: site/gatsby-site

- name: Install Netlify CLI
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ As soon as a user is signed in, the system assigns a `subscriber` role by defaul
|-------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| `subscriber` | This is the default role assigned to all users. It allows the user to subscribe to new incidents, specific incidents, entities, and anything else that is subscribeable. |
| `submitter` | This role allows the user to submit new incidents under their user account. |
| `incident_editor` | This role allows the user to:<br>- Edit and clone incidents<br>- See the live incident data. The live data is the data that is currently stored in the database. Keep in mind that incident pages are generated on each build, so if a user edits an incident, the change will be only visible if the live data options is activated until the next build finishes.<br>- Add, edit, approve and delete incident variants<br>- View and submit incident candidates<br>- Restore previous versions of incidents and reports. |
| `incident_editor` | This role allows the user to:<br>- Edit and clone incidents<br>- See the live incident data. The live data is the data that is currently stored in the database. Keep in mind that incident pages are generated on each build, so if a user edits an incident, the change will be only visible if the live data options is activated until the next build finishes.<br>- Add, edit, approve and delete incident variants<br>- View and submit incident candidates<br>- Restore previous versions of incidents and reports.<br>- Approve and reject new submissions. Which involves converting a submission into an incident or report (create incident or report and linked notifications), or deleting the submission |
| `taxonomy_editor` | This role allows the user to edit all taxonomies. |
| `taxonomy_editor_{taxonomy_name}` | This role allows the user to edit a specific taxonomy. ie: `taxonomy_editor_csetv1` role allows the user to edit the `CSETv1` taxonomy. |
| `admin` | This role has full access to the site, including the ability to edit users' roles. |
Expand Down
189 changes: 132 additions & 57 deletions site/gatsby-site/cypress/e2e/integration/apps/submitted.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ describe('Submitted reports', () => {
userId
first_name
last_name
roles
adminData {
email
}
}
}
`,
Expand Down Expand Up @@ -95,6 +99,10 @@ describe('Submitted reports', () => {
maybeIt('Promotes a submission to a new report and links it to a new incident', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find(
(r) => r._id === '5f9c3ebfd4896d392493f03c'
);
Expand Down Expand Up @@ -206,6 +214,10 @@ describe('Submitted reports', () => {
maybeIt('Promotes a submission to a new report and links it to an existing incident', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find(
(r) => r.incident_ids.length == 1 && r.incident_ids.includes(10)
);
Expand Down Expand Up @@ -311,6 +323,10 @@ describe('Submitted reports', () => {
maybeIt('Promotes a submission to a new report and links it to multiple incidents', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find(
(r) => r._id == '444461606b4bb5e39601234'
);
Expand Down Expand Up @@ -448,6 +464,10 @@ describe('Submitted reports', () => {
maybeIt('Promotes a submission to a new issue', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find(
(r) => r._id === '62d561606b4bb5e39605555'
);
Expand Down Expand Up @@ -531,6 +551,10 @@ describe('Submitted reports', () => {
maybeIt('Rejects a submission', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find(
(r) => r.incident_ids.length == 1 && r.incident_ids.includes(10)
);
Expand Down Expand Up @@ -599,6 +623,10 @@ describe('Submitted reports', () => {
maybeIt('Edits a submission - update just a text', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

cy.conditionalIntercept(
'**/graphql',
(req) => req.body.operationName == 'FindSubmissions',
Expand Down Expand Up @@ -733,6 +761,10 @@ describe('Submitted reports', () => {
maybeIt('Edits a submission - uses fetch info', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

cy.conditionalIntercept(
'**/graphql',
(req) => req.body.operationName == 'FindSubmissions',
Expand Down Expand Up @@ -808,6 +840,10 @@ describe('Submitted reports', () => {
() => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find(
(r) => r._id === '62d561606b4bb5e396034444'
);
Expand Down Expand Up @@ -878,85 +914,96 @@ describe('Submitted reports', () => {
}
);

it.only('Does not allow promotion of submission to Issue if schema is invalid (missing Title).', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

const submission = submittedReports.data.submissions.find(
(r) => r._id === '123461606b4bb5e39601234'
);
maybeIt(
'Does not allow promotion of submission to Issue if schema is invalid (missing Title).',
() => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

cy.conditionalIntercept(
'**/graphql',
(req) => req.body.operationName == 'FindSubmissions',
'FindSubmissions',
{
data: {
submissions: [submission],
},
if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}
);

cy.conditionalIntercept(
'**/graphql',
(req) => req.body.operationName == 'FindSubmission',
'FindSubmission',
{
data: {
submission: submission,
},
}
);
const submission = submittedReports.data.submissions.find(
(r) => r._id === '123461606b4bb5e39601234'
);

cy.conditionalIntercept(
'**/graphql',
(req) => req.body.operationName == 'AllQuickAdd',
'AllQuickAdd',
{
data: {
quickadds: [quickAdds],
},
}
);
cy.conditionalIntercept(
'**/graphql',
(req) => req.body.operationName == 'FindSubmissions',
'FindSubmissions',
{
data: {
submissions: [submission],
},
}
);

cy.visit(url);
cy.conditionalIntercept(
'**/graphql',
(req) => req.body.operationName == 'FindSubmission',
'FindSubmission',
{
data: {
submission: submission,
},
}
);

cy.waitForStableDOM();
cy.conditionalIntercept(
'**/graphql',
(req) => req.body.operationName == 'AllQuickAdd',
'AllQuickAdd',
{
data: {
quickadds: [quickAdds],
},
}
);

cy.wait('@FindSubmissions');
cy.visit(url);

cy.visit(url + `?editSubmission=${submission._id}`);
cy.waitForStableDOM();

cy.wait('@AllQuickAdd');
cy.wait('@FindSubmissions');

cy.on('fail', (err) => {
expect(err.message).to.include(
'`cy.wait()` timed out waiting `2000ms` for the 1st request to the route: `promotionInvoked`. No request ever occurred.'
);
});
cy.visit(url + `?editSubmission=${submission._id}`);

cy.conditionalIntercept(
'**/graphql',
(req) => req.body.operationName === 'PromoteSubmission',
'promotionInvoked',
{}
);
cy.wait('@AllQuickAdd');

cy.get('select[data-cy="promote-select"]').as('dropdown');
cy.on('fail', (err) => {
expect(err.message).to.include(
'`cy.wait()` timed out waiting `2000ms` for the 1st request to the route: `promotionInvoked`. No request ever occurred.'
);
});

cy.get('@dropdown').select('Issue');
cy.conditionalIntercept(
'**/graphql',
(req) => req.body.operationName === 'PromoteSubmission',
'promotionInvoked',
{}
);

cy.get('[data-cy="promote-button"]').click();
cy.get('select[data-cy="promote-select"]').as('dropdown');

cy.contains('[data-cy="toast"]', 'Title is required').should('exist');
cy.get('@dropdown').select('Issue');

cy.wait('@promotionInvoked', { timeout: 2000 });
});
cy.get('[data-cy="promote-button"]').click();

cy.contains('[data-cy="toast"]', 'Title is required').should('exist');

cy.wait('@promotionInvoked', { timeout: 2000 });
}
);

maybeIt(
'Does not allow promotion of submission to Report if schema is invalid (missing Date).',
() => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find(
(r) => r._id === '333561606b4bb5e39601234'
);
Expand Down Expand Up @@ -1027,6 +1074,10 @@ describe('Submitted reports', () => {
// With new submission list, we allow to save changes always
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find(
(r) => r._id === '62d561606b4bb5e39601234'
);
Expand Down Expand Up @@ -1102,6 +1153,10 @@ describe('Submitted reports', () => {
maybeIt('Should display submission image on edit page', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find(
(s) => s.cloudinary_id && s.cloudinary_id != 'reports/' && s.cloudinary_id != ''
);
Expand Down Expand Up @@ -1173,6 +1228,10 @@ describe('Submitted reports', () => {
maybeIt('Should display fallback image on edit modal if submission doesnt have an image', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find((s) => s.cloudinary_id === null);

cy.conditionalIntercept(
Expand Down Expand Up @@ -1222,6 +1281,10 @@ describe('Submitted reports', () => {
maybeIt('Should display an error message if Date Published is not in the past', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find(
(r) => r._id === '62d561606b4bb5e39601234'
);
Expand Down Expand Up @@ -1439,6 +1502,10 @@ describe('Submitted reports', () => {
maybeIt('Claims a submission', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find(
(r) => r._id === '5f9c3ebfd4896d392493f03c'
);
Expand Down Expand Up @@ -1509,6 +1576,10 @@ describe('Submitted reports', () => {
maybeIt('Unclaims a submission', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find(
(r) => r._id === '6123bf345e740c1a81850e89'
);
Expand Down Expand Up @@ -1584,6 +1655,10 @@ describe('Submitted reports', () => {
maybeIt('Should maintain current page while claiming', () => {
cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword'));

if (user.adminData.email == Cypress.env('e2eUsername')) {
expect(user.roles.some((role) => ['admin', 'incident_editor'].includes(role))).to.be.true;
}

const submission = submittedReports.data.submissions.find(
(r) => r._id === '433346160eeeeqdd5e382bei234'
);
Expand Down
26 changes: 26 additions & 0 deletions site/gatsby-site/cypress/e2e/integration/discover.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,32 @@ describe('The Discover app', () => {
}
);

it('Should update display types', () => {
cy.visit(url + '?display=list');

cy.get('[data-cy="display-mode-list"]').should('have.class', 'selected');

cy.waitForStableDOM();

cy.get('[data-cy="display-mode-compact"]').click();

cy.waitForStableDOM();

cy.location('search', { timeout: 8000 }).should('contain', 'display=compact');

cy.get('[data-cy="display-mode-compact"]').should('have.class', 'selected');

cy.waitForStableDOM();

cy.get('[data-cy="display-mode-details"]').click();

cy.waitForStableDOM();

cy.location('search', { timeout: 8000 }).should('contain', 'display=details');

cy.get('[data-cy="display-mode-details"]').should('have.class', 'selected');
});

conditionalIt(
!Cypress.env('isEmptyEnvironment'),
'Search using the classifications filter',
Expand Down
Loading

0 comments on commit 152c5c0

Please sign in to comment.