Skip to content

Commit

Permalink
fix: force forward slash to backslash on Windows in spec search input (
Browse files Browse the repository at this point in the history
  • Loading branch information
astone123 committed Sep 12, 2022
1 parent 043ab9a commit 7c6c231
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/app/cypress/e2e/specs_list_e2e.cy.ts
Expand Up @@ -237,6 +237,14 @@ describe('App: Spec List (E2E)', () => {
cy.get('button').contains('23 Matches')
})

it('normalizes directory path separators for Windows', function () {
// On Windows, when a user types `e2e/accounts`, it should match `e2e\accounts`
clearSearchAndType('e2e/accounts')
cy.findAllByTestId('spec-item').should('have.length', 2)

cy.findByText('No specs matched your search:').should('not.be.visible')
})

// TODO: fix flaky test https://github.com/cypress-io/cypress/issues/23305
it.skip('saves the filter when navigating to a spec and back', function () {
const targetSpecFile = 'accounts_list.spec.js'
Expand Down
4 changes: 3 additions & 1 deletion packages/app/src/specs/spec-utils.ts
Expand Up @@ -125,8 +125,10 @@ function getHighlightIndexes <T extends FoundSpec> (node: SpecTreeNode<T>) {
}

export function fuzzySortSpecs <T extends FuzzyFoundSpec> (specs: T[], searchValue: string) {
const normalizedSearchValue = getPlatform() === 'win32' ? searchValue.replaceAll('/', '\\') : searchValue

const fuzzySortResult = fuzzySort
.go(searchValue, specs, { keys: ['relative', 'baseName'], allowTypo: false, threshold: -3000 })
.go(normalizedSearchValue, specs, { keys: ['relative', 'baseName'], allowTypo: false, threshold: -3000 })
.map((result) => {
const [relative, baseName] = result

Expand Down

5 comments on commit 7c6c231

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7c6c231 Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.8.0/linux-x64/develop-7c6c23132207401396021bb990cd50bde2a2f655/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7c6c231 Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.8.0/linux-arm64/develop-7c6c23132207401396021bb990cd50bde2a2f655/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7c6c231 Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.8.0/win32-x64/develop-7c6c23132207401396021bb990cd50bde2a2f655/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7c6c231 Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.8.0/darwin-x64/develop-7c6c23132207401396021bb990cd50bde2a2f655/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7c6c231 Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.8.0/darwin-arm64/develop-7c6c23132207401396021bb990cd50bde2a2f655/cypress.tgz

Please sign in to comment.