Skip to content

Commit

Permalink
fix(cypress): failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
keellyp committed Sep 10, 2024
1 parent c7b2944 commit 4096ef9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
17 changes: 8 additions & 9 deletions cypress/e2e/t10-add-subscription.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Subscriptions', () => {
})

const subscriptionName = `Subscription-${Math.round(Math.random() * 10000)}`
const subscriptionAt = DateTime.now().plus({ days: 2 }).toISO()
const subscriptionAt = DateTime.now().plus({ days: 7 }).toISO()
const inputFormattedDate = DateTime.fromISO(subscriptionAt as string).toFormat('LL/dd/yyyy')

it('should be able to add a subscription in the future to customer', () => {
Expand All @@ -18,22 +18,21 @@ describe('Subscriptions', () => {
cy.get('[data-test="submit"]').should('be.disabled')
cy.get('input[name="planId"]').click({ force: true })
cy.get('[data-option-index="0"]').click({ force: true })
cy.get('input[name="subscriptionAt"]')
.clear({ force: true })
.type(inputFormattedDate, { force: true })

cy.get('[data-test="create-subscription-form-wrapper"]').within(() => {
cy.get('input[name="name"]').clear({ force: true }).type(subscriptionName)
cy.get('input[name="subscriptionAt"]')
.clear({ force: true })
.type(inputFormattedDate, { force: true })
cy.get('input[name="name"]').clear({ force: true }).type(subscriptionName, { force: true })
})
cy.get('[data-test="submit"]').click({ force: true })
cy.get('[data-test="submit"]').should('not.exist')
cy.contains(subscriptionName).should('exist')
cy.get(`[data-test="${subscriptionName}"]`).should('exist')
})

it('should be able to cancel a future subscription', () => {
cy.get(`[data-test="customer-subscriptions-list"]`).within(() => {
cy.get(`[data-test="${subscriptionName}"]`).click({ force: true })
})
cy.get(`[data-test="${subscriptionName}"]`).should('exist')
cy.get(`[data-test="${subscriptionName}"]`).click({ force: true })

cy.get('[data-test="status"]').should('have.text', 'Pending')
cy.get('[data-test="subscription-details-actions"]').click()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const CustomerSubscriptionsList = ({ customerTimezone }: CustomerSubscrip
const terminateSubscriptionDialogRef = useRef<TerminateCustomerSubscriptionDialogRef>(null)

return (
<SideSection data-test="customer-subscriptions-list">
<SideSection>
<Header variant="subhead" $hideBottomShadow>
{translate('text_6250304370f0f700a8fdc28d')}

Expand Down
3 changes: 2 additions & 1 deletion src/components/form/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { gql } from '@apollo/client'
import { PopperProps as MuiPopperProps } from '@mui/material'
import { PickersCalendarHeader, PickersDay } from '@mui/x-date-pickers'
import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon'
import { DatePicker as MuiDatePicker } from '@mui/x-date-pickers/DatePicker'
import { DesktopDatePicker as MuiDatePicker } from '@mui/x-date-pickers/DesktopDatePicker'
// import { DatePicker as MuiDatePicker } from '@mui/x-date-pickers/DatePicker'
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'
import { DateTime, Settings } from 'luxon'
import { ReactNode, useEffect, useState } from 'react'
Expand Down

0 comments on commit 4096ef9

Please sign in to comment.