-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LF-4026 PR #2931 feedback - remove empty functions and refactor out b…
…eforeEach setup
- Loading branch information
1 parent
15b6692
commit 8b6684e
Showing
4 changed files
with
69 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2024 LiteFarm.org | ||
* This file is part of LiteFarm. | ||
* | ||
* LiteFarm is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* LiteFarm is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
export const loadTranslationsAndConfigureUserFarm = ({ additionalTranslation }) => { | ||
return cy.fixture('e2e-test-users.json').then((loadedUsers) => { | ||
const users = loadedUsers; | ||
const user = users[Cypress.env('USER')]; | ||
|
||
return cy | ||
.fixture('../../../webapp/public/locales/' + user.locale + '/translation.json') | ||
.then((translation) => { | ||
cy.visit('/'); | ||
|
||
cy.loginOrCreateAccount( | ||
user.email, | ||
user.password, | ||
user.name, | ||
user.language, | ||
translation['MENU']['CROPS'], | ||
translation['MENU']['MAP'], | ||
translation['FARM_MAP']['MAP_FILTER']['GARDEN'], | ||
); | ||
|
||
return cy | ||
.fixture( | ||
'../../../webapp/public/locales/' + user.locale + `/${additionalTranslation}.json`, | ||
) | ||
.then((additionalTranslationData) => { | ||
return [translation, additionalTranslationData]; | ||
}); | ||
}); | ||
}); | ||
}; |