Skip to content

Commit

Permalink
remove data-cy attribute used in marketing e2e test and replace with …
Browse files Browse the repository at this point in the history
…test/copy selector

small fix to marketing checkbox left padding
  • Loading branch information
Richard Bangay committed Oct 16, 2024
1 parent eacaf0a commit 586fb4a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ exports[`NewsletterPreference component renders correctly and displays marketing
font-family: "Guardian Text Sans Web","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
line-height: 1.333;
margin-top: 12px;
padding-left: 30px;
}
.emotion-1 {
Expand Down Expand Up @@ -307,7 +306,6 @@ exports[`NewsletterPreference component will select the checkbox when the select
font-family: "Guardian Text Sans Web","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
line-height: 1.333;
margin-top: 12px;
padding-left: 30px;
}
.emotion-1 {
Expand Down
1 change: 0 additions & 1 deletion client/components/mma/identity/NewsletterPreference.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ export const NewsletterPreference: FC<NewsletterPreferenceProps> = (props) => {
{
lineHeight: '1.333',
marginTop: '12px',
paddingLeft: '30px',
},
]}
>
Expand Down
4 changes: 1 addition & 3 deletions client/components/mma/identity/PageSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ interface PageSectionProps {
title?: string;
description?: string | ReactNode;
subtext?: string;
testSelector?: string;
}

const getTitle = (title: PageSectionProps['title']) => (
Expand Down Expand Up @@ -51,10 +50,9 @@ const getSubtext = (subtext: PageSectionProps['subtext']) => (
);

export const PageSection: FC<PageSectionProps> = (props) => {
const { children, description, title, subtext, testSelector } = props;
const { children, description, title, subtext } = props;
return (
<div
data-cy={testSelector}
css={{
[from.desktop]: {
display: 'flex',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export const NewsletterSection: FC<NewsletterSectionProps> = (props) => {
const { newsletters, clickHandler } = props;
return (
<PageSection
testSelector="your_newsletters"
title="Your newsletters"
description={`
Our regular newsletters help you get closer to our quality,
Expand Down
8 changes: 6 additions & 2 deletions cypress/tests/e2e/e2e.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ describe('E2E with Okta', () => {
.find('input[type=checkbox]')
.should('not.be.checked');

cy.get('[data-cy="your_newsletters"]')
cy.findByText('Your newsletters')
.parent()
.parent()
.find('a')
.click({ multiple: true });

cy.get('[data-cy="your_newsletters"]')
cy.findByText('Your newsletters')
.parent()
.parent()
.find('input[type=checkbox]')
.should('not.be.checked');
});
Expand Down

0 comments on commit 586fb4a

Please sign in to comment.