Skip to content

Commit

Permalink
fixed cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Ruf committed Aug 1, 2024
1 parent a194ec3 commit 36f71ca
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 84 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ help:
@echo " run-tests-fe - Run frontend-unit-tests"
@echo " run-cypress - Run cypress"
@echo " run-cypress-headless - Run cypress headless"
@echo " run-cypress-headless-specific - Run one specific cypress test (needs to be adjusted in command)"
@echo " ssh - Open a bash session in the web container"
@echo " update-schema - Update the Doctrine schema"
@echo " mailhog - Open MailHog in the browser"
Expand Down Expand Up @@ -88,6 +89,9 @@ run-cypress:
run-cypress-headless:
yarn --cwd=./tests/e2e cross-env-shell cypress run --headless --browser electron --env "baseUrl=https://meals.test/"

run-cypress-headless-specific:
yarn --cwd=./tests/e2e cross-env-shell cypress run --headless --browser electron --env "baseUrl=https://meals.test/" --spec './cypress/e2e/MenuParticipations.cy.ts'

ssh:
ddev ssh

Expand Down
4 changes: 2 additions & 2 deletions src/Resources/src/components/dashboard/Day.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
{{ weekday }}
</span>
<GuestButton
v-if="!day?.isLocked && !emptyDay && day?.isEnabled && dayID && index"
v-if="!day?.isLocked && !emptyDay && day?.isEnabled && dayID"
:dayID="dayID"
:index="index"
:index="index ?? 0"
:invitation="Invitation.MEAL"
:icon-white="true"
class="row-start-3 w-[24px] pl-[3px] text-center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@
class="relative cursor-pointer px-4 py-1 text-left text-[14px] font-medium text-[#9CA3AF] hover:bg-[#FAFAFA]"
@click="selectProfile(profile as IProfile)"
>
<span class="size-full truncate">
<span
data-cy="add-part-li"
class="size-full truncate"
>
{{ getDisplayName(profile as IProfile) }}
</span>
</LazyListItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ onMounted(async () => {
});
// expose functions for testing
if (process.env.NODE_ENV === 'TEST') {
if (process?.env?.NODE_ENV === 'TEST') {
defineExpose({ loaded });
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function convertToIBookedData(participant: Dictionary<IBookedData>): Dictionary<
}
// expose functions for testing
if (process.env.NODE_ENV === 'TEST') {
if (process?.env?.NODE_ENV === 'TEST') {
defineExpose({ scrollAmount, setScrollDirection, scrollDirectionDown, mealsWithVariations });
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ onUpdated(() => {
}
});
if (process.env.NODE_ENV === 'TEST') {
if (process?.env?.NODE_ENV === 'TEST') {
defineExpose({ tableHeight });
}
</script>
2 changes: 1 addition & 1 deletion src/Resources/src/stores/timeSlotStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function useTimeSlots() {
async function editSlot(id: number, slot: TimeSlot) {
const { updateTimeSlot } = useUpdateSlot();

if (slot.slug === null) {
if (slot.slug === null || slot.slug === undefined) {
slot.slug = TimeSlotState.timeSlots[id].slug;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default defineConfig({
defaultCommandTimeout: 5000,
viewportWidth: 1360,
viewportHeight: 800,
screenshotOnRunFailure: false,
video: false,
screenshotOnRunFailure: true,
video: true,
trashAssetsBeforeRuns: true
})
10 changes: 5 additions & 5 deletions tests/e2e/cypress/e2e/Dishes.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Test Dishes View', () => {
cy.intercept('DELETE', '**/api/dishes/variation/**').as('deleteVariation');
});

it.skip("should be able to navigate to '/dishes' and have the header displayed", () => {
it("should be able to navigate to '/dishes' and have the header displayed", () => {
cy.get('span > a').contains('Gerichte').click({ force: true });

cy.get('h2').should(ele => {
Expand All @@ -25,7 +25,7 @@ describe('Test Dishes View', () => {
cy.get('input[placeholder="Suche nach Titel"]').should('exist');
});

it.skip('should be able to switch the locale to english and back to german', () => {
it('should be able to switch the locale to english and back to german', () => {
cy.get('span > a').contains('Gerichte').click({ force: true });

// Switch language to english
Expand Down Expand Up @@ -55,7 +55,7 @@ describe('Test Dishes View', () => {
cy.get('input[placeholder="Suche nach Titel"]').should('exist');
});

it.skip('should be able to create, edit and delete a dish', () => {
it('should be able to create, edit and delete a dish', () => {
cy.get('span > a').contains('Gerichte').click({ force: true });

// Wait for the dishes and categories to load
Expand Down Expand Up @@ -144,7 +144,7 @@ describe('Test Dishes View', () => {
cy.get('span').contains('TestGericht5678').should('not.exist');
});

it.skip('should be able to filter for a category', () => {
it('should be able to filter for a category', () => {
cy.get('span > a').contains('Gerichte').click({ force: true });

// Wait for the dishes and categories to load
Expand Down Expand Up @@ -175,7 +175,7 @@ describe('Test Dishes View', () => {
cy.contains('td', 'Dessert').should('not.exist');
});

it.skip('should be able to filter for a dish', () => {
it('should be able to filter for a dish', () => {
cy.get('span > a').contains('Gerichte').click({ force: true });

// Wait for the dishes and categories to load
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/cypress/e2e/MenuParticipations.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Test Menu Participations View', () => {
// Test Add Search Bar
cy.get('input').first().click().type('meals');
cy.wait(500);
cy.get('li').each(($el) => {
cy.get('span[data-cy="add-part-li"]').each(($el) => {
expect($el.text()).to.match(/Meals, */);
});
cy.get('input').clear().first().type('bob');
Expand Down
4 changes: 0 additions & 4 deletions tests/e2e/cypress/fixtures/menuPut.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
},
"id": 286,
"enabled": false,
"event": null,
"date": {
"date": "2023-07-10 12:00:00.000000",
"timezone_type": 3,
Expand Down Expand Up @@ -51,7 +50,6 @@
},
"id": 287,
"enabled": true,
"event": null,
"date": {
"date": "2023-07-11 12:00:00.000000",
"timezone_type": 3,
Expand Down Expand Up @@ -118,7 +116,6 @@
},
"id": 289,
"enabled": true,
"event": null,
"date": {
"date": "2023-07-13 12:00:00.000000",
"timezone_type": 3,
Expand All @@ -143,7 +140,6 @@
},
"id": 290,
"enabled": true,
"event": null,
"date": {
"date": "2023-07-14 12:00:00.000000",
"timezone_type": 3,
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"devDependencies": {
"@types/node": "^20.1.2",
"cross-env": "^7.0.3",
"cypress": "^12.12.0",
"cypress": "^13.13.2",
"cypress-keycloak": "^2.0.0",
"cypress-plugin-snapshots": "^1.4.4",
"cypress-split": "^1.24.0",
Expand Down
Loading

0 comments on commit 36f71ca

Please sign in to comment.