Fix e2e test

This commit is contained in:
Ramon Wenger 2023-05-25 10:29:40 +02:00
parent a686d84968
commit ad9a7bb697
2 changed files with 14 additions and 4 deletions

View File

@ -14,11 +14,13 @@ describe('Email Verification', () => {
it('forwards to homepage if confirmation key is correct', () => {
cy.viewport('macbook-15');
cy.mockGraphql({
schema: schema,
operations: {
Coupon: {
coupon: {
success: true,
result: {
__typename: 'Success',
message: 'Yay!',
},
},
},
},
@ -44,7 +46,14 @@ describe('Email Verification', () => {
cy.mockGraphql({
schema: schema,
operations: {
Coupon: new GraphQLError('invalid_coupon'),
Coupon: {
coupon: {
result: {
__typename: 'InvalidCoupon',
reason: 'No no',
},
},
},
},
});
cy.apolloLogin('rachel.green', 'test');

View File

@ -42,6 +42,7 @@ const mockGraphql = (options?: any) => {
const resolverMap = {
DeleteSnapshotResult: typenameResolver,
UpdateSnapshotResult: typenameResolver,
RedeemCouponResult: typenameResolver,
};
const schema = makeExecutableSchema({
typeDefs: schemaString,
@ -225,7 +226,7 @@ Cypress.Commands.add('openSidebar', () => {
});
Cypress.Commands.add('setup', () => {
cy.fakeLogin('nino.teacher', 'test');
cy.fakeLogin();
cy.viewport('macbook-15');
cy.mockGraphql();
});