Skip to content

Commit

Permalink
Fixes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSCorey committed Aug 28, 2024
1 parent 98357a7 commit 0702257
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
8 changes: 5 additions & 3 deletions cypress/e2e/awx/projects/project-details.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ describe('Projects', () => {
cy.get('[data-ouia-component-id="simple-table"]')
.scrollIntoView()
.within(() => {
cy.getByDataCy('rules-column-header').should('be.visible').and('contain', 'Rules');
cy.getByDataCy('next-occurrence-timestamps-column-header')
.should('be.visible')
.and('contain', 'Rules');
cy.getByDataCy('rules-column-cell').should('have.descendants', 'ul');
cy.get('tbody tr').should('have.length', 1); //First, 1 rule is showing
});
Expand Down Expand Up @@ -190,7 +192,7 @@ describe('Projects', () => {
cy.clickButton(/^Next$/);
cy.wait('@preview');
cy.getByDataCy('local-time-zone').should('contain', 'UTC');
cy.get('[data-cy="exceptions-column-header"]')
cy.get('[data-cy="next-exclusion-timestamps-column-header"]')
.should('be.visible')
.and('contain', 'Exceptions');
cy.intercept('PATCH', awxAPI`/schedules/${schedule.id.toString()}/`).as('edited');
Expand Down Expand Up @@ -219,7 +221,7 @@ describe('Projects', () => {
cy.intercept('PATCH', awxAPI`/schedules/${schedule.id.toString()}/`).as('editedAgain');
cy.getByDataCy('Submit').click();
cy.wait('@editedAgain');
cy.get('[data-cy="exceptions-column-header"]').should('not.exist');
cy.get('[data-cy="next-exclusion-timestamps-column-header"]').should('not.exist');
});

it('can toggle a schedule', () => {
Expand Down
18 changes: 12 additions & 6 deletions cypress/e2e/awx/schedules/schedules.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,9 @@ describe('Schedules - Create and Delete', () => {
);
});
cy.get('[data-ouia-component-id="simple-table"]').within(() => {
cy.getByDataCy('rules-column-header').should('be.visible').and('contain', 'Rules');
cy.getByDataCy('next-occurrence-timestamps-column-header')
.should('be.visible')
.and('contain', 'Rules');
cy.getByDataCy('rules-column-cell').should('have.descendants', 'ul');
cy.get('tbody tr').should('have.length', 1);
});
Expand All @@ -439,7 +441,7 @@ describe('Schedules - Create and Delete', () => {
);
});
cy.get('[data-ouia-component-id="simple-table"]').within(() => {
cy.getByDataCy('exceptions-column-header')
cy.getByDataCy('next-exclusion-timestamps-column-header')
.should('be.visible')
.and('contain', 'Exceptions');
cy.getByDataCy('exceptions-column-cell').should('have.descendants', 'ul');
Expand Down Expand Up @@ -489,7 +491,9 @@ describe('Schedules - Create and Delete', () => {
.first()
.scrollIntoView()
.within(() => {
cy.getByDataCy('rules-column-header').should('be.visible').and('contain', 'Rules');
cy.getByDataCy('next-occurrence-timestamps-column-header')
.should('be.visible')
.and('contain', 'Rules');
cy.getByDataCy('rules-column-cell').should('have.descendants', 'ul');
cy.get('tbody tr').should('have.length', 1);
});
Expand All @@ -498,7 +502,7 @@ describe('Schedules - Create and Delete', () => {
.last()
.scrollIntoView()
.within(() => {
cy.getByDataCy('exceptions-column-header')
cy.getByDataCy('next-exclusion-timestamps-column-header')
.should('be.visible')
.and('contain', 'Exceptions');
cy.getByDataCy('exceptions-column-cell').should('have.descendants', 'ul');
Expand Down Expand Up @@ -677,7 +681,9 @@ describe('Schedules - Edit', () => {
`RRULE:FREQ=MINUTELY;INTERVAL=1;WKST=SU;UNTIL=${date.replaceAll('-', '')}T`
);
cy.get('[data-ouia-component-id="simple-table"]').within(() => {
cy.getByDataCy('rules-column-header').should('be.visible').and('contain', 'Rules');
cy.getByDataCy('next-occurrence-timestamps-column-header')
.should('be.visible')
.and('contain', 'Rules');
cy.getByDataCy('rules-column-cell').should('have.descendants', 'ul');
cy.get('tbody tr').should('have.length', 3);
});
Expand Down Expand Up @@ -823,7 +829,7 @@ describe('Schedules - Edit', () => {
'RRULE:FREQ=MONTHLY'
);
cy.get('[data-ouia-component-id="simple-table"]').within(() => {
cy.get('[data-cy="exceptions-column-header"]').should('not.exist');
cy.getByDataCy('next-exclusion-timestamps-column-header').should('not.exist');
cy.get('tbody tr').should('have.length', 1);
});
cy.intercept('PATCH', awxAPI`/schedules/*`).as('editedSchedule');
Expand Down
2 changes: 1 addition & 1 deletion frontend/awx/views/schedules/components/RuleForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function RuleForm(
const rrulestring = `DTSTART;TZID=${timezone}:${dateString}`;
const ruleStart = RRule.fromString(rrulestring);
const rule = new RRule({ ...ruleStart.options, ...rest });
if (endType === 'until') {
if (until !== null) {
const untilTime = until?.time;
const untilDate = until?.date;
if (untilDate && untilTime) {
Expand Down

0 comments on commit 0702257

Please sign in to comment.