Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[next] fix(NcAppNavigationItem): run cypress tests #4853

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

raimund-schluessler
Copy link
Contributor

@raimund-schluessler raimund-schluessler commented Nov 17, 2023

☑️ Resolves

  • Brings back the cypress tests for NcAppNavigationItem.

@raimund-schluessler raimund-schluessler added the feature: app-navigation Related to the app-navigation component label Nov 17, 2023
@raimund-schluessler raimund-schluessler added this to the 9.0.0 next Vue 3 milestone Nov 17, 2023
@raimund-schluessler raimund-schluessler marked this pull request as draft November 17, 2023 19:50
@raimund-schluessler raimund-schluessler added 2. developing Work in progress vue 3 Related to the vue 3 migration labels Nov 18, 2023
@raimund-schluessler raimund-schluessler force-pushed the fix/noid/nav-item-cypress branch 4 times, most recently from 27d92b2 to 90cffb2 Compare December 23, 2023 11:48
@raimund-schluessler raimund-schluessler added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Dec 23, 2023
@raimund-schluessler raimund-schluessler marked this pull request as ready for review December 26, 2023 21:27
@ShGKme
Copy link
Contributor

ShGKme commented Dec 26, 2023

Somehow, using template: '<div style="width: 300px; background: white;"><NcAppNavigationItem name="Home" to="/" :editable="true" /><NcAppNavigationItem name="Foo" to="/foo" :editable="true" /></div>', didn't work anymore, so I created a separate component with a <template> section. If you know why it fails, let me know.

Seems like a runtime version of Vue is used instead of full with compiler. (Or ESM version instead of CJS, because in CJS there is no separation between runtime and full bundle).

@raimund-schluessler
Copy link
Contributor Author

Somehow, using template: '<div style="width: 300px; background: white;"><NcAppNavigationItem name="Home" to="/" :editable="true" /><NcAppNavigationItem name="Foo" to="/foo" :editable="true" /></div>', didn't work anymore, so I created a separate component with a <template> section. If you know why it fails, let me know.

Seems like a runtime version of Vue is used instead of full with compiler. (Or ESM version instead of CJS, because in CJS there is no separation between runtime and full bundle).

Indeed, that is the issue. Any idea how to fix it? I couldn't find anything in the cypress docs.

@ShGKme
Copy link
Contributor

ShGKme commented Dec 28, 2023

Any idea how to fix it? I couldn't find anything in the cypress docs.

Weird bad simple solution: in the test import defineComponent from full Vue:

import { defineComponent } from 'vue/dist/vue.esm-bundler.js'

Better solution could be to specify config in Cypress:

// ...
import { mergeConfig } from 'vite'
import viteConfig from './vite.config.mts'

export default defineConfig({

		// ...
                
		devServer: {
			framework: 'vue',
			bundler: 'vite',
			viteConfig: mergeConfig(viteConfig, {
				resolve: {
					alias: {
						vue: 'vue/dist/vue.esm-bundler.js',
					},
				},
			}),
		},
	},
})

But in the current setup with using TS in configs it is not possible to import vite config from cypress config.

And another alternative could be to define env in cypress config and modify vite config based on env.

Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
@raimund-schluessler
Copy link
Contributor Author

Weird bad simple solution: in the test import defineComponent from full Vue:

import { defineComponent } from 'vue/dist/vue.esm-bundler.js'

I think this is good enough for now. I adjusted the PR accordingly.

@raimund-schluessler
Copy link
Contributor Author

Ping.

@Pytal Pytal merged commit 69c34f5 into next Jan 5, 2024
14 checks passed
@Pytal Pytal deleted the fix/noid/nav-item-cypress branch January 5, 2024 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews feature: app-navigation Related to the app-navigation component vue 3 Related to the vue 3 migration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants