From 9d4ab60dfe5054b20f620d59d0c62db01b536e16 Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Wed, 13 Apr 2022 19:51:22 -0500 Subject: [PATCH 01/10] fix: running a new test after already having run tests --- packages/app/src/runner/unifiedRunner.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/app/src/runner/unifiedRunner.ts b/packages/app/src/runner/unifiedRunner.ts index 7a1fe2ef8cb2..965839e60e6d 100644 --- a/packages/app/src/runner/unifiedRunner.ts +++ b/packages/app/src/runner/unifiedRunner.ts @@ -8,6 +8,8 @@ import type { SpecFile } from '@packages/types/src' import { getPathForPlatform } from '../paths' const initialized = ref(false) +let specsWatcher +let specWatcher export function useUnifiedRunner () { onMounted(async () => { @@ -18,6 +20,14 @@ export function useUnifiedRunner () { onBeforeUnmount(() => { UnifiedRunnerAPI.teardown() initialized.value = false + + if (specsWatcher) { + specsWatcher() + } + + if (specWatcher) { + specWatcher() + } }) return { @@ -28,7 +38,7 @@ export function useUnifiedRunner () { const route = useRoute() const selectorPlaygroundStore = useSelectorPlaygroundStore() - watch(() => specs.value, (newVal) => { + specsWatcher = watch(() => specs.value, (newVal) => { const fileParam = getPathForPlatform(route.query.file as string) if (!fileParam) { @@ -46,7 +56,7 @@ export function useUnifiedRunner () { } }) - return watch(() => getPathForPlatform(route.query.file as string), (queryParam) => { + specWatcher = watch(() => getPathForPlatform(route.query.file as string), (queryParam) => { const spec = specs.value.find((x) => x.relative === queryParam) if (selectorPlaygroundStore.show) { From fc98d53ed3adb79a61e52144a7f788d91b5c4f98 Mon Sep 17 00:00:00 2001 From: Tyler Biethman Date: Thu, 14 Apr 2022 11:20:37 -0500 Subject: [PATCH 02/10] Blank commit From 0bfcee97e3ec0c6ecfc263417ffb99f8434e470c Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Thu, 14 Apr 2022 13:55:01 -0500 Subject: [PATCH 03/10] Add test for scenario --- .../app/cypress/e2e/cypress-in-cypress-e2e.cy.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/app/cypress/e2e/cypress-in-cypress-e2e.cy.ts b/packages/app/cypress/e2e/cypress-in-cypress-e2e.cy.ts index 9e2758b64661..78d7f38f65d0 100644 --- a/packages/app/cypress/e2e/cypress-in-cypress-e2e.cy.ts +++ b/packages/app/cypress/e2e/cypress-in-cypress-e2e.cy.ts @@ -178,4 +178,17 @@ describe('Cypress In Cypress E2E', { viewportWidth: 1500, defaultCommandTimeout: cy.get('.passed > .num').should('contain', 4) cy.get('.failed > .num').should('not.contain', 1) }) + + it('executes a test, navigates back to the spec list, creates a new spec, and runs the new spec', () => { + cy.visitApp() + cy.contains('dom-content.spec').click() + cy.get('[data-model-state="passed"]').should('contain', 'renders the test content') + cy.contains('a', 'Specs').click() + cy.withCtx(async (ctx, o) => { + await ctx.actions.file.writeFileInProject(o.path, `describe('Simple Test', () => { it('true is true', () => { expect(true).to.be.true }) })`) + }, { path: getPathForPlatform('cypress/e2e/new-file.spec.js') }) + + cy.contains('new-file.spec').click() + cy.get('[data-model-state="passed"]').should('contain', 'expected true to be true') + }) }) From 68b41cbebd35ea39f6301a07ef145b7c15317c46 Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Thu, 14 Apr 2022 15:27:53 -0500 Subject: [PATCH 04/10] Refactor --- .../runner/SpecRunnerContainerOpenMode.vue | 12 ++- .../src/runner/SpecRunnerContainerRunMode.vue | 7 +- packages/app/src/runner/unifiedRunner.ts | 73 +++++++------------ 3 files changed, 37 insertions(+), 55 deletions(-) diff --git a/packages/app/src/runner/SpecRunnerContainerOpenMode.vue b/packages/app/src/runner/SpecRunnerContainerOpenMode.vue index 76e42a1867a3..b7716d12fe2c 100644 --- a/packages/app/src/runner/SpecRunnerContainerOpenMode.vue +++ b/packages/app/src/runner/SpecRunnerContainerOpenMode.vue @@ -22,24 +22,22 @@ const specStore = useSpecStore() const router = useRouter() const route = useRoute() -const { initialized, watchSpec } = useUnifiedRunner() - const specs = computed(() => { return props.gql.currentProject?.specs ?? [] }) -watchSpec(specs) +const queryFile = getPathForPlatform(route.query.file as string) -specStore.$subscribe((mutation, state) => { - const file = getPathForPlatform(route.query.file as string) +const { initialized } = useUnifiedRunner(specs, queryFile) - const shouldRedirect = route.name === 'SpecRunner' && file && state.activeSpec === null +specStore.$subscribe((mutation, state) => { + const shouldRedirect = route.name === 'SpecRunner' && queryFile && state.activeSpec === null if (shouldRedirect) { router.push({ name: 'Specs', params: { - unrunnable: file, + unrunnable: queryFile, }, }) } diff --git a/packages/app/src/runner/SpecRunnerContainerRunMode.vue b/packages/app/src/runner/SpecRunnerContainerRunMode.vue index 7ded77c467ea..447eed4fec62 100644 --- a/packages/app/src/runner/SpecRunnerContainerRunMode.vue +++ b/packages/app/src/runner/SpecRunnerContainerRunMode.vue @@ -15,14 +15,15 @@ import SpecRunnerRunMode from './SpecRunnerRunMode.vue' import type { SpecFile } from '@packages/types/src' import { useUnifiedRunner } from './unifiedRunner' import { ref } from 'vue' +import { getPathForPlatform } from '../paths' +import { useRoute } from 'vue-router' const props = defineProps<{ runModeSpecs: SpecFile[] }>() const specStore = useSpecStore() +const route = useRoute() -const { initialized, watchSpec } = useUnifiedRunner() - -watchSpec(ref(props.runModeSpecs)) +const { initialized } = useUnifiedRunner(ref(props.runModeSpecs), getPathForPlatform(route.query.file as string)) diff --git a/packages/app/src/runner/unifiedRunner.ts b/packages/app/src/runner/unifiedRunner.ts index 965839e60e6d..f78b92f30b59 100644 --- a/packages/app/src/runner/unifiedRunner.ts +++ b/packages/app/src/runner/unifiedRunner.ts @@ -1,17 +1,13 @@ import type { Ref } from 'vue' import { onMounted, ref, watch, onBeforeUnmount, readonly } from 'vue' -import { useRoute } from 'vue-router' import { getAutIframeModel, UnifiedRunnerAPI } from '../runner' import { useSpecStore } from '../store' import { useSelectorPlaygroundStore } from '../store/selector-playground-store' import type { SpecFile } from '@packages/types/src' -import { getPathForPlatform } from '../paths' const initialized = ref(false) -let specsWatcher -let specWatcher -export function useUnifiedRunner () { +export function useUnifiedRunner (specs: Ref>, queryFile: string) { onMounted(async () => { await UnifiedRunnerAPI.initialize() initialized.value = true @@ -20,55 +16,42 @@ export function useUnifiedRunner () { onBeforeUnmount(() => { UnifiedRunnerAPI.teardown() initialized.value = false - - if (specsWatcher) { - specsWatcher() - } - - if (specWatcher) { - specWatcher() - } }) - return { - initialized: readonly(initialized), - - watchSpec: (specs: Ref>) => { - const specStore = useSpecStore() - const route = useRoute() - const selectorPlaygroundStore = useSelectorPlaygroundStore() + const specStore = useSpecStore() + const selectorPlaygroundStore = useSelectorPlaygroundStore() - specsWatcher = watch(() => specs.value, (newVal) => { - const fileParam = getPathForPlatform(route.query.file as string) + watch(specs, () => { + if (!queryFile) { + // no file param, we are not showing a file + // so no action needed when specs list updates + return + } - if (!fileParam) { - // no file param, we are not showing a file - // so no action needed when specs list updates - return - } + const activeSpecInSpecsList = specs.value.find((x) => x.relative === queryFile) - const activeSpecInSpecsList = newVal.find((x) => x.relative === fileParam) + if (!activeSpecInSpecsList) { + // the specs list no longer contains the spec being shown + // so set active state to null and let the UI handle it + specStore.setActiveSpec(null) + } + }) - if (!activeSpecInSpecsList) { - // the specs list no longer contains the spec being shown - // so set active state to null and let the UI handle it - specStore.setActiveSpec(null) - } - }) + watch(() => queryFile, () => { + const spec = specs.value.find((x) => x.relative === queryFile) - specWatcher = watch(() => getPathForPlatform(route.query.file as string), (queryParam) => { - const spec = specs.value.find((x) => x.relative === queryParam) + if (selectorPlaygroundStore.show) { + const autIframe = getAutIframeModel() - if (selectorPlaygroundStore.show) { - const autIframe = getAutIframeModel() + autIframe.toggleSelectorPlayground(false) + selectorPlaygroundStore.setEnabled(false) + selectorPlaygroundStore.setShow(false) + } - autIframe.toggleSelectorPlayground(false) - selectorPlaygroundStore.setEnabled(false) - selectorPlaygroundStore.setShow(false) - } + specStore.setActiveSpec(spec ?? null) + }, { immediate: true, flush: 'post' }) - specStore.setActiveSpec(spec ?? null) - }, { immediate: true, flush: 'post' }) - }, + return { + initialized: readonly(initialized), } } From 02266c85b1c432db84c4d1dbf21ac49c01953705 Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Thu, 14 Apr 2022 19:11:34 -0500 Subject: [PATCH 05/10] Further refactoring. Needs to be a watchEffect rather than watch --- .../cypress/e2e/cypress-in-cypress-e2e.cy.ts | 3 +- packages/app/src/pages/Specs/Runner.vue | 5 ++++ .../runner/SpecRunnerContainerOpenMode.vue | 5 ++-- .../src/runner/SpecRunnerContainerRunMode.vue | 5 +--- packages/app/src/runner/unifiedRunner.ts | 30 ++++++++++--------- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/packages/app/cypress/e2e/cypress-in-cypress-e2e.cy.ts b/packages/app/cypress/e2e/cypress-in-cypress-e2e.cy.ts index 78d7f38f65d0..fbb1a2504d20 100644 --- a/packages/app/cypress/e2e/cypress-in-cypress-e2e.cy.ts +++ b/packages/app/cypress/e2e/cypress-in-cypress-e2e.cy.ts @@ -174,8 +174,7 @@ describe('Cypress In Cypress E2E', { viewportWidth: 1500, defaultCommandTimeout: cy.contains('switch spec') cy.contains('withWait.spec').click() - cy.wait(5000) - cy.get('.passed > .num').should('contain', 4) + cy.get('.passed > .num', { timeout: 10000 }).should('contain', 4) cy.get('.failed > .num').should('not.contain', 1) }) diff --git a/packages/app/src/pages/Specs/Runner.vue b/packages/app/src/pages/Specs/Runner.vue index 8895db57473d..f8a8b1434980 100644 --- a/packages/app/src/pages/Specs/Runner.vue +++ b/packages/app/src/pages/Specs/Runner.vue @@ -26,6 +26,7 @@ diff --git a/packages/app/src/runner/SpecRunnerContainerOpenMode.vue b/packages/app/src/runner/SpecRunnerContainerOpenMode.vue index b7716d12fe2c..b1becd1a60b0 100644 --- a/packages/app/src/runner/SpecRunnerContainerOpenMode.vue +++ b/packages/app/src/runner/SpecRunnerContainerOpenMode.vue @@ -26,11 +26,10 @@ const specs = computed(() => { return props.gql.currentProject?.specs ?? [] }) -const queryFile = getPathForPlatform(route.query.file as string) - -const { initialized } = useUnifiedRunner(specs, queryFile) +const { initialized } = useUnifiedRunner(specs) specStore.$subscribe((mutation, state) => { + const queryFile = getPathForPlatform(route.query.file as string) const shouldRedirect = route.name === 'SpecRunner' && queryFile && state.activeSpec === null if (shouldRedirect) { diff --git a/packages/app/src/runner/SpecRunnerContainerRunMode.vue b/packages/app/src/runner/SpecRunnerContainerRunMode.vue index 447eed4fec62..843aa69bd28d 100644 --- a/packages/app/src/runner/SpecRunnerContainerRunMode.vue +++ b/packages/app/src/runner/SpecRunnerContainerRunMode.vue @@ -15,15 +15,12 @@ import SpecRunnerRunMode from './SpecRunnerRunMode.vue' import type { SpecFile } from '@packages/types/src' import { useUnifiedRunner } from './unifiedRunner' import { ref } from 'vue' -import { getPathForPlatform } from '../paths' -import { useRoute } from 'vue-router' const props = defineProps<{ runModeSpecs: SpecFile[] }>() const specStore = useSpecStore() -const route = useRoute() -const { initialized } = useUnifiedRunner(ref(props.runModeSpecs), getPathForPlatform(route.query.file as string)) +const { initialized } = useUnifiedRunner(ref(props.runModeSpecs)) diff --git a/packages/app/src/runner/unifiedRunner.ts b/packages/app/src/runner/unifiedRunner.ts index f78b92f30b59..038e4782cb92 100644 --- a/packages/app/src/runner/unifiedRunner.ts +++ b/packages/app/src/runner/unifiedRunner.ts @@ -1,13 +1,14 @@ -import type { Ref } from 'vue' -import { onMounted, ref, watch, onBeforeUnmount, readonly } from 'vue' +import { Ref, onMounted, ref, watch, watchEffect, onBeforeUnmount, readonly } from 'vue' import { getAutIframeModel, UnifiedRunnerAPI } from '../runner' import { useSpecStore } from '../store' import { useSelectorPlaygroundStore } from '../store/selector-playground-store' import type { SpecFile } from '@packages/types/src' +import { useRoute } from 'vue-router' +import { getPathForPlatform } from '../paths' const initialized = ref(false) -export function useUnifiedRunner (specs: Ref>, queryFile: string) { +export function useUnifiedRunner (specs: Ref>) { onMounted(async () => { await UnifiedRunnerAPI.initialize() initialized.value = true @@ -19,9 +20,12 @@ export function useUnifiedRunner (specs: Ref>, queryFile }) const specStore = useSpecStore() + const route = useRoute() const selectorPlaygroundStore = useSelectorPlaygroundStore() - watch(specs, () => { + watchEffect(() => { + const queryFile = getPathForPlatform(route.query.file as string) + if (!queryFile) { // no file param, we are not showing a file // so no action needed when specs list updates @@ -30,15 +34,15 @@ export function useUnifiedRunner (specs: Ref>, queryFile const activeSpecInSpecsList = specs.value.find((x) => x.relative === queryFile) - if (!activeSpecInSpecsList) { - // the specs list no longer contains the spec being shown - // so set active state to null and let the UI handle it - specStore.setActiveSpec(null) - } + specStore.setActiveSpec(activeSpecInSpecsList ?? null) }) - watch(() => queryFile, () => { - const spec = specs.value.find((x) => x.relative === queryFile) + watch(() => getPathForPlatform(route.query.file as string), (newQueryFile) => { + if (!newQueryFile) { + // no file param, we are not showing a file + // so no action needed when specs list updates + return + } if (selectorPlaygroundStore.show) { const autIframe = getAutIframeModel() @@ -47,9 +51,7 @@ export function useUnifiedRunner (specs: Ref>, queryFile selectorPlaygroundStore.setEnabled(false) selectorPlaygroundStore.setShow(false) } - - specStore.setActiveSpec(spec ?? null) - }, { immediate: true, flush: 'post' }) + }, { flush: 'post' }) return { initialized: readonly(initialized), From 42a3e0b3616185f0f1c82b3ca2578e99816b045c Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Thu, 14 Apr 2022 19:47:49 -0500 Subject: [PATCH 06/10] Fix tests --- packages/app/src/pages/Specs/Runner.vue | 5 ----- packages/app/src/runner/unifiedRunner.ts | 10 +++------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/packages/app/src/pages/Specs/Runner.vue b/packages/app/src/pages/Specs/Runner.vue index f8a8b1434980..8895db57473d 100644 --- a/packages/app/src/pages/Specs/Runner.vue +++ b/packages/app/src/pages/Specs/Runner.vue @@ -26,7 +26,6 @@ diff --git a/packages/app/src/runner/unifiedRunner.ts b/packages/app/src/runner/unifiedRunner.ts index 038e4782cb92..cdd9d4828758 100644 --- a/packages/app/src/runner/unifiedRunner.ts +++ b/packages/app/src/runner/unifiedRunner.ts @@ -34,16 +34,12 @@ export function useUnifiedRunner (specs: Ref>) { const activeSpecInSpecsList = specs.value.find((x) => x.relative === queryFile) - specStore.setActiveSpec(activeSpecInSpecsList ?? null) + if (specStore.activeSpec?.relative !== activeSpecInSpecsList?.relative) { + specStore.setActiveSpec(activeSpecInSpecsList ?? null) + } }) watch(() => getPathForPlatform(route.query.file as string), (newQueryFile) => { - if (!newQueryFile) { - // no file param, we are not showing a file - // so no action needed when specs list updates - return - } - if (selectorPlaygroundStore.show) { const autIframe = getAutIframeModel() From 1f74408db96f5547847885e5f3dee8e2ad600a6e Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Thu, 14 Apr 2022 20:34:23 -0500 Subject: [PATCH 07/10] Fix tests --- packages/app/src/runner/unifiedRunner.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/app/src/runner/unifiedRunner.ts b/packages/app/src/runner/unifiedRunner.ts index cdd9d4828758..42afdcfba34f 100644 --- a/packages/app/src/runner/unifiedRunner.ts +++ b/packages/app/src/runner/unifiedRunner.ts @@ -34,8 +34,10 @@ export function useUnifiedRunner (specs: Ref>) { const activeSpecInSpecsList = specs.value.find((x) => x.relative === queryFile) - if (specStore.activeSpec?.relative !== activeSpecInSpecsList?.relative) { - specStore.setActiveSpec(activeSpecInSpecsList ?? null) + if (activeSpecInSpecsList && specStore.activeSpec?.relative !== activeSpecInSpecsList.relative) { + specStore.setActiveSpec(activeSpecInSpecsList) + } else if (!activeSpecInSpecsList) { + specStore.setActiveSpec(null) } }) From 8941c26bb6eebe958eb1c113a5b48af33be0b39d Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Thu, 14 Apr 2022 21:11:42 -0500 Subject: [PATCH 08/10] Fix flake --- packages/app/cypress/e2e/sidebar_navigation.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/cypress/e2e/sidebar_navigation.cy.ts b/packages/app/cypress/e2e/sidebar_navigation.cy.ts index 77c9cab23e21..86431d2c3582 100644 --- a/packages/app/cypress/e2e/sidebar_navigation.cy.ts +++ b/packages/app/cypress/e2e/sidebar_navigation.cy.ts @@ -25,7 +25,6 @@ describe('Sidebar Navigation', () => { context('as e2e testing type', () => { beforeEach(() => { cy.scaffoldProject('todos') - cy.scaffoldProject('pristine-with-e2e-testing') cy.openProject('todos') cy.startAppServer() cy.visitApp() @@ -51,6 +50,7 @@ describe('Sidebar Navigation', () => { it('closes the left nav bar when clicking the expand button (if expanded)', () => { cy.findByLabelText('Sidebar').closest('[aria-expanded]').should('have.attr', 'aria-expanded', 'true') + cy.contains('todos') cy.findAllByText('todos').eq(1).as('title') cy.get('@title').should('be.visible') From 98c813d91db2b69e395b6dff5962475f91f72f49 Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Mon, 18 Apr 2022 09:45:05 -0500 Subject: [PATCH 09/10] PR comments --- .../runner/SpecRunnerContainerOpenMode.vue | 4 +- .../src/runner/SpecRunnerContainerRunMode.vue | 4 +- packages/app/src/runner/unifiedRunner.ts | 67 ++++++++++--------- 3 files changed, 40 insertions(+), 35 deletions(-) diff --git a/packages/app/src/runner/SpecRunnerContainerOpenMode.vue b/packages/app/src/runner/SpecRunnerContainerOpenMode.vue index b1becd1a60b0..47d7853a6f35 100644 --- a/packages/app/src/runner/SpecRunnerContainerOpenMode.vue +++ b/packages/app/src/runner/SpecRunnerContainerOpenMode.vue @@ -26,7 +26,9 @@ const specs = computed(() => { return props.gql.currentProject?.specs ?? [] }) -const { initialized } = useUnifiedRunner(specs) +const { initialized, watchSpecs } = useUnifiedRunner() + +watchSpecs(specs) specStore.$subscribe((mutation, state) => { const queryFile = getPathForPlatform(route.query.file as string) diff --git a/packages/app/src/runner/SpecRunnerContainerRunMode.vue b/packages/app/src/runner/SpecRunnerContainerRunMode.vue index 843aa69bd28d..322ea079751e 100644 --- a/packages/app/src/runner/SpecRunnerContainerRunMode.vue +++ b/packages/app/src/runner/SpecRunnerContainerRunMode.vue @@ -22,5 +22,7 @@ const props = defineProps<{ const specStore = useSpecStore() -const { initialized } = useUnifiedRunner(ref(props.runModeSpecs)) +const { initialized, watchSpecs } = useUnifiedRunner() + +watchSpecs(ref(props.runModeSpecs)) diff --git a/packages/app/src/runner/unifiedRunner.ts b/packages/app/src/runner/unifiedRunner.ts index 42afdcfba34f..6d950a3d27b8 100644 --- a/packages/app/src/runner/unifiedRunner.ts +++ b/packages/app/src/runner/unifiedRunner.ts @@ -8,7 +8,7 @@ import { getPathForPlatform } from '../paths' const initialized = ref(false) -export function useUnifiedRunner (specs: Ref>) { +export function useUnifiedRunner () { onMounted(async () => { await UnifiedRunnerAPI.initialize() initialized.value = true @@ -19,39 +19,40 @@ export function useUnifiedRunner (specs: Ref>) { initialized.value = false }) - const specStore = useSpecStore() - const route = useRoute() - const selectorPlaygroundStore = useSelectorPlaygroundStore() - - watchEffect(() => { - const queryFile = getPathForPlatform(route.query.file as string) - - if (!queryFile) { - // no file param, we are not showing a file - // so no action needed when specs list updates - return - } - - const activeSpecInSpecsList = specs.value.find((x) => x.relative === queryFile) - - if (activeSpecInSpecsList && specStore.activeSpec?.relative !== activeSpecInSpecsList.relative) { - specStore.setActiveSpec(activeSpecInSpecsList) - } else if (!activeSpecInSpecsList) { - specStore.setActiveSpec(null) - } - }) - - watch(() => getPathForPlatform(route.query.file as string), (newQueryFile) => { - if (selectorPlaygroundStore.show) { - const autIframe = getAutIframeModel() - - autIframe.toggleSelectorPlayground(false) - selectorPlaygroundStore.setEnabled(false) - selectorPlaygroundStore.setShow(false) - } - }, { flush: 'post' }) - return { initialized: readonly(initialized), + watchSpecs: (specs: Ref>) => { + const specStore = useSpecStore() + const route = useRoute() + const selectorPlaygroundStore = useSelectorPlaygroundStore() + + watchEffect(() => { + const queryFile = getPathForPlatform(route.query.file as string) + + if (!queryFile) { + // no file param, we are not showing a file + // so no action needed when specs list updates + return + } + + const activeSpecInSpecsList = specs.value.find((x) => x.relative === queryFile) + + if (activeSpecInSpecsList && specStore.activeSpec?.relative !== activeSpecInSpecsList.relative) { + specStore.setActiveSpec(activeSpecInSpecsList) + } else if (!activeSpecInSpecsList) { + specStore.setActiveSpec(null) + } + }) + + watch(() => getPathForPlatform(route.query.file as string), () => { + if (selectorPlaygroundStore.show) { + const autIframe = getAutIframeModel() + + autIframe.toggleSelectorPlayground(false) + selectorPlaygroundStore.setEnabled(false) + selectorPlaygroundStore.setShow(false) + } + }, { flush: 'post' }) + }, } } From 19615415e785d9f4f1a17ccef911ffa454a9fc52 Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Mon, 18 Apr 2022 19:43:22 -0500 Subject: [PATCH 10/10] Fix flake with event manager and active spec --- packages/app/src/runner/useEventManager.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/app/src/runner/useEventManager.ts b/packages/app/src/runner/useEventManager.ts index 06f6be53b960..6058ff195eb3 100644 --- a/packages/app/src/runner/useEventManager.ts +++ b/packages/app/src/runner/useEventManager.ts @@ -55,7 +55,9 @@ export function useEventManager () { const startSpecWatcher = () => { return watch(() => specStore.activeSpec, () => { - runSpec() + if (specStore.activeSpec) { + runSpec() + } }, { immediate: true, flush: 'post' }) }