Skip to content

Commit

Permalink
feat!: Replaced URIEncoding in typeAndCheckSearchField command with…
Browse files Browse the repository at this point in the history
… Vue3 compatible encoding
  • Loading branch information
jleifeld committed Dec 7, 2023
1 parent 9dd4305 commit 35e08d7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: push

jobs:
publish:
if: github.ref == 'refs/heads/7.x'
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -25,6 +25,11 @@ jobs:
with:
token: ${{ secrets.NPM_TOKEN }}
access: "public"
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
if: steps.publish.outputs.type != 'none'
id: create_release
Expand All @@ -34,6 +39,6 @@ jobs:
with:
tag_name: ${{ steps.publish.outputs.version }}
release_name: Release ${{ steps.publish.outputs.version }}
body: ${{ steps.publish.outputs.version }}
body: ${{ steps.build_changelog.outputs.changelog }}
draft: false
prerelease: false
5 changes: 5 additions & 0 deletions cypress/support/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file.

## [8.0.0] - 07.12.2023

### Breaking changes
- Replaced URIEncoding in `typeAndCheckSearchField` command with Vue3 compatible encoding

## [7.0.6] - 16.11.2023

### Changed
Expand Down
33 changes: 32 additions & 1 deletion cypress/support/commands/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,37 @@ require("cypress-file-upload");

const { v4: uuid } = require('uuid');

function vue3RouterEncodeUrl(url) {
/**
* Reference: https://github.com/vuejs/router/blob/main/packages/router/src/encoding.ts
*/

const HASH_RE = /#/g // %23
const AMPERSAND_RE = /&/g // %26
const PLUS_RE = /\+/g // %2B
const ENC_BRACKET_OPEN_RE = /%5B/g // [
const ENC_BRACKET_CLOSE_RE = /%5D/g // ]
const ENC_CARET_RE = /%5E/g // ^
const ENC_BACKTICK_RE = /%60/g // `
const ENC_CURLY_OPEN_RE = /%7B/g // {
const ENC_PIPE_RE = /%7C/g // |
const ENC_CURLY_CLOSE_RE = /%7D/g // }
const ENC_SPACE_RE = /%20/g // }

return encodeURI(url)
.replace(ENC_PIPE_RE, '|')
.replace(ENC_BRACKET_OPEN_RE, '[')
.replace(ENC_BRACKET_CLOSE_RE, ']')
.replace(PLUS_RE, '%2B')
.replace(ENC_SPACE_RE, '+')
.replace(HASH_RE, '%23')
.replace(AMPERSAND_RE, '%26')
.replace(ENC_BACKTICK_RE, '`')
.replace(ENC_CURLY_OPEN_RE, '{')
.replace(ENC_CURLY_CLOSE_RE, '}')
.replace(ENC_CARET_RE, '^');
}

/**
* Logs in to the Administration manually
* @memberOf Cypress.Chainable#
Expand Down Expand Up @@ -474,7 +505,7 @@ Cypress.Commands.add('typeAndCheckSearchField', {

cy.wait('@searchResultCall')
.its('response.statusCode').should('equal', 200);
cy.url().should('include', encodeURI(value));
cy.url().should('include', vue3RouterEncodeUrl(value));
cy.wrap(subject).type('{esc}');
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shopware-ag/e2e-testsuite-platform",
"version": "7.0.6",
"version": "8.0.0",
"description": "E2E Testsuite for Shopware 6 using Cypress.js",
"keywords": [
"e2e",
Expand Down

0 comments on commit 35e08d7

Please sign in to comment.