generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move Freestyle OPA templates to
ui5-test-writer
(#2928)
* adding simple handlebar templates * progress * clean up * progress * testing with templates * added OPA generate FF * add ejs templates * clean code * revert shared gen util * removing namespace use for freestyle tests * add logger to package json * pnpm recursive install * Linting auto fix commit * remove namespace reference and improvise code * remove unwanted type * Linting auto fix commit * add tests for freestyle templates * update fiori elements tests * add correct path to fe integration test * update ff snapshots * update snapshots for ff and fe writers * sonar issues * get app id slash logic * change in test order in package scripts * updating int test scripts * removing use of flp sandbox and int flp sandbox * removing console log * lint issues * add changeset * refactoring * use project acces utils * Following the FE templates * change index test names to fiori elements * changeset * changeset * sonar issue fix * split templates based on ui5 versions * sonar issue * add generateOPATests * add generateOPATests * add viewpath to manifest template * add tests to fiori freestyle --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Austin Devine <[email protected]>
- Loading branch information
1 parent
eaef48a
commit fffc3a7
Showing
60 changed files
with
2,699 additions
and
436 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@sap-ux/fiori-freestyle-writer': minor | ||
'@sap-ux/fiori-generator-shared': minor | ||
'@sap-ux/ui5-test-writer': minor | ||
--- | ||
|
||
Add Freestyle OPA templates to ui5-test-writer |
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,53 @@ | ||
import { generateFreestyleOPAFiles } from '@sap-ux/ui5-test-writer'; | ||
import type { Package } from '@sap-ux/ui5-application-writer'; | ||
import type { FreestyleApp, BasicAppSettings } from './types'; | ||
import type { Logger } from '@sap-ux/logger'; | ||
import type { Editor } from 'mem-fs-editor'; | ||
|
||
/** | ||
* Adds test scripts to the package.json object. | ||
* | ||
* @param {Package} packageJson - The package.json object to update. | ||
* @param {boolean} addMock - Whether to include the UI5 mock YAML configuration. | ||
*/ | ||
function addTestScripts(packageJson: Package, addMock: boolean): void { | ||
// Note: 'ui5MockYamlScript' is empty when no data source is selected. | ||
const ui5MockYamlScript = addMock ? '--config ./ui5-mock.yaml ' : ''; | ||
packageJson.scripts = { | ||
...packageJson.scripts, | ||
'unit-test': `fiori run ${ui5MockYamlScript}--open 'test/unit/unitTests.qunit.html'`, | ||
'int-test': `fiori run ${ui5MockYamlScript}--open 'test/integration/opaTests.qunit.html'` | ||
}; | ||
} | ||
|
||
/** | ||
* Generates OPA tests for a freestyle application. | ||
* | ||
* @param {string} basePath - The base directory path. | ||
* @param {FreestyleApp} ffApp - The freestyle application configuration. | ||
* @param {boolean} addMock - Whether to include the UI5 mock YAML configuration. | ||
* @param {Package} packageJson - The package.json object to update. | ||
* @param {Editor} [fs] - Optional file system editor instance. | ||
* @param {Logger} [log] - Optional logger instance. | ||
* @returns {Promise<Editor>} - The modified file system editor. | ||
*/ | ||
export async function generateOPATests<T>( | ||
basePath: string, | ||
ffApp: FreestyleApp<T>, | ||
addMock: boolean, | ||
packageJson: Package, | ||
fs?: Editor, | ||
log?: Logger | ||
): Promise<void> { | ||
addTestScripts(packageJson, addMock); | ||
const config = { | ||
appId: ffApp.app.id, | ||
applicationDescription: ffApp.app.description, | ||
applicationTitle: ffApp.app.title, | ||
viewName: (ffApp.template.settings as BasicAppSettings).viewName, | ||
ui5Theme: ffApp.ui5?.ui5Theme, | ||
ui5Version: ffApp.ui5?.version, | ||
enableTypeScript: ffApp.appOptions?.typescript | ||
}; | ||
await generateFreestyleOPAFiles(basePath, config, fs, log); | ||
} |
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
Oops, something went wrong.