Skip to content

Commit cc52c2e

Browse files
committed
Update e2e tests to be compatible with new logged in user structure
1 parent 952d653 commit cc52c2e

10 files changed

+36
-38
lines changed

test/cypress/integration/00-applications-oauth.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('OAuth Applications', () => {
88
});
99

1010
it('create and edit applications', () => {
11-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/for-developers` });
11+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/for-developers` });
1212

1313
cy.log('Starts with an empty state');
1414
cy.contains('[data-cy="oauth-apps-list"]', "You don't have any app yet");
@@ -66,12 +66,12 @@ describe('OAuth Applications', () => {
6666

6767
it('create application with 2fa enabled', () => {
6868
cy.signup({ user: { name: 'OAuth tester', settings: { features: { adminPanel: true } } } }).then(user => {
69-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/for-developers` });
69+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/for-developers` });
7070

7171
const secret = generateSecret({ length: 64 });
7272
cy.enableTwoFactorAuth({
7373
userEmail: user.email,
74-
userSlug: user.collective.slug,
74+
userSlug: user.slug,
7575
secret: secret,
7676
});
7777

@@ -136,7 +136,7 @@ describe('OAuth Applications', () => {
136136
// Warning: this test is dependant on the previous one. To make it independent, connect the OAuth app with
137137
it('can list & revoke authorization tokens in the admin', () => {
138138
cy.log('App is in list');
139-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/authorized-apps` });
139+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/authorized-apps` });
140140
cy.getByDataCy('connected-oauth-app').should('have.length', 1);
141141
cy.getByDataCy('connected-oauth-app').should('contain', 'My second App');
142142

test/cypress/integration/00-personal-token.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('Personal Token', () => {
1111
});
1212

1313
it('create and edit personal token', () => {
14-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/for-developers` });
14+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/for-developers` });
1515

1616
cy.log('Starts with an empty state');
1717
cy.contains('[data-cy="personal-tokens-list"]', "You don't have any token yet");
@@ -75,12 +75,12 @@ describe('Personal Token', () => {
7575

7676
it('create application with 2fa enabled', () => {
7777
cy.signup({ user: { name: 'Personal token tester', settings: { features: { adminPanel: true } } } }).then(user => {
78-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/for-developers` });
78+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/for-developers` });
7979

8080
const secret = generateSecret({ length: 64 });
8181
cy.enableTwoFactorAuth({
8282
userEmail: user.email,
83-
userSlug: user.collective.slug,
83+
userSlug: user.slug,
8484
secret: secret,
8585
});
8686

test/cypress/integration/07-password.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('passwords', () => {
1010
});
1111

1212
it('can be set from the settings page', () => {
13-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/user-security` });
13+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/user-security` });
1414
cy.contains("Setting a password is optional but can be useful if you're using a password manager.");
1515

1616
// Submit disabled because no password set
@@ -52,7 +52,7 @@ describe('passwords', () => {
5252
});
5353

5454
it('can then be edited', () => {
55-
cy.login({ sendLink: true, email: user.email, redirect: `/dashboard/${user.collective.slug}/user-security` });
55+
cy.login({ sendLink: true, email: user.email, redirect: `/dashboard/${user.slug}/user-security` });
5656

5757
// Disable button if form is not complete
5858
cy.contains('button', 'Update Password').should('be.disabled');
@@ -105,8 +105,8 @@ describe('passwords', () => {
105105
cy.getByDataCy('user-menu-trigger').click();
106106
cy.getByDataCy('logout').click();
107107

108-
// Login with password on protected page (`/${user.collective.slug}/dashboard/user-security`)
109-
cy.visit(`/dashboard/${user.collective.slug}/user-security`);
108+
// Login with password on protected page (`/${user.slug}/dashboard/user-security`)
109+
cy.visit(`/dashboard/${user.slug}/user-security`);
110110
completeSignInForm();
111111
});
112112

@@ -154,10 +154,10 @@ describe('passwords', () => {
154154
it('can be used in combination with 2FA', () => {
155155
// Enable 2FA on user
156156
const secret = generateSecret({ length: 64 });
157-
cy.enableTwoFactorAuth({ userEmail: user.email, userSlug: user.collective.slug, secret: secret });
157+
cy.enableTwoFactorAuth({ userEmail: user.email, userSlug: user.slug, secret: secret });
158158

159159
// Sign-in flow
160-
cy.visit(`/signin?next=/dashboard/${user.collective.slug}/info`);
160+
cy.visit(`/signin?next=/dashboard/${user.slug}/info`);
161161
cy.get('input[name="email"]').type(user.email);
162162
cy.getByDataCy('signin-btn').click();
163163
cy.get('input[name="password"]:visible').type('strongNewP@ssword<>?');

test/cypress/integration/07-signin.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ describe('signin with 2FA', () => {
111111
secret = generateSecret({ length: 64 });
112112
return await cy.enableTwoFactorAuth({
113113
userEmail: user.email,
114-
userSlug: user.collective.slug,
114+
userSlug: user.slug,
115115
secret: secret,
116116
});
117117
})

test/cypress/integration/07-whitelabel.signin.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('white-label signin', () => {
5757
.then(() => {
5858
return cy.enableTwoFactorAuth({
5959
userEmail: user.email,
60-
userSlug: user.collective.slug,
60+
userSlug: user.slug,
6161
secret: secret,
6262
});
6363
});

test/cypress/integration/08-user.change-email.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('Users can change their email address', () => {
1515

1616
it('uses a form in advanced settings', () => {
1717
// Go to /dashboard/:collective/advanced
18-
cy.visit(`/dashboard/${user.collective.slug}/advanced`);
18+
cy.visit(`/dashboard/${user.slug}/advanced`);
1919

2020
// Initial form should have current email in it
2121
cy.get('[data-cy=EditUserEmailForm] input[name=email]').should('have.value', user.email);
@@ -61,7 +61,7 @@ describe('Users can change their email address', () => {
6161
it('can re-send the confirmation email', () => {
6262
const emailForDoubleConfirmation = randomEmail();
6363

64-
cy.login({ email: newEmail, redirect: `/dashboard/${user.collective.slug}/advanced` });
64+
cy.login({ email: newEmail, redirect: `/dashboard/${user.slug}/advanced` });
6565
cy.get('[data-cy=EditUserEmailForm] input[name=email]').type(`{selectall}${emailForDoubleConfirmation}`);
6666
cy.contains('[data-cy=EditUserEmailForm] button', 'Confirm new email').click();
6767
cy.contains('[data-cy=EditUserEmailForm] button', 'Re-send confirmation').click();

test/cypress/integration/27-expenses.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ describe('Expense flow', () => {
767767
type: 'INVOICE',
768768
userEmail: user.email,
769769
account: { legacyId: collective.id },
770-
payee: { legacyId: user.CollectiveId },
770+
payee: { id: user.id },
771771
description: 'Expense for E2E tests',
772772
}).then(createdExpense => {
773773
expense = createdExpense;

test/cypress/integration/29-host.admin.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ describe('host dashboard', () => {
244244
cy.createExpense({
245245
userEmail: user.email,
246246
account: { legacyId: 207 },
247-
payee: { legacyId: user.CollectiveId },
247+
payee: { id: user.id },
248248
}).as('expense');
249249
});
250250

test/cypress/integration/34-expenses.comment.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('New Expense Flow comments', () => {
1414
beforeEach(() => {
1515
cy.createExpense({
1616
userEmail: user.email,
17-
payee: { legacyId: user.CollectiveId },
17+
payee: { id: user.id },
1818
account: { legacyId: collective.id },
1919
}).then(expense => (expenseUrl = `/${collective.slug}/expenses/${expense.legacyId}`));
2020
});

test/cypress/integration/39-recurring-contributions.test.js

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('Recurring contributions', () => {
3333
});
3434

3535
it('Has contributions in the right categories', () => {
36-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/outgoing-contributions` }).then(() => {
36+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/outgoing-contributions` }).then(() => {
3737
// Filter by Yearly frequency
3838
cy.getByDataCy('add-filter').click();
3939
cy.contains('Frequency').click();
@@ -57,22 +57,20 @@ describe('Recurring contributions', () => {
5757
},
5858
},
5959
() => {
60-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/outgoing-contributions` }).then(
61-
() => {
62-
cy.getByDataCy('actions-menu-trigger').first().click();
63-
cy.contains('Update payment method').click();
64-
cy.get('input[type=radio][value="stripe-payment-element"]').check();
65-
cy.wait(500);
66-
cy.fillStripePaymentElementInput();
67-
cy.getByDataCy('recurring-contribution-submit-pm-button').click();
68-
cy.getByDataCy('toast-notification').contains('Your recurring contribution has been updated.');
69-
},
70-
);
60+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/outgoing-contributions` }).then(() => {
61+
cy.getByDataCy('actions-menu-trigger').first().click();
62+
cy.contains('Update payment method').click();
63+
cy.get('input[type=radio][value="stripe-payment-element"]').check();
64+
cy.wait(500);
65+
cy.fillStripePaymentElementInput();
66+
cy.getByDataCy('recurring-contribution-submit-pm-button').click();
67+
cy.getByDataCy('toast-notification').contains('Your recurring contribution has been updated.');
68+
});
7169
},
7270
);
7371

7472
it('Can change the tier and amount of the order', () => {
75-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/outgoing-contributions` }).then(() => {
73+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/outgoing-contributions` }).then(() => {
7674
cy.getByDataCy('actions-menu-trigger').first().click();
7775
cy.contains('Update amount').click();
7876
cy.contains('[data-cy="recurring-contribution-tier-box"]', 'Backer').within(() => {
@@ -85,7 +83,7 @@ describe('Recurring contributions', () => {
8583
});
8684

8785
it('Can select a fixed recurring contribution tier', () => {
88-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/outgoing-contributions` }).then(() => {
86+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/outgoing-contributions` }).then(() => {
8987
cy.getByDataCy('actions-menu-trigger').first().click();
9088
cy.contains('Update amount').click();
9189
cy.contains('[data-cy="recurring-contribution-tier-box"]', 'Recurring Fixed Donation Tier').within(() => {
@@ -98,7 +96,7 @@ describe('Recurring contributions', () => {
9896
});
9997

10098
it('Can change the amount in a flexible contribution tier', () => {
101-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/outgoing-contributions` }).then(() => {
99+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/outgoing-contributions` }).then(() => {
102100
cy.getByDataCy('actions-menu-trigger').first().click();
103101
cy.contains('Update amount').click();
104102
cy.contains('[data-cy="recurring-contribution-tier-box"]', 'Sponsor').within(() => {
@@ -113,7 +111,7 @@ describe('Recurring contributions', () => {
113111
});
114112

115113
it('Can contribute a custom contribution amount', () => {
116-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/outgoing-contributions` }).then(() => {
114+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/outgoing-contributions` }).then(() => {
117115
cy.getByDataCy('actions-menu-trigger').first().click();
118116
cy.contains('Update amount').click();
119117
cy.contains('[data-cy="recurring-contribution-tier-box"]', 'Sponsor').within(() => {
@@ -133,7 +131,7 @@ describe('Recurring contributions', () => {
133131
});
134132

135133
it('Cannot contribute a contribution amount less than the minimum allowable amount', () => {
136-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/outgoing-contributions` }).then(() => {
134+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/outgoing-contributions` }).then(() => {
137135
cy.getByDataCy('actions-menu-trigger').first().click();
138136
cy.contains('Update amount').click();
139137
cy.contains('[data-cy="recurring-contribution-tier-box"]', 'Sponsor').within(() => {
@@ -153,7 +151,7 @@ describe('Recurring contributions', () => {
153151

154152
it('Can cancel an active contribution with reasons displayed in modal, "other" displays text area', () => {
155153
cy.mailpitDeleteAllEmails();
156-
cy.login({ email: user.email, redirect: `/dashboard/${user.collective.slug}/outgoing-contributions` }).then(() => {
154+
cy.login({ email: user.email, redirect: `/dashboard/${user.slug}/outgoing-contributions` }).then(() => {
157155
cy.getByDataCy('actions-menu-trigger').first().click();
158156
cy.getByDataCy('recurring-contribution-menu-cancel-option').click();
159157
cy.getByDataCy('cancel-order-modal').should('exist');

0 commit comments

Comments
 (0)