Skip to content

Commit

Permalink
fix: datepicker issues in cypress
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 committed Aug 22, 2024
1 parent 22ac1a6 commit bb910ea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion e2e/cypress/e2e/userSettings/apiKeys.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('API keys', () => {
assertMessage('API key successfully created');
});

it('Regenerates key', () => {
it.only('Regenerates key', () => {

Check warning on line 76 in e2e/cypress/e2e/userSettings/apiKeys.cy.ts

View workflow job for this annotation

GitHub Actions / E2E Static Check 🪲

it.only not permitted
const description = 'Oh I am expired';
cy.contains(description)
.closestDcy('api-key-list-item')
Expand Down
9 changes: 5 additions & 4 deletions e2e/cypress/support/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ export const register = () => {
});
});

Cypress.Commands.add('chooseDatePicker', (selector, value) => {
cy.get('body').then(($body) => {
Cypress.Commands.add(
'chooseDatePicker',
(selector: string, value: string) => {
cy.get(selector).find('input').clear().type(value);
});
});
}
);
};
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { useField } from 'formik';
import { default as React, useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import {
Box,
FormControl,
InputLabel,
MenuItem,
Select,
TextField as MuiTextField,
useTheme,
} from '@mui/material';
import { T } from '@tolgee/react';
import { DatePicker } from '@mui/x-date-pickers';
Expand All @@ -18,6 +19,7 @@ export const ExpirationDateField = ({
options: ExpirationDateOptions;
}) => {
const [input, _, helpers] = useField('expiresAt');
const theme = useTheme();

const getInitialSelectValue = () =>
options.find((o) => o.time === input.value)?.value || 'custom';
Expand Down Expand Up @@ -73,6 +75,7 @@ export const ExpirationDateField = ({
}
}}
slots={{ textField: MuiTextField }}
desktopModeMediaQuery={theme.breakpoints.up('md')}
/>
</Box>
)}
Expand Down

0 comments on commit bb910ea

Please sign in to comment.