-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,321 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: UI Tests | ||
on: [push, pull_request] | ||
jobs: | ||
ui_test: | ||
name: UI Tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
ps-version: | ||
- '8.0.5' | ||
- '8.1.3' | ||
- 'nightly' | ||
env: | ||
PS_VERSION: ${{ matrix.ps-version }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 14 | ||
|
||
- name: Build | ||
run: npm install && npm run build | ||
|
||
- name: Start containers | ||
run: docker-compose -f "docker-compose.yml" up -d --build | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
working-directory: tests/UI/ | ||
|
||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
working-directory: tests/UI/ | ||
|
||
- name: Run Playwright tests | ||
run: npx playwright test | ||
working-directory: tests/UI/ | ||
|
||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,7 @@ node_modules | |
|
||
# mac | ||
.DS_Store | ||
|
||
## UI Tests | ||
/tests/UI/node_modules/ | ||
/tests/UI/reports/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
164 changes: 164 additions & 0 deletions
164
tests/UI/campaigns/02_configuration/02_statisticsTabSettings.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
|
||
// Import utils | ||
//import testContext from '@prestashop-core/ui-testing/dist/utils/testContext'; | ||
|
||
// Import commonTests | ||
import loginCommon from '@prestashop-core/ui-testing/dist/common/BO/loginBO'; | ||
|
||
// Import pages | ||
// Import BO pages | ||
import dashboardPage from '@prestashop-core/ui-testing/dist/pages/BO/dashboard'; | ||
/* | ||
import {moduleManager as moduleManagerPage} from '@pages/BO/modules/moduleManager'; | ||
import blockwishlistPage from '@pages/BO/modules/blockwishlist'; | ||
import blockwishlistStatisticsPage from '@pages/BO/modules/blockwishlist/statistics'; | ||
// Import FO pages | ||
import categoryPage from '@pages/FO/category'; | ||
import {homePage} from '@pages/FO/home'; | ||
import {loginPage as foLoginPage} from '@pages/FO/login'; | ||
// Import data | ||
import Customers from '@data/demo/customers'; | ||
import Modules from '@data/demo/modules';*/ | ||
|
||
import { test, expect } from '@playwright/test'; | ||
|
||
const baseContext: string = 'modules_blockwishlist_configuration_statisticsTabSettings'; | ||
|
||
test.describe('Wishlist module - Statistics tab settings', () => { | ||
test('Check the Back Office: should login in BO', async ({ page }) => { | ||
await loginCommon.loginBO(test.info(), page); | ||
}); | ||
|
||
test('should go to \'Modules > Module Manager\' page', async ({ page }) => { | ||
//await testContext.addContextItem(test.info(), 'testIdentifier', 'goToModuleManagerPage', baseContext); | ||
|
||
await dashboardPage.goToSubMenu( | ||
page, | ||
dashboardPage.modulesParentLink, | ||
dashboardPage.moduleManagerLink, | ||
); | ||
/* | ||
await moduleManagerPage.closeSfToolBar(page); | ||
const pageTitle = await moduleManagerPage.getPageTitle(page); | ||
expect(pageTitle).to.contains(moduleManagerPage.pageTitle);*/ | ||
}); | ||
/* | ||
test(`should search the module ${Modules.blockwishlist.name}`, async ({ page }) => { | ||
await testContext.addContextItem(this, 'testIdentifier', 'searchModule', baseContext); | ||
const isModuleVisible = await moduleManagerPage.searchModule(page, Modules.blockwishlist); | ||
expect(isModuleVisible).to.eq(true); | ||
}); | ||
test(`should go to the configuration page of the module '${Modules.blockwishlist.name}'`, async ({ page }) => { | ||
await testContext.addContextItem(this, 'testIdentifier', 'goToConfigurationPage', baseContext); | ||
await moduleManagerPage.goToConfigurationPage(page, Modules.blockwishlist.tag); | ||
const pageTitle = await blockwishlistPage.getPageTitle(page); | ||
expect(pageTitle).to.eq(blockwishlistPage.pageTitle); | ||
const isConfigurationTabActive = await blockwishlistPage.isTabActive(page, 'Configuration'); | ||
expect(isConfigurationTabActive).to.eq(true); | ||
const isStatisticsTabActive = await blockwishlistPage.isTabActive(page, 'Statistics'); | ||
expect(isStatisticsTabActive).to.eq(false); | ||
}); | ||
test('should go on Statistics Tab', async ({ page }) => { | ||
await testContext.addContextItem(this, 'testIdentifier', 'goToStatisticsTab', baseContext); | ||
await blockwishlistPage.goToStatisticsTab(page); | ||
const pageTitle = await blockwishlistStatisticsPage.getPageTitle(page); | ||
expect(pageTitle).to.eq(blockwishlistStatisticsPage.pageTitle); | ||
const noRecordsFoundText = await blockwishlistStatisticsPage.getTextForEmptyTable(page); | ||
expect(noRecordsFoundText).to.contains('warning No records found'); | ||
}); | ||
}); | ||
describe('Go to the FO and add to favorites some products', async () => { | ||
test('should go to the FO', async ({ page }) => { | ||
await testContext.addContextItem(this, 'testIdentifier', 'goToFO', baseContext); | ||
page = await blockwishlistStatisticsPage.viewMyShop(page); | ||
await homePage.changeLanguage(page, 'en'); | ||
const isHomePage = await homePage.isHomePage(page); | ||
expect(isHomePage).to.eq(true); | ||
}); | ||
test('should go to login page', async ({ page }) => { | ||
await testContext.addContextItem(this, 'testIdentifier', 'goToLoginPage', baseContext); | ||
await homePage.goToLoginPage(page); | ||
const pageTitle = await foLoginPage.getPageTitle(page); | ||
expect(pageTitle, 'Fail to open FO login page').to.contains(foLoginPage.pageTitle); | ||
}); | ||
test('should sign in with default customer', async ({ page }) => { | ||
await testContext.addContextItem(this, 'testIdentifier', 'sighInFo', baseContext); | ||
await foLoginPage.customerLogin(page, Customers.johnDoe); | ||
const isCustomerConnected = await foLoginPage.isCustomerConnected(page); | ||
expect(isCustomerConnected, 'Customer is not connected').to.eq(true); | ||
}); | ||
test('should go to all products page', async ({ page }) => { | ||
await testContext.addContextItem(this, 'testIdentifier', 'goToAllProducts', baseContext); | ||
await homePage.goToAllProductsPage(page); | ||
const isCategoryPageVisible = await categoryPage.isCategoryPage(page); | ||
expect(isCategoryPageVisible).to.eq(true); | ||
}); | ||
for (let idxProduct: number = 1; idxProduct <= 3; idxProduct++) { | ||
// eslint-disable-next-line no-loop-func | ||
test(`should add product #${idxProduct} to wishlist`, async ({ page }) => { | ||
await testContext.addContextItem(this, 'testIdentifier', `addToFavorite${idxProduct}`, baseContext); | ||
const textResult = await categoryPage.addToWishList(page, idxProduct); | ||
expect(textResult).to.be.eq(categoryPage.messageAddedToWishlist); | ||
const isAddedToWishlist = await categoryPage.isAddedToWishlist(page, idxProduct); | ||
expect(isAddedToWishlist).to.eq(true); | ||
}); | ||
} | ||
test('should logout', async ({ page }) => { | ||
await testContext.addContextItem(this, 'testIdentifier', 'foLogout', baseContext); | ||
await categoryPage.logout(page); | ||
const isCustomerConnected = await homePage.isCustomerConnected(page); | ||
expect(isCustomerConnected).to.eq(false); | ||
}); | ||
}); | ||
describe('Return to BO and check statistics', async () => { | ||
test('should go to BO', async ({ page }) => { | ||
await testContext.addContextItem(this, 'testIdentifier', 'goToBoBack', baseContext); | ||
page = await homePage.closePage(browserContext, page, 0); | ||
const pageTitle = await blockwishlistStatisticsPage.getPageTitle(page); | ||
expect(pageTitle).to.contains(blockwishlistStatisticsPage.pageTitle); | ||
}); | ||
// @todo : https://github.com/PrestaShop/PrestaShop/issues/33374 | ||
test('should click on the refresh button', async ({ page }) => { | ||
await testContext.addContextItem(this, 'testIdentifier', 'clickOnRefreshButton', baseContext); | ||
test.skip(); | ||
await blockwishlistStatisticsPage.refreshStatistics(page); | ||
// Check statistics | ||
const pageTitle = await blockwishlistStatisticsPage.getPageTitle(page); | ||
expect(pageTitle).to.contains(blockwishlistStatisticsPage.pageTitle); | ||
}); | ||
});*/ | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('has title', async ({ page }) => { | ||
await page.goto('https://playwright.dev/'); | ||
|
||
// Expect a title "to contain" a substring. | ||
await expect(page).toHaveTitle(/Playwright/); | ||
}); | ||
|
||
test('get started link', async ({ page }) => { | ||
await page.goto('https://playwright.dev/'); | ||
|
||
// Click the get started link. | ||
await page.getByRole('link', { name: 'Get started' }).click(); | ||
|
||
// Expects page to have a heading with the name of Installation. | ||
await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
services: | ||
prestashop: | ||
image: prestashop/prestashop-flashlight:${PS_VERSION} | ||
container_name: prestashop | ||
depends_on: | ||
mysql: | ||
condition: service_healthy | ||
environment: | ||
- DEBUG_MODE=true | ||
volumes: | ||
- type: bind | ||
# Local Path | ||
source: ../../ | ||
# Mount Path | ||
target: /var/www/html/modules/blockwishlist | ||
ports: | ||
- 8000:80 | ||
|
||
mysql: | ||
image: mariadb:lts | ||
container_name: prestashop-mysql | ||
healthcheck: | ||
test: | ||
[ | ||
'CMD', | ||
'mysqladmin', | ||
'ping', | ||
'--host=localhost', | ||
'--user=prestashop', | ||
'--password=prestashop', | ||
] | ||
interval: 5s | ||
timeout: 10s | ||
retries: 5 | ||
environment: | ||
- MYSQL_HOST=mysql | ||
- MYSQL_USER=prestashop | ||
- MYSQL_PASSWORD=prestashop | ||
- MYSQL_ROOT_PASSWORD=prestashop | ||
- MYSQL_PORT=3306 | ||
- MYSQL_DATABASE=prestashop |
Oops, something went wrong.