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

Migrate Duplicates and Subscriptions collection to new API #3054 #3096

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
883b8fb
Add taxa seeds
cesarvarela Aug 2, 2024
a3ee9c1
Merge remote-tracking branch 'upstream/staging' into feature-migrate-…
cesarvarela Aug 2, 2024
981de5f
Reapply "Add classifications collection to api"
cesarvarela Aug 2, 2024
fb9e113
Fix upsert mutations
cesarvarela Aug 7, 2024
ed00861
Fix classification editor tests
cesarvarela Aug 8, 2024
69f1b90
Update components
cesarvarela Aug 8, 2024
b5bb1bc
Move to correct folder
cesarvarela Aug 8, 2024
b7583c4
Fix mutations handling of relationships
cesarvarela Aug 8, 2024
7439b4e
Update client side query variables
cesarvarela Aug 8, 2024
5b374df
Undo debug comments
cesarvarela Aug 8, 2024
efcc1b8
Merge remote-tracking branch 'upstream/staging' into feature-migrate-…
cesarvarela Aug 8, 2024
d86c861
Update generated code
cesarvarela Aug 8, 2024
0d41b90
temporary silence warning
cesarvarela Aug 8, 2024
fa8d9c4
Update playwright login util to allow mocking local storage session
cesarvarela Aug 9, 2024
727f314
migrate classifications test
cesarvarela Aug 9, 2024
b9c3c5d
Update test
cesarvarela Aug 12, 2024
ef7056e
Update tests to use new login fixture
cesarvarela Aug 12, 2024
fb94f2f
Fix tests
cesarvarela Aug 12, 2024
b97dbaf
Merge remote-tracking branch 'upstream/staging' into feature-migrate-…
cesarvarela Aug 15, 2024
ac28656
Skip data dependant test
cesarvarela Aug 15, 2024
ee5f86d
Prevent login util from dropping users database
cesarvarela Aug 15, 2024
de3f3c6
WIP
cesarvarela Aug 15, 2024
86cf496
Fix custom data mocking
cesarvarela Aug 16, 2024
b37aaac
Merge remote-tracking branch 'upstream/staging' into feature-migrate-…
cesarvarela Aug 16, 2024
6bc4117
check for window to fix crash on build time
cesarvarela Aug 16, 2024
d19ff74
Migrate csettool
cesarvarela Aug 16, 2024
9706d6a
Fix tests
cesarvarela Aug 19, 2024
9971e1c
Merge remote-tracking branch 'upstream/staging' into feature-migrate-…
cesarvarela Aug 19, 2024
2aef16a
Make it easier to debug playwright on ci
cesarvarela Aug 19, 2024
6419083
Add subscriptions collection to api
cesarvarela Aug 21, 2024
42df4f3
Migrate duplicates collection to api
cesarvarela Aug 22, 2024
caca25e
Update duplicates tests
cesarvarela Aug 22, 2024
1569920
Add subscription seeds
cesarvarela Sep 6, 2024
3cef35d
Remove mocks
cesarvarela Sep 6, 2024
11d4727
Merge remote-tracking branch 'upstream/staging' into feature-migrate-…
cesarvarela Sep 6, 2024
71c6846
Migrate subscription tests
cesarvarela Sep 10, 2024
4f6a9a3
Restore submit test
cesarvarela Sep 10, 2024
0e3f570
Merge remote-tracking branch 'upstream/staging' into feature-migrate-…
cesarvarela Sep 11, 2024
a309f99
Merge remote-tracking branch 'upstream/staging' into feature-migrate-…
cesarvarela Sep 11, 2024
72c768e
Add missing header
cesarvarela Sep 11, 2024
31ef41f
Merge remote-tracking branch 'upstream/staging' into feature-migrate-…
cesarvarela Sep 12, 2024
11eabfa
Migrate unsubscribe tests
cesarvarela Sep 12, 2024
5a29734
delete log
cesarvarela Sep 12, 2024
a0147ad
Migrate account tests
cesarvarela Sep 12, 2024
ce66f37
Migrate entity tests
cesarvarela Sep 12, 2024
ba9eb9a
Update subscriptions toggle
cesarvarela Sep 12, 2024
63b3462
Update code generated files
cesarvarela Sep 12, 2024
04009e9
Do not display subscription button before load
cesarvarela Sep 13, 2024
285cb3d
Undo debug changes
cesarvarela Sep 14, 2024
0712b78
Merge remote-tracking branch 'upstream/staging' into feature-migrate-…
cesarvarela Sep 19, 2024
140b47f
Cleanup test files
cesarvarela Sep 20, 2024
c6abde2
Make sure editor notes is set
cesarvarela Sep 20, 2024
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
404 changes: 0 additions & 404 deletions site/gatsby-site/cypress/e2e/integration/subscriptions.cy.js

This file was deleted.

55 changes: 55 additions & 0 deletions site/gatsby-site/playwright/e2e-full/account.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { test } from '../utils';
import { expect } from '@playwright/test';
import config from '../config';

test.describe('Account', () => {
const url = '/account';

test('Should successfully load account page', async ({ page }) => {
await page.goto(url);
});

test('Should display account information if the user is logged in', async ({ page, login }) => {

await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { roles: ['admin'], first_name: 'Test', last_name: 'User' } });

await page.goto(url);

const detailsTable = page.locator('[data-cy="details-table"]');

await expect(detailsTable.locator(`td:text-is("${config.E2E_ADMIN_USERNAME}")`)).toBeVisible();
await expect(detailsTable.locator('td:text-is("Test")')).toBeVisible();
await expect(detailsTable.locator('td:text-is("User")')).toBeVisible();
await expect(detailsTable.locator('span:text-is("admin")')).toBeVisible();

await expect(page.locator('a:text-is("Log out")')).toBeVisible();
});

test('Should allow editing user data', async ({ page, login }) => {

await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { roles: ['admin'], first_name: 'Test', last_name: 'User' } });

await page.goto(url);


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

const editUserModal = page.getByTestId('edit-user-modal');

await editUserModal.locator('[id="roles"]').fill('banana');
await editUserModal.locator('button:has-text("Submit")').click();

await expect(editUserModal).not.toBeVisible();

await expect(page.locator('span:text-is("banana")')).toBeVisible();
});

test('Should show edit modal if query parameter is set', async ({ page, login }) => {

await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { roles: ['admin'], first_name: 'Test', last_name: 'User' } });

await page.goto(url + '?askToCompleteProfile=1');

await expect(page.getByTestId('edit-user-modal')).toBeVisible();
});
});
2 changes: 1 addition & 1 deletion site/gatsby-site/playwright/e2e-full/admin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test.describe('Admin', () => {
'Should display a list of users, their roles and allow edition',
async ({ page, login, skipOnEmptyEnvironment }) => {

const userId = await login(process.env.E2E_ADMIN_USERNAME, process.env.E2E_ADMIN_PASSWORD, { customData: { first_name: 'John', last_name: 'Doe', roles: ['admin'] } });
const [userId] = await login(process.env.E2E_ADMIN_USERNAME, process.env.E2E_ADMIN_PASSWORD, { customData: { first_name: 'John', last_name: 'Doe', roles: ['admin'] } });
const users = [{ userId, first_name: 'John', last_name: 'Doe', roles: ['admin'] }];

await page.goto(baseUrl);
Expand Down
14 changes: 7 additions & 7 deletions site/gatsby-site/playwright/e2e-full/apps/checklistForm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test.describe('Checklists App Form', () => {

test('Should allow editing for owner', async ({ page, login }) => {

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });


await conditionalIntercept(
Expand Down Expand Up @@ -95,7 +95,7 @@ test.describe('Checklists App Form', () => {

test('Should trigger GraphQL upsert query on adding tag', async ({ page, login }) => {

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });

await conditionalIntercept(
page,
Expand Down Expand Up @@ -125,7 +125,7 @@ test.describe('Checklists App Form', () => {

test('Should trigger GraphQL update on removing tag', async ({ page, login }) => {

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });

await conditionalIntercept(
page,
Expand Down Expand Up @@ -162,7 +162,7 @@ test.describe('Checklists App Form', () => {

test('Should trigger UI update on adding and removing tag', async ({ page, login }) => {

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });

await conditionalIntercept(
page,
Expand Down Expand Up @@ -208,7 +208,7 @@ test.describe('Checklists App Form', () => {

test('Should change sort order of risk items', async ({ page, login }) => {

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });

await page.setViewportSize({ width: 1920, height: 1080 });

Expand Down Expand Up @@ -244,7 +244,7 @@ test.describe('Checklists App Form', () => {

await init();

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });

await conditionalIntercept(
page,
Expand Down Expand Up @@ -310,7 +310,7 @@ test.describe('Checklists App Form', () => {
// TODO: test is crashing not sure if it is a bug or missing seed data
test.skip('Should persist open state on editing query', async ({ page, login }) => {

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });

await conditionalIntercept(
page,
Expand Down
10 changes: 5 additions & 5 deletions site/gatsby-site/playwright/e2e-full/apps/checklistIndex.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test.describe('Checklists App Index', () => {

test('Should sort checklists', async ({ page, login }) => {

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });

await conditionalIntercept(
page,
Expand Down Expand Up @@ -80,7 +80,7 @@ test.describe('Checklists App Index', () => {

test.skip('Should show delete buttons only for owned checklists', async ({ page, login }) => {

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });

await conditionalIntercept(
page,
Expand All @@ -93,7 +93,7 @@ test.describe('Checklists App Index', () => {
about: '',
id: 'fakeChecklist1',
name: 'My Checklist',
owner_id: user.userId,
owner_id: userId,
risks: [],
tags_goals: [],
tags_methods: [],
Expand Down Expand Up @@ -142,7 +142,7 @@ test.describe('Checklists App Index', () => {

test('Should show toast on error fetching risks', async ({ page, login }) => {

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });

await conditionalIntercept(
page,
Expand Down Expand Up @@ -195,7 +195,7 @@ test.describe('Checklists App Index', () => {

test('Should show toast on error creating checklist', async ({ page, login }) => {

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['admin'] } });

await conditionalIntercept(
page,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ test.describe('Classifications App', () => {

test('Successfully edit a CSET classification', async ({ page, login }) => {



await login(process.env.E2E_ADMIN_USERNAME, process.env.E2E_ADMIN_PASSWORD, { customData: { roles: ['admin'] } });

await page.goto(url);
Expand Down
8 changes: 4 additions & 4 deletions site/gatsby-site/playwright/e2e-full/apps/submitted.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ test.describe('Submitted reports', () => {

await init();

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['incident_editor'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['incident_editor'] } });

await page.goto(url);

Expand All @@ -398,7 +398,7 @@ test.describe('Submitted reports', () => {

await init();

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['incident_editor'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['incident_editor'] } });

const submissions: DBSubmission[] = [{
_id: new ObjectId('63f3d58c26ab981f33b3f9c7'),
Expand Down Expand Up @@ -454,7 +454,7 @@ test.describe('Submitted reports', () => {

await init();

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['incident_editor'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['incident_editor'] } });

const submissions: DBSubmission[] = Array.from(Array(10).keys()).map(i => {

Expand Down Expand Up @@ -523,7 +523,7 @@ test.describe('Submitted reports', () => {

await init();

const userId = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['incident_editor'] } });
const [userId] = await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD, { customData: { first_name: 'Test', last_name: 'User', roles: ['incident_editor'] } });

const submissions: DBSubmission[] = [{
_id: new ObjectId('63f3d58c26ab981f33b3f9c7'),
Expand Down
Loading
Loading