Skip to content

Commit

Permalink
Merge pull request #574 from stakwork/feat/cypress-fixes
Browse files Browse the repository at this point in the history
PR: changed date to en-US for cypress test
  • Loading branch information
elraphty committed Sep 2, 2024
2 parents fc27304 + fb02991 commit b9b9344
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cypress/e2e/52_adminCustomDateInput.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,17 @@ describe('Admin Custom Date Input', () => {
const date = new Date(startYear, startMonth - 1, startDay);
const date2 = new Date(endYear, endMonth - 1, endDay);

const formattedDate = date.toLocaleDateString('en-GB', { day: '2-digit', month: 'short' });
const formattedDate2 = date2.toLocaleDateString('en-GB', {
const formattedDate = date.toLocaleDateString('en-US', { day: '2-digit', month: 'short' });
const formattedDate2 = date2.toLocaleDateString('en-US', {
day: '2-digit',
month: 'short',
year: 'numeric'
});

cy.get('[data-testid="month"]').contains(`${formattedDate} - ${formattedDate2}`);
const finalDate = formatSeptemberMonth(formattedDate);
const finalDate2 = formatSeptemberMonth(formattedDate2);

cy.get('[data-testid="month"]').contains(`${finalDate} - ${finalDate2}`);

for (let i = 1; i <= 22; i++) {
cy.contains(`Admin${i}`);
Expand All @@ -77,3 +80,12 @@ describe('Admin Custom Date Input', () => {
cy.logout(activeUser);
});
});

const formatSeptemberMonth = (date: string): string => {
let newDate = '';
if (date.includes('Sept')) {
newDate = date.replace('Sept', 'Sep');
}

return newDate;
};

0 comments on commit b9b9344

Please sign in to comment.