Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MalibusParty committed Feb 28, 2024
1 parent 1b9f46a commit 1618062
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 39 deletions.
4 changes: 1 addition & 3 deletions src/Resources/src/components/dishes/DishesHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
/>
</template>
<template #panel="{ close }">
<DishesCreationPanel
@close-panel="close()"
/>
<DishesCreationPanel @close-panel="close()" />
</template>
</Popover>
<DishesSearchBar class="row-span-1 row-start-3 md:col-start-1 md:row-start-2 md:justify-self-start" />
Expand Down
4 changes: 1 addition & 3 deletions src/Resources/src/components/events/EventsActions.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<template>
<div class="flex flex-row content-center items-center justify-end justify-items-end sm:gap-4">
<Popover
:translate-x-min="'-71%'"
>
<Popover :translate-x-min="'-71%'">
<template #button="{ open }">
<ActionButton
:action="Action.EDIT"
Expand Down
4 changes: 1 addition & 3 deletions src/Resources/src/components/events/EventsHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
/>
</template>
<template #panel="{ close }">
<EventCreationPanel
@close-panel="close()"
/>
<EventCreationPanel @close-panel="close()" />
</template>
</Popover>
<InputLabel
Expand Down
6 changes: 3 additions & 3 deletions src/Resources/src/components/menu/MenuDay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ const selectedDishTwo = ref<Dish[] | null>(null);
const selectedEvent = ref<Event | null>(null);
const participationLimitNotZero = computed(() => {
let limitNotZero = false;
(Object.values(props.modelValue.meals) as MealDTO[][]).forEach(meals => {
meals.forEach(meal => {
(Object.values(props.modelValue.meals) as MealDTO[][]).forEach((meals) => {
meals.forEach((meal) => {
if (meal.participationLimit !== 0) {
limitNotZero = true
limitNotZero = true;
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { computed } from 'vue';
import { XCircleIcon } from '@heroicons/vue/solid';
const props = defineProps<{
meals: Dictionary<MealDTO[]>
meals: Dictionary<MealDTO[]>;
}>();
const emit = defineEmits(['closePanel']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const { getDishById } = useDishes();
const isCombi = computed(() => props.meal.dish === 'combined-dish');
const bookedCombi = computed(() => {
return hasParticipantBookedCombiDish(props.dayId, props.participant, mealIdToDishIdDict.get(props.meal.id))
return hasParticipantBookedCombiDish(props.dayId, props.participant, mealIdToDishIdDict.get(props.meal.id));
});
const bookedMeal = computed(() => hasParticipantBookedMeal(props.dayId, props.participant, props.meal.id));
Expand All @@ -94,7 +94,7 @@ async function closeCombiModal(combiMeals: number[]) {
if (combiMeals !== undefined && combiMeals.length === 2) {
const dishSlugs = combiMeals.map((mealId) => {
const dishId = mealIdToDishIdDict.get(mealId);
return dishId !== -1 ? getDishById(dishId).slug : null
return dishId !== -1 ? getDishById(dishId).slug : null;
});
if (dishSlugs !== null) {
await addParticipantToMeal(props.meal.id, props.participant, props.dayId, dishSlugs);
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/tests/unit/finances/FinanceHeader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Test FinanceHeader (with controls)', () => {
});

it('should render correctly', () => {
expect(wrapper.find('h1').text()).toBe('01.09.-10.09.2023');
expect(wrapper.find('h2').text()).toBe('01.09.-10.09.2023');
expect(wrapper.findComponent(VueDatePicker).exists()).toBe(true);
});
});
Expand All @@ -29,7 +29,7 @@ describe('Test FinanceHeader (without controls)', () => {
});

it('should render correctly', () => {
expect(wrapper.find('h1').text()).toBe('01.09.-10.09.2023');
expect(wrapper.find('h2').text()).toBe('01.09.-10.09.2023');
expect(wrapper.findComponent(VueDatePicker).exists()).toBe(false);
});
});
12 changes: 6 additions & 6 deletions tests/e2e/cypress/e2e/Costs.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ describe('Test Cost View', () => {
cy.get('form')
.find('input')
.first()
.clear()
.type('1234');
.clear({ force: true })
.type('1234', { force: true });

cy.get('form')
.find('input[value="Speichern"]')
.click();
.click({ force: true });

cy.get('tr')
.eq(1)
Expand Down Expand Up @@ -123,12 +123,12 @@ describe('Test Cost View', () => {
cy.get('form')
.find('input')
.first()
.clear()
.type('147');
.clear({ force: true })
.type('147', { force: true });

cy.get('form')
.find('input[value="Speichern"]')
.click();
.click({ force: true });

cy.get('tr')
.eq(1)
Expand Down
24 changes: 12 additions & 12 deletions tests/e2e/cypress/e2e/Dishes.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ describe('Test Dishes View', () => {
cy.get('h3').contains('Gericht editieren');
cy.get('input[placeholder="Deutscher Titel"]')
.should('have.value', 'TestGericht1234')
.clear()
.type('TestGericht5678');
.clear({ force: true })
.type('TestGericht5678', { force: true });
cy.get('input[placeholder="Englischer Titel"]')
.should('have.value', 'TestDish1234')
.clear()
.type('TestDish5678');
.clear({ force: true })
.type('TestDish5678', { force: true });
cy.contains('input', 'Speichern').click({ force: true });
cy.wait(['@putDishes']);
cy.log('edit dish');
Expand Down Expand Up @@ -159,8 +159,8 @@ describe('Test Dishes View', () => {
// Create a dish to filter for
cy.get('button').contains('+ Gericht erstellen').click();
cy.wait(['@getCategories']);
cy.get('input[placeholder="Deutscher Titel"]').type('TestGericht1234');
cy.get('input[placeholder="Englischer Titel"]').type('TestDish1234');
cy.get('input[placeholder="Deutscher Titel"]').type('TestGericht1234', { force: true });
cy.get('input[placeholder="Englischer Titel"]').type('TestDish1234', { force: true });
cy.contains('input', 'Speichern').click({ force: true });
cy.log('created dish to filter for');
cy.wait(['@getDishes', '@postDishes'])
Expand Down Expand Up @@ -202,17 +202,17 @@ describe('Test Dishes View', () => {
cy.get('button').contains('+ Gericht erstellen').click();
cy.wait(['@getCategories']);
cy.get('h3').contains('Neues Gericht erstellen');
cy.get('input[placeholder="Deutscher Titel"]').type('TestGericht1234')
cy.get('input[placeholder="Deutscher Titel"]').type('TestGericht1234', { force: true })
.invoke('val')
.then(val => {
expect(val).to.equal('TestGericht1234')
});
cy.get('input[placeholder="Englischer Titel"]').type('TestDish1234')
cy.get('input[placeholder="Englischer Titel"]').type('TestDish1234', { force: true })
.invoke('val')
.then(val => {
expect(val).to.equal('TestDish1234')
});
cy.contains('input', 'Speichern').click();
cy.contains('input', 'Speichern').click({ force: true });
cy.wait(['@getDishes']);
cy.log('created dish');
cy.get('[data-cy="msgClose"]').click();
Expand All @@ -229,17 +229,17 @@ describe('Test Dishes View', () => {
.contains('Variation erstellen')
.click();
cy.get('h3').contains('Variation erstellen');
cy.get('input[placeholder="Deutscher Titel"]').type('TestVariation1234')
cy.get('input[placeholder="Deutscher Titel"]').type('TestVariation1234', { force: true })
.invoke('val')
.then(val => {
expect(val).to.equal('TestVariation1234')
});
cy.get('input[placeholder="Englischer Titel"]').type('TestVariation1234')
cy.get('input[placeholder="Englischer Titel"]').type('TestVariation1234', { force: true })
.invoke('val')
.then(val => {
expect(val).to.equal('TestVariation1234')
});
cy.contains('input', 'Speichern').click();
cy.contains('input', 'Speichern').click({ force: true });
cy.wait(['@getDishes']);
cy.log('create variation');
cy.get('[data-cy="msgClose"]').click();
Expand Down
4 changes: 0 additions & 4 deletions tests/e2e/cypress/e2e/MenuCreationRoundtrip.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ describe('Test Creating a Menu', () => {

cy.wait(['@putMenu', '@getWeeks']);

cy.get('[data-cy="msgClose"]').click();

// Check that all meals and the event are saved
cy.get('input')
.eq(0)
Expand Down Expand Up @@ -320,8 +318,6 @@ describe('Test Creating a Menu', () => {
// Add participant
cy.get('input').first().click().clear().type('finance');
cy.get('li').contains('Meals, Finance').click();
cy.get('[data-cy="msgClose"]').click();
cy.get('h2').contains('Teilnahmen').click();
cy.get('table')
.find('span')
.contains('Meals, Finance')
Expand Down

0 comments on commit 1618062

Please sign in to comment.