Skip to content

Commit

Permalink
Merge pull request #276 from PrestaShop/dev
Browse files Browse the repository at this point in the history
v3.0.2
  • Loading branch information
nicosomb authored Oct 4, 2024
2 parents 75c39bc + 3d64811 commit cda7846
Show file tree
Hide file tree
Showing 40 changed files with 22,508 additions and 13,329 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/tests/UI"
schedule:
interval: weekly
day: monday
time: "04:00"
open-pull-requests-limit: 10
target-branch: dev
reviewers:
- "PrestaShop/qa-automation"
labels:
- "dependencies"
- "E2E Tests"
- "TE"
6 changes: 3 additions & 3 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 20.x

- run: npm install
- run: npm ci

- name: Build PrestaShop assets
run: |
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4.1.7
with:
name: ${{ github.event.repository.name }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-versions: [ '14', '16' ]
node-versions: [ '14', '16', '20' ]
steps:
- name: Checkout
uses: actions/[email protected]
Expand Down
160 changes: 160 additions & 0 deletions .github/workflows/ui-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: UI Tests
on:
## Check each PR
push:
pull_request:
## Manual execution on branch
workflow_dispatch:
## Nightly
### Needs secrets
#### GC_PROJECT_ID
#### GC_SERVICE_KEY
#### NIGHTLY_TOKEN
schedule:
- cron: '0 0 * * *'

env:
CAMPAIGN: 'blockwishlist'

jobs:
ui_test:
name: UI Tests
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- PS_VERSION: '8.0.5'
PHP_VERSION: '8.1'
- PS_VERSION: '8.1.7'
PHP_VERSION: '8.1'
- PS_VERSION: 'nightly'
PHP_VERSION: '8.2'

env:
PS_VERSION: ${{ matrix.PS_VERSION }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20

- name: Build
run: npm install && npm run build

- name: Build ZIP
run: |
cd ..
zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}
cd ${{ github.event.repository.name }}
- name: Start containers
working-directory: tests/UI/
env:
PS_VERSION: ${{ matrix.PS_VERSION }}
PHP_VERSION: ${{ matrix.PHP_VERSION }}
run: |
docker compose -f "docker-compose.yml" up -d --build
bash -c 'while [[ "$(curl -L -s -o /dev/null -w %{http_code} http://localhost/en/)" != "200" ]]; do sleep 5; done'
- name: Install dependencies
working-directory: tests/UI/
run: npm ci

- name: Install Playwright Browsers
working-directory: tests/UI/
run: npx playwright install chromium --with-deps

- name: Run Playwright tests
working-directory: tests/UI/
run: npx playwright test

- name: Upload artifact report
uses: actions/upload-artifact@v4
with:
name: playwright-report-${{ matrix.PS_VERSION }}
path: tests/UI/report.json

- name: Export Docker errors
working-directory: tests/UI/
if: always()
run: docker compose logs --no-color >& docker-compose.log

- name: Upload artifact logs
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-logs-${{ matrix.PS_VERSION }}
path: |
tests/UI/reports/
tests/UI/docker-compose.log
nightly:
name: Nightly Report
if: ${{ github.event_name == 'schedule' }}
needs:
- ui_test
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- PS_VERSION: '8.0.5'
PHP_VERSION: '8.1'
- PS_VERSION: '8.1.7'
PHP_VERSION: '8.1'
- PS_VERSION: 'nightly'
PHP_VERSION: '8.2'

env:
PS_VERSION: ${{ matrix.PS_VERSION }}
PHP_VERSION: ${{ matrix.PHP_VERSION }}

permissions:
contents: 'read'
id-token: 'write'

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download report
uses: actions/[email protected]
with:
name: playwright-report-${{ matrix.PS_VERSION }}
path: tests/UI/

- name: "Nightly : Rename file"
working-directory: tests/UI/
run: |
mkdir -p nightly
REPORT_NAME="${{ env.CAMPAIGN }}_$(date +%Y-%m-%d)-${{ matrix.PS_VERSION }}"
mv report.json nightly/${REPORT_NAME}.json
- name: "Nightly : Auth GCP"
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GC_SERVICE_KEY }}
project_id: ${{ secrets.GC_PROJECT_ID }}

- name: "Nightly : Setup GCP"
uses: google-github-actions/setup-gcloud@v1

- name: "Nightly : Upload to Google Cloud Storage (GCS)"
working-directory: tests/UI/
run: gsutil cp -r "nightly/**" gs://prestashop-core-nightly/reports

- name: "Nightly : Push Report"
run: |
REPORT_NAME="${{ env.CAMPAIGN }}_$(date +%Y-%m-%d)-${{ matrix.PS_VERSION }}"
curl -v "https://api-nightly.prestashop-project.org/import/report/playwright?token=${{ secrets.NIGHTLY_TOKEN }}&filename=${REPORT_NAME}.json&campaign=${{ env.CAMPAIGN }}&platform=chromium"
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ node_modules

# mac
.DS_Store

## UI Tests
/tests/UI/.env
/tests/UI/node_modules/
/tests/UI/report.json
/tests/UI/reports/
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ db: docker-build
docker-build: build-back build-front

build-back:
docker-compose run --rm php sh -c "composer install"
docker compose run --rm php sh -c "composer install"

build-back-prod:
docker-compose run --rm php sh -c "composer install --no-dev -o"
docker compose run --rm php sh -c "composer install --no-dev -o"

build-front:
docker-compose run --rm node sh -c "npm install"
docker-compose run --rm node sh -c "npm run build"
docker compose run --rm node sh -c "npm install"
docker compose run --rm node sh -c "npm run build"
10 changes: 5 additions & 5 deletions _dev/front/js/components/Button/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
EventBus.$emit('showAddToWishList', {
detail: {
productId: this.productId,
productAttributeId: parseInt(this.productAttributeId, 10),
productAttributeId: parseInt(this.idProductAttribute, 10),
forceOpen: true,
quantity: quantity ? parseInt(quantity.value, 10) : 0,
},
Expand All @@ -113,7 +113,7 @@
variables: {
productId: this.productId,
url: this.url,
productAttributeId: this.productAttributeId,
productAttributeId: this.idProductAttribute,
listId: this.idList ? this.idList : this.listId,
},
});
Expand All @@ -140,7 +140,7 @@
EventBus.$on('addedToWishlist', (event) => {
if (
event.detail.productId === this.productId
&& parseInt(event.detail.productAttributeId, 10) === this.productAttributeId
&& parseInt(event.detail.productAttributeId, 10) === this.idProductAttribute
) {
this.isChecked = true;
this.idList = event.detail.listId;
Expand All @@ -150,7 +150,7 @@
// eslint-disable-next-line
const items = productsAlreadyTagged.filter(
(e) => parseInt(e.id_product, 10) === this.productId
&& parseInt(e.id_product_attribute, 10) === this.productAttributeId,
&& parseInt(e.id_product_attribute, 10) === this.idProductAttribute,
);

if (items.length > 0) {
Expand All @@ -176,7 +176,7 @@
const itemsFiltered = productsAlreadyTagged.filter(
(e) => parseInt(e.id_product, 10) === this.productId
&& e.quantity.toString() === quantity.value
&& parseInt(e.id_product_attribute, 10) === this.productAttributeId,
&& parseInt(e.id_product_attribute, 10) === this.idProductAttribute,
);

if (itemsFiltered.length > 0) {
Expand Down
18 changes: 0 additions & 18 deletions _dev/front/js/components/Create/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,3 @@
},
};
</script>

<style lang="scss" type="text/scss">
.wishlist {
&-create {
.wishlist-modal {
opacity: 0;
pointer-events: none;
z-index: 0;

&.show {
opacity: 1;
pointer-events: all;
z-index: 1053;
}
}
}
}
</style>
19 changes: 0 additions & 19 deletions _dev/front/js/components/Delete/Delete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,22 +156,3 @@
},
};
</script>

<style lang="scss" type="text/scss">
.wishlist {
&-delete {
.wishlist-modal {
display: block;
opacity: 0;
pointer-events: none;
z-index: 0;

&.show {
opacity: 1;
pointer-events: all;
z-index: 1053;
}
}
}
}
</style>
14 changes: 0 additions & 14 deletions _dev/front/js/components/Login/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,3 @@
},
};
</script>

<style lang="scss" type="text/scss">
.wishlist {
&-login {
.wishlist-modal {
z-index: 0;

&.show {
z-index: 1053;
}
}
}
}
</style>
Loading

0 comments on commit cda7846

Please sign in to comment.