Skip to content

Commit

Permalink
test: add missing profile type scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
benfurber committed Oct 30, 2024
1 parent 410715e commit 505c4d5
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 23 deletions.
3 changes: 2 additions & 1 deletion packages/cypress/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CYPRESS_KEY=62585f33-d688-47b7-acb3-6d1dca832065
VITE_SITE_NAME=Precious Plastic
VITE_SITE_VARIANT=test-ci
VITE_SITE_VARIANT=test-ci
VITE_PLATFORM_THEME=precious-plastic
72 changes: 51 additions & 21 deletions packages/cypress/src/integration/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { ExternalLinkLabel } from 'oa-shared'

import { SingaporeStubResponse } from '../fixtures/searchResults'
import { UserMenuItem } from '../support/commandsUi'
import { generateNewUserDetails } from '../utils/TestUtils'
import {
generateNewUserDetails,
setIsPreciousPlastic,
} from '../utils/TestUtils'

const locationStub = {
administrative: '',
Expand All @@ -19,31 +22,26 @@ const mapDetails = (description) => ({
locationName: locationStub.value,
})
describe('[Settings]', () => {
describe('[Precious Plastic]', () => {
localStorage.setItem(
'VITE_PLATFORM_PROFILES',
'member,workspace,community-builder,collection-point,machine-builder',
)

beforeEach(() => {
cy.interceptAddressSearchFetch(SingaporeStubResponse)
cy.visit('/sign-in')
})
it('[Cancel edit profile and get confirmation]', () => {
cy.signUpNewUser()

describe('[Focus Member]', () => {
it('[Cancel edit profile and get confirmation]', () => {
cy.signUpNewUser()
cy.step('Go to User Settings')
cy.clickMenuItem(UserMenuItem.Settings)

cy.step('Go to User Settings')
cy.clickMenuItem(UserMenuItem.Settings)
cy.get('[data-cy=displayName').clear().type('Wrong user')

cy.get('[data-cy=displayName').clear().type('Wrong user')
cy.step('Confirm shown when attempting to go to another page')
cy.get('[data-cy=page-link]').contains('How-to').click()
cy.get('[data-cy="Confirm.modal: Modal"]').should('be.visible')
})

cy.step('Confirm shown when attempting to go to another page')
cy.get('[data-cy=page-link]').contains('How-to').click()
cy.get('[data-cy="Confirm.modal: Modal"]').should('be.visible')
})
describe('[Fixing Fashion]', () => {
beforeEach(() => {
localStorage.setItem('VITE_PLATFORM_PROFILES', 'member,space')
cy.visit('/sign-in')
})

it('[Member]', () => {
it('[Edit a new profile]', () => {
const country = 'Bolivia'
const userImage = 'avatar'
Expand Down Expand Up @@ -169,6 +167,24 @@ describe('[Settings]', () => {
})
})

it('[Space]', () => {
cy.signUpNewUser()
cy.visit('/settings')
cy.setSettingFocus('space')
})
})

describe('[Precious Plastic]', () => {
beforeEach(() => {
localStorage.setItem(
'VITE_PLATFORM_PROFILES',
'member,workspace,community-builder,collection-point,machine-builder',
)
setIsPreciousPlastic()
cy.interceptAddressSearchFetch(SingaporeStubResponse)
cy.visit('/sign-in')
})

describe('[Focus Workplace]', () => {
it('[Editing a new Profile]', () => {
const coverImage = 'profile-cover-1-edited'
Expand Down Expand Up @@ -431,4 +447,18 @@ describe('[Settings]', () => {
})
})
})

describe('[Project Kamp]', () => {
beforeEach(() => {
localStorage.setItem('VITE_PLATFORM_PROFILES', 'member')
cy.visit('/sign-in')
})

it('[Member]', () => {
cy.signUpNewUser()
cy.visit('/settings')
cy.contains('Infos')
cy.get('[data-cy=FocusSection]').should('not.exist')
})
})
})
2 changes: 1 addition & 1 deletion src/pages/UserSettings/content/sections/Focus.section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ProfileTypes = () => {
<Field
name="profileType"
render={(props) => (
<FlexSectionContainer>
<FlexSectionContainer data-cy="FocusSection">
<Flex sx={{ flexDirection: 'column', gap: 1 }}>
<Heading as="h2">{headings.focus}</Heading>
<Paragraph>
Expand Down

0 comments on commit 505c4d5

Please sign in to comment.