From 850973e7095c5d0d1af7c2ca7af015088c1ce3c6 Mon Sep 17 00:00:00 2001 From: Stokes Player Date: Thu, 25 May 2023 13:27:17 -0400 Subject: [PATCH] test: fix 2 broken tests for Windows (#26854) --- .circleci/workflows.yml | 2 +- packages/app/cypress/e2e/specs_list_e2e.cy.ts | 4 +++- packages/data-context/src/actions/ProjectActions.ts | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index ec0582d3dc10..5e0ac591593c 100644 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -72,7 +72,7 @@ windowsWorkflowFilters: &windows-workflow-filters - equal: [ develop, << pipeline.git.branch >> ] # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] - - equal: [ 'ryanm/feat/unify-cdp-approach-in-electron', << pipeline.git.branch >> ] + - equal: [ 'stokes/fix_windows_e2e_test', << pipeline.git.branch >> ] - matches: pattern: /^release\/\d+\.\d+\.\d+$/ value: << pipeline.git.branch >> diff --git a/packages/app/cypress/e2e/specs_list_e2e.cy.ts b/packages/app/cypress/e2e/specs_list_e2e.cy.ts index df59656ffd44..a8a98ed481a3 100644 --- a/packages/app/cypress/e2e/specs_list_e2e.cy.ts +++ b/packages/app/cypress/e2e/specs_list_e2e.cy.ts @@ -88,7 +88,9 @@ describe('App: Spec List (E2E)', () => { it('lists files after folders when in same directory', () => { cy.findAllByTestId('row-directory-depth-2').first().click() - cy.get('[id="speclist-cypress/e2e/admin_users/"]') + const rowId = getPathForPlatform('speclist-cypress/e2e/admin_users/').replaceAll('\\', '\\\\') + + cy.get(`[id="${rowId}"]`) .next() .should('contain', 'admin.user') .next() diff --git a/packages/data-context/src/actions/ProjectActions.ts b/packages/data-context/src/actions/ProjectActions.ts index d5d28934b2e9..254b14cad479 100644 --- a/packages/data-context/src/actions/ProjectActions.ts +++ b/packages/data-context/src/actions/ProjectActions.ts @@ -9,7 +9,7 @@ import type { ProjectShape } from '../data/coreDataShape' import type { DataContext } from '..' import { hasNonExampleSpec } from '../codegen' import templates from '../codegen/templates' -import { insertValuesInConfigFile } from '../util' +import { insertValuesInConfigFile, toPosix } from '../util' import { getError } from '@packages/errors' import { resetIssuedWarnings } from '@packages/config' import type { RunSpecErrorCode } from '@packages/graphql/src/schemaTypes' @@ -606,9 +606,12 @@ export class ProjectActions { // Now that we're in the correct testingType, verify the requested spec actually exists // We don't have specs available until a testingType is loaded, so even through we validated // a matching file exists above it may not end up loading as a valid spec so we validate that here - const spec = this.ctx.project.getCurrentSpecByAbsolute(absoluteSpecPath) + // + // Have to use toPosix here to align windows absolute paths with how the absolute path is storied in the data context + const spec = this.ctx.project.getCurrentSpecByAbsolute(toPosix(absoluteSpecPath)) if (!spec) { + debug(`Spec not found with path: ${absoluteSpecPath}`) throw new RunSpecError('SPEC_NOT_FOUND', `Unable to find matching spec with path ${absoluteSpecPath}`) }