From 1a0538029350367ea33e21015cc0da7bdd6f5ce8 Mon Sep 17 00:00:00 2001 From: Patricio Vighi Date: Mon, 9 Dec 2024 13:27:52 +0000 Subject: [PATCH] remove cypress idapi support --- cypress/support/idapi/auth.ts | 7 -- cypress/support/idapi/consent.ts | 122 ------------------------- cypress/support/idapi/guest.ts | 12 --- cypress/support/idapi/newsletter.ts | 126 -------------------------- cypress/support/idapi/user.ts | 18 ---- cypress/support/idapi/verify_email.ts | 27 ------ 6 files changed, 312 deletions(-) delete mode 100644 cypress/support/idapi/auth.ts delete mode 100644 cypress/support/idapi/consent.ts delete mode 100644 cypress/support/idapi/guest.ts delete mode 100644 cypress/support/idapi/newsletter.ts delete mode 100644 cypress/support/idapi/user.ts delete mode 100644 cypress/support/idapi/verify_email.ts diff --git a/cypress/support/idapi/auth.ts b/cypress/support/idapi/auth.ts deleted file mode 100644 index 0712ba563..000000000 --- a/cypress/support/idapi/auth.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const AUTH_REDIRECT_ENDPOINT = '/auth/redirect'; - -export const authRedirectSignInRecentlyEmailValidated = { - signInStatus: 'signedInRecently', - emailValidated: true, - redirect: null, -}; diff --git a/cypress/support/idapi/consent.ts b/cypress/support/idapi/consent.ts deleted file mode 100644 index ff3da7038..000000000 --- a/cypress/support/idapi/consent.ts +++ /dev/null @@ -1,122 +0,0 @@ -export const CONSENT_ERRORS = { - GENERIC: 'There was a problem saving your choice, please try again.', -}; - -export const CONSENTS_ENDPOINT = '/consents'; - -export const allConsents = [ - { - id: 'sms', - isOptOut: false, - isChannel: true, - name: 'SMS', - description: - "I would like to receive updates about the Guardian products and services I've selected above by SMS (text messages).", - }, - { - id: 'holidays', - isOptOut: false, - isChannel: false, - name: 'Holidays & Vacations', - description: - 'Ideas and inspiration for your next trip away, as well as the latest offers from Guardian Holidays in the UK and Guardian Vacations in the US.', - }, - { - id: 'market_research_optout', - isOptOut: true, - isChannel: false, - name: 'Allow the Guardian to contact me for market research purposes', - description: - 'From time to time we may contact you for market research purposes inviting you to complete a survey, or take part in a group discussion. Normally, this invitation would be sent via email, but we may also contact you by phone.', - }, - { - id: 'offers', - isOptOut: false, - isChannel: false, - name: 'Offers', - description: - 'Offers and competitions from the Guardian and other carefully selected and trusted partners that we think you might like. Don’t worry, we won’t share your personal information with them. Available in the UK, Aus and US.', - }, - { - id: 'post_optout', - isOptOut: true, - isChannel: false, - name: 'Allow the Guardian to send communications by post', - }, - { - id: 'profiling_optout', - isOptOut: true, - isChannel: false, - name: 'Allow the Guardian to analyse this data to improve marketing content', - }, - { - id: 'phone_optout', - isOptOut: true, - isChannel: true, - name: 'Allow the Guardian to send communications by telephone', - }, - { - id: 'supporter', - isOptOut: false, - isChannel: false, - name: 'Supporting the Guardian', - description: - 'News and offers from the Guardian, The Observer and Guardian Weekly, on the ways to read and support our journalism. Already a member, subscriber or contributor? Opt in here to receive your regular emails and updates.', - }, - { - id: 'jobs', - isOptOut: false, - isChannel: false, - name: 'Jobs', - description: - 'Receive tips, Job Match recommendations, and advice from Guardian Jobs on taking your next career step.', - }, - { - id: 'events', - isOptOut: false, - isChannel: false, - name: 'Guardian Live events', - description: - 'Receive weekly newsletters about our new livestreamed and interactive events that you can access from wherever you are in the world.', - }, - { - id: 'personalised_advertising', - isOptOut: false, - isChannel: false, - name: 'Allow personalised advertising using this data - this supports the Guardian', - }, - { - id: 'similar_guardian_products', - isOptOut: false, - isChannel: false, - name: 'Guardian products and support', - description: - 'Information on our products and ways to support and enjoy our independent journalism.', - }, -]; - -export const defaultUserConsent = allConsents.map(({ id }) => ({ - id, - consented: false, -})); - -export const getUserConsents = (consented: string[]) => { - if (!consented.length) { - return defaultUserConsent; - } - return allConsents.map(({ id }) => { - return { - id, - consented: consented.includes(id), - }; - }); -}; - -export const optedOutUserConsent = getUserConsents([ - 'profiling_optout', - 'market_research_optout', -]); - -export const optedIntoPersonalisedAdvertisingUserConsent = getUserConsents([ - 'personalised_advertising', -]); diff --git a/cypress/support/idapi/guest.ts b/cypress/support/idapi/guest.ts deleted file mode 100644 index 4c218ad88..000000000 --- a/cypress/support/idapi/guest.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const GUEST_ENDPOINT = '/guest'; - -export const invalidEmailAddress = { - status: 'error', - errors: [ - { - message: 'Invalid emailAddress:', - description: 'Please enter a valid email address', - context: 'user.primaryEmailAddress', - }, - ], -}; diff --git a/cypress/support/idapi/newsletter.ts b/cypress/support/idapi/newsletter.ts deleted file mode 100644 index 60e342ac9..000000000 --- a/cypress/support/idapi/newsletter.ts +++ /dev/null @@ -1,126 +0,0 @@ -export const NEWSLETTER_ENDPOINT = '/newsletters'; -export const NEWSLETTER_SUBSCRIPTION_ENDPOINT = '/users/me/newsletters'; - -export const NEWSLETTER_ERRORS = { - GENERIC: - 'There was a problem displaying newsletter options, please try again.', -}; - -export const allNewsletters = [ - { - id: 'morning-mail', - name: "Guardian Australia's Morning Mail", - description: - 'Our Australian morning briefing email breaks down the key national and international stories of the day and why they matter', - frequency: 'Every weekday', - exactTargetListId: 4148, - }, - { - id: 'afternoon-update', - name: "Guardian Australia's Afternoon Update", - description: - 'Our Australian afternoon update email breaks down the key national and international stories of the day and why they matter', - frequency: 'Every weekday', - exactTargetListId: 6023, - }, - { - id: 'five-great-reads', - name: 'Five Great Reads', - description: - 'Each week our editors select five of the most interesting, entertaining and thoughtful reads published by Guardian Australia and our international colleagues. Sign up to receive it in your inbox every Saturday morning', - frequency: 'Weekly', - exactTargetListId: 6019, - }, - { - id: 'saved-for-later', - name: 'Saved for Later', - description: - "Catch up on the fun stuff with Guardian Australia's culture and lifestyle rundown of pop culture, trends and tips", - frequency: 'Weekly', - exactTargetListId: 6003, - }, - { - id: 'the-crunch', - name: 'The Crunch', - description: 'Lorem Ipsum', - frequency: 'Fortnightly', - exactTargetListId: 6034, - }, - { - id: 'morning-briefing', - name: 'First Edition', - description: - 'Archie Bland and Nimo Omer take you through the top stories and what they mean, free every weekday morning', - frequency: 'Every weekday', - exactTargetListId: 4156, - }, - { - id: 'us-morning-newsletter', - name: 'First Thing: the US morning briefing', - description: - "Stay informed with a summary of the top stories from the US and the day's must-reads from across the Guardian", - frequency: 'Every weekday', - exactTargetListId: 4300, - }, - { - id: 'today-us', - name: 'The Guardian Headlines US', - description: - 'For US readers, we offer a regional edition of our daily email, delivering the most important headlines every morning', - frequency: 'Every day', - exactTargetListId: 4152, - }, - { - id: 'soccer-with-jonathan-wilson', - name: 'Soccer with Jonathan Wilson', - description: - 'Jonathan Wilson brings expert analysis on the biggest stories from European soccer', - frequency: 'Weekly', - exactTargetListId: 6030, - }, - { - id: 'green-light', - name: 'Green Light', - description: - 'In each weekly edition our editors highlight the most important environment stories of the week including data, opinion pieces and background guides. We’ll also flag up our best video, picture galleries, podcasts, blogs and green living guides', - frequency: 'Weekly', - exactTargetListId: 4147, - }, - { - id: 'the-long-read', - name: 'The Long Read', - description: - 'Get lost in a great story. From politics to fashion, international investigations to new thinking, culture to crime - we’ll bring you the biggest ideas and the arguments that matter. Sign up to have the Guardian’s award-winning long reads emailed to you every Saturday morning', - frequency: 'Every Saturday', - exactTargetListId: 4165, - }, - { - id: 'tech-scape', - description: "Alex Hern's looks at how technology is shaping our lives", - name: 'TechScape', - frequency: 'Weekly', - nameId: 'tech-scape', - exactTargetListId: 6013, - }, - { - id: 'this-is-europe', - description: - 'The most pivotal stories and debates for Europeans – from identity to economics to the environment', - name: 'This is Europe', - frequency: 'Weekly', - exactTargetListId: 4234, - }, -]; - -export const userNewsletters = ( - subscriptions: Array<{ listId: number }> = [], -) => { - return { - result: { - htmlPreference: 'HTML', - subscriptions, - globalSubscriptionStatus: 'opted_in', - }, - status: 'ok', - }; -}; diff --git a/cypress/support/idapi/user.ts b/cypress/support/idapi/user.ts deleted file mode 100644 index f07e869fe..000000000 --- a/cypress/support/idapi/user.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { defaultUserConsent } from './consent'; - -export const USER_ENDPOINT = '/user/me'; - -export const USER_CONSENTS_ENDPOINT = '/users/me/consents'; - -export const createUser = (consents = defaultUserConsent) => ({ - status: 'ok', - user: { - primaryEmailAddress: 'a.reader@example.com', - statusFields: { - userEmailValidated: true, - }, - consents, - }, -}); - -export const verifiedUserWithNoConsent = createUser(); diff --git a/cypress/support/idapi/verify_email.ts b/cypress/support/idapi/verify_email.ts deleted file mode 100644 index ef541c884..000000000 --- a/cypress/support/idapi/verify_email.ts +++ /dev/null @@ -1,27 +0,0 @@ -export const validationTokenExpired = { - error: { - status: 'error', - errors: [ - { - message: 'Token expired', - description: 'The activation token is no longer valid', - }, - ], - }, - status: 403, - level: 'error', -}; - -export const validationTokenInvalid = { - error: { - status: 'error', - errors: [ - { - message: 'Invalid token', - description: 'The token you supplied could not be parsed', - }, - ], - }, - status: 403, - level: 'error', -};