diff --git a/components/BottomMenu.vue b/components/BottomMenu.vue index 6fd892f..3ecdcef 100644 --- a/components/BottomMenu.vue +++ b/components/BottomMenu.vue @@ -56,7 +56,7 @@ const items = ref([{ }) } }]) -if (process.client) { +if (import.meta.client) { const userTokens = useLocalStorage(userTokensKey, []) watchEffect(() => { items.value = [ diff --git a/pages/index.vue b/pages/index.vue index bb5e342..c01c616 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -65,7 +65,7 @@ const router = useRouter() const cookie = useCookie(cookieAuthKey) const isLoggedIn = computed(() => cookie.value ? true : false) if (isLoggedIn.value) { - if (process.client) { + if (import.meta.client) { const userToken = route.query.usr?.toString() const userEmail = route.query.e?.toString() const userTokens = useLocalStorage(userTokensKey, []) diff --git a/plugins/vue-query.ts b/plugins/vue-query.ts index 2226c10..295357d 100644 --- a/plugins/vue-query.ts +++ b/plugins/vue-query.ts @@ -22,13 +22,13 @@ export default defineNuxtPlugin((nuxt) => { nuxt.vueApp.use(VueQueryPlugin, options) - if (process.server) { + if (import.meta.server) { nuxt.hooks.hook('app:rendered', () => { vueQueryState.value = dehydrate(queryClient) }) } - if (process.client) { + if (import.meta.client) { nuxt.hooks.hook('app:created', () => { hydrate(queryClient, vueQueryState.value) }) diff --git a/tests-e2e/home-not-signed.test.mts b/tests-e2e/home-not-signed.test.mts new file mode 100644 index 0000000..6871641 --- /dev/null +++ b/tests-e2e/home-not-signed.test.mts @@ -0,0 +1,8 @@ +import { expect, test } from '@nuxt/test-utils/playwright' + +test.use({ storageState: { cookies: [], origins: [] } }); + +test('Can open distapp and show get started', async ({ page, goto, context }) => { + await goto('/') + await expect(page.getByText('Get Started')).toHaveCount(1) +}) diff --git a/tests-e2e/home.test.mts b/tests-e2e/home.test.mts index 11ef9d4..4fc8a60 100644 --- a/tests-e2e/home.test.mts +++ b/tests-e2e/home.test.mts @@ -1,11 +1,5 @@ import { expect, test } from '@nuxt/test-utils/playwright' -test('Can open distapp and show get started', async ({ page, goto, context }) => { - await context.clearCookies() - await goto('/') - await expect(page.getByText('Get Started')).toHaveCount(1) -}) - test('Logged in user open distapp and show go to apps', async ({ page, goto, context }) => { await goto('/') await expect(page.getByText('Go To Apps')).toHaveCount(1) diff --git a/tests-e2e/switch-account.test.mts b/tests-e2e/switch-account.test.mts index 9032966..8f1835a 100644 --- a/tests-e2e/switch-account.test.mts +++ b/tests-e2e/switch-account.test.mts @@ -1,7 +1,15 @@ import { expect, test } from '@nuxt/test-utils/playwright' -test.skip('Add and switch account', async ({ page, goto, context }) => { +test.use({ storageState: { cookies: [], origins: [] } }); + +test('Add and switch account', async ({ page, goto, context }) => { await goto('/') + await page.getByText('Get Started').click() + + await page.locator('[name="username"]').fill('usertest1') + await page.locator('[name="password"]').fill('a5756f781e0e433986364b82de545c3b') + await page.getByTestId('sign_in_btn').click() + await page.getByText('Go To Apps').click() await page.getByTestId('b_more_btn').click()