Skip to content

Commit 72f17d3

Browse files
fix angular tests on CI
1 parent fe46411 commit 72f17d3

File tree

9 files changed

+431
-3229
lines changed

9 files changed

+431
-3229
lines changed

packages/devextreme-cli/testing/app-template.test.shared.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = (env, { port = 8080, urls = {} } = {}) => {
3131
let browser;
3232
let page;
3333

34-
const getPageURL = (name) => `${appUrl}${(env.engine.startsWith('react') || env.engine.startsWith('vue') ? '#/' : '')}${pageUrls[name]}`;
34+
const getPageURL = (name) => `${appUrl}${(!env.engine.startsWith('nextjs') ? '#/' : '')}${pageUrls[name]}`;
3535

3636
beforeAll(async() => {
3737
browser = await getBrowser();

packages/devextreme-cli/testing/env.angular.js

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const sandboxPath = path.join(process.cwd(), './testing/sandbox/angular');
1111
const appPath = path.join(sandboxPath, appName);
1212
const schematicsDirectory = '../../../../devextreme-schematics';
1313
const schematicsPath = path.join(sandboxPath, schematicsDirectory);
14-
const routingFilePath = path.join(appPath, 'src/app/app-routing.module.ts');
15-
const appComponentPath = path.join(appPath, 'src/app/app.component.html');
14+
const appComponentTemplatePath = path.join(appPath, 'src/app/app.component.html');
15+
const appComponentPath = path.join(appPath, 'src/app/app.component.ts');
1616

1717
async function prepareSchematics() {
1818
await packageManager.runInstall({
@@ -60,16 +60,28 @@ exports.createApp = async(depsVersionTag) => {
6060
cwd: appPath,
6161
forceNoCmd: true
6262
});
63-
64-
const data = fs.readFileSync(routingFilePath, 'utf8');
65-
const result = data.replace('RouterModule.forRoot(routes)', 'RouterModule.forRoot(routes, {useHash: true})');
66-
fs.writeFileSync(routingFilePath, result, 'utf8');
6763
};
6864

6965
exports.setLayout = (layoutName) => {
70-
const regexToFind = /app-side-nav-\w+-toolbar/g;
71-
const newSubStr = `app-${layoutName}`;
72-
const data = fs.readFileSync(appComponentPath, 'utf8');
73-
const result = data.replace(regexToFind, newSubStr);
74-
fs.writeFileSync(appComponentPath, result, 'utf8');
66+
const layoutClassName = layoutName === 'side-nav-outer-toolbar'
67+
? 'SideNavOuterToolbarComponent'
68+
: 'SideNavInnerToolbarComponent';
69+
70+
[
71+
{
72+
filePath: appComponentTemplatePath,
73+
regexp: /app-side-nav-\w+-toolbar/g,
74+
replacement: `app-${layoutName}`,
75+
},
76+
{
77+
filePath: appComponentPath,
78+
regexp: /SideNav\w+ToolbarComponent/,
79+
replacement: layoutClassName,
80+
}
81+
].forEach(({ filePath, regexp, replacement }) => {
82+
const data = fs.readFileSync(filePath, 'utf8');
83+
const result = data.replace(regexp, replacement);
84+
fs.writeFileSync(filePath, result, 'utf8');
85+
});
86+
7587
};

0 commit comments

Comments
 (0)