Skip to content

Commit

Permalink
fix(onboarding-flow): impletement cypress test
Browse files Browse the repository at this point in the history
  • Loading branch information
aliraza556 committed Oct 26, 2024
1 parent 3e12f26 commit a90b6aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
12 changes: 4 additions & 8 deletions cypress/e2e/admin/signin.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@ describe('Admin Login', () => {
const title = `Testing NavFiber`
const description = 'Testing Graph Description'

// Open settings modal
cy.get('div[data-testid="settings-modal"]').should('be.visible').click()

// Asserting the settings label text
cy.get('[data-testid="setting-label"]').should('have.text', 'Admin Settings')
cy.get('[data-testid="onboarding-title"]').should('have.text', 'Welcome to SecondBrain!')

// Efficiently interact with the about title
cy.get('#cy-about-title-id').should('be.visible').click().type('{selectAll}').type(title)
cy.get('#cy-graph-title-id').should('be.visible').click().type('{selectAll}').type(title)

// Efficiently interact with the about description
cy.get('#cy-about-id').should('be.visible').click().type('{selectAll}').type(description)
cy.get('#cy-graph-description-id').should('be.visible').click().type('{selectAll}').type(description)

// Submit the form
cy.get('#add-node-submit-cta').click()
cy.get('#onboarding-confirm-cta').click()
cy.wait('@updateAbout')

cy.wait(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ export const GraphDetailsStep: FC<Props> = ({ onSubmit, error }) => {
return (
<Flex>
<Flex align="center" direction="column" justify="center">
<StyledText>Welcome to SecondBrain!</StyledText>
<StyledText data-testid="onboarding-title">Welcome to SecondBrain!</StyledText>
<StyledSubText>Set a name and short description for your graph.</StyledSubText>
</Flex>

<StyledWrapper>
<Flex className="input__wrapper">
<TextInput
id="graph-title"
id="cy-graph-title-id"
label="Title"
maxLength={50}
name="title"
Expand All @@ -58,7 +58,7 @@ export const GraphDetailsStep: FC<Props> = ({ onSubmit, error }) => {
}}
/>
<TextInput
id="graph-description"
id="cy-graph-description-id"
label="Description"
maxLength={100}
name="description"
Expand All @@ -78,6 +78,7 @@ export const GraphDetailsStep: FC<Props> = ({ onSubmit, error }) => {
<Button
color="secondary"
disabled={isSubmitting || !!error || !isFormValid}
id="onboarding-confirm-cta"
onClick={onSubmit}
size="large"
variant="contained"
Expand Down

0 comments on commit a90b6aa

Please sign in to comment.