Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added new tests #18

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9528bfd
add: added a helper function
shashwatahalder01 Apr 17, 2024
1611f49
Merge branch 'develop' into litetests
shashwatahalder01 Apr 17, 2024
54252fa
update: added new api setup tests
shashwatahalder01 Apr 18, 2024
a0a6b22
Marked a test as failed
shashwatahalder01 Apr 19, 2024
24646c9
marked an e2e test as failed
shashwatahalder01 Apr 19, 2024
0493395
marked test as fail
shashwatahalder01 Apr 19, 2024
1888bce
marked test as fail
shashwatahalder01 Apr 19, 2024
796b082
update: update workflow
shashwatahalder01 Apr 19, 2024
30869f8
marked a test as only
shashwatahalder01 Apr 19, 2024
9b5085f
update: undo some previous changes
shashwatahalder01 Apr 19, 2024
266449c
update: refactor some tests
shashwatahalder01 Apr 19, 2024
a8255d0
update: packages and locators
shashwatahalder01 Apr 20, 2024
96b9157
update: package
shashwatahalder01 Apr 21, 2024
c5eb674
update: update tags
shashwatahalder01 Apr 21, 2024
86ed12f
fix: fix lint and refactor some code
shashwatahalder01 Apr 21, 2024
07e0806
update some tags
shashwatahalder01 Apr 21, 2024
048855a
update: update guest tags
shashwatahalder01 Apr 21, 2024
f7a8307
update: update hover time
shashwatahalder01 Apr 22, 2024
7a8cd24
update: locator
shashwatahalder01 Apr 23, 2024
57163c2
removed: github reporter
shashwatahalder01 Apr 23, 2024
ad7654f
Merge branch 'develop' into litetests
shashwatahalder01 Apr 23, 2024
4915db5
update: exp tag
shashwatahalder01 Apr 23, 2024
832e2d6
fix some typos
shashwatahalder01 Apr 23, 2024
7747933
fix some typos in the codebase
shashwatahalder01 Apr 23, 2024
ccca198
refactored some tests
shashwatahalder01 Apr 23, 2024
e694b18
refactor test suite (#2253)
shashwatahalder01 Apr 23, 2024
901577d
Update readme.txt (#2254)
Raad-Sheraz Apr 23, 2024
7e8d1aa
Merge branch 'develop' into litetests
shashwatahalder01 Apr 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/e2e_api_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Composer install and build (Dokan-lite)
if: success()
run: |
composer install --no-dev -o
composer i --no-dev -o || composer update --no-dev -o

- name: Npm install and build (Dokan-lite)
if: success()
Expand Down Expand Up @@ -185,7 +185,7 @@ jobs:
# Run API tests
- name: 🧪 Running the api tests
id: api-test
if: steps.db-port.outcome == 'success' && ( github.event_name != 'workflow_dispatch' || ( github.event_name == 'workflow_dispatch' && (github.event.inputs.testsuite == 'API' || github.event.inputs.testsuite == 'All')))
if: always() && steps.db-port.outcome == 'success' && ( github.event_name != 'workflow_dispatch' || ( github.event_name == 'workflow_dispatch' && (github.event.inputs.testsuite == 'API' || github.event.inputs.testsuite == 'All')))
timeout-minutes: 5
run: |
cd tests/pw
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:

# Backup Database
- name: Backup Database
if: steps.db-port.outcome == 'success'
if: always() && steps.db-port.outcome == 'success'
run: |
cd tests/pw
npm run wp-env run tests-cli wp db export wp-data/db.sql
Expand Down
121 changes: 65 additions & 56 deletions readme.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/pw/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Create .env file according to .env.example file
ADMIN=John_Doe [Admin username]
ADMIN_PASSWORD=AdminPass123 [Password for the admin account]
VENDOR=David_Johnson [Vendor username]
VENDOR2=jhonathon_Smith [Vendor username]
VENDOR2=Johnathon_Smith [Vendor username]
CUSTOMER=Michael_Williams [Customer username]
USER_PASSWORD=Passw0rd123 [Password for all other users]
GMAP=ABCD1234EFGH5678 [Google Maps API key]
Expand Down
2 changes: 1 addition & 1 deletion tests/pw/api.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default defineConfig({
preserveOutput: 'always',
/* Run tests in files in parallel */
// fullyParallel : true,
/* Fail the build on CI if you accidentally left testonly in the source code. */
/* Fail the build on CI if you accidentally left test.only in the source code. */
// forbidOnly : !!CI,
/* The number of times to repeat each test, useful for debugging flaky tests. */
repeatEach: CI ? 1 : 0,
Expand Down
2 changes: 1 addition & 1 deletion tests/pw/e2e.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default defineConfig({
/* Configure reporters */
reporter: CI
? [
['github'],
// ['github'],
['html', { open: 'never', outputFolder: 'playwright-report/e2e/html/html-report-e2e' }],
// ['junit', { outputFile: 'playwright-report/e2e/junit-report/e2e-results.xml' }],
['list', { printSteps: true }],
Expand Down
404 changes: 202 additions & 202 deletions tests/pw/package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions tests/pw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"eslint": "^8.57.0",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"eslint": "8.56",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-playwright": "^1.5.4",
"eslint-plugin-playwright": "^1.6.0",
"npm-check-updates": "^16.14.18",
"prettier": "^3.2.5",
"typescript": "^5.4.3"
"typescript": "^5.4.5"
},
"dependencies": {
"@faker-js/faker": "^8.4.1",
"@playwright/test": "1.42",
"@wordpress/env": "^9.6.0",
"@playwright/test": "1.43",
"@wordpress/env": "^9.8.0",
"dotenv": "^16.4.5",
"mysqlconnector": "^2.0.6",
"php-serialize": "^4.1.1",
"zod": "^3.22.4"
"zod": "^3.22.5"
}
}
2 changes: 1 addition & 1 deletion tests/pw/pages/basePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ export class BasePage {
await expect(this.page.locator(selector)).toHaveValue(value);
}

// assert element to have attribute along with attirbute value
// assert element to have attribute along with attribute value
async toHaveAttribute(selector: string, attribute: string, value: string) {
await expect(this.page.locator(selector)).toHaveAttribute(attribute, value);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/pw/pages/customerPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,12 @@ export class CustomerPage extends BasePage {
const couponIsApplied = await this.isVisible(selector.customer.cCart.removeCoupon(couponCode));
if (couponIsApplied) {
await this.clickAndWaitForResponse(data.subUrls.api.wc.store, selector.customer.cCart.removeCoupon(couponCode), 207);
await this.toContainText(selector.customer.cWooSelector.wooCommerceNoriceBannerContent, `Coupon code "${couponCode}" has been removed from your cart.`);
await this.toContainText(selector.customer.cWooSelector.wooCommerceNoticeBannerContent, `Coupon code "${couponCode}" has been removed from your cart.`);
}
await this.click(selector.customer.cCart.addCoupon);
await this.clearAndType(selector.customer.cCart.couponCode, couponCode);
await this.clickAndWaitForResponse(data.subUrls.api.wc.store, selector.customer.cCart.applyCoupon, 207);
await this.toContainText(selector.customer.cWooSelector.wooCommerceNoriceBannerContent, `Coupon code "${couponCode}" has been applied to your cart.`);
await this.toContainText(selector.customer.cWooSelector.wooCommerceNoticeBannerContent, `Coupon code "${couponCode}" has been applied to your cart.`);
}

// add billing address in checkout
Expand Down
2 changes: 1 addition & 1 deletion tests/pw/pages/licensePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class LicensePage extends AdminPage {
}

// refresh license
async refresehLicense() {
async refreshLicense() {
await this.goIfNotThere(data.subUrls.backend.dokan.license);
await this.clickAndWaitForResponse(data.subUrls.backend.dokan.license, licenseAdmin.refreshLicense);
await this.toContainText(licenseAdmin.successNotice, 'License refreshed successfully.');
Expand Down
4 changes: 3 additions & 1 deletion tests/pw/pages/loginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ export class LoginPage extends BasePage {
async logoutBackend(): Promise<void> {
await this.goIfNotThere(data.subUrls.backend.adminLogin);
await this.hover(selector.backend.userMenu);
await this.clickAndWaitForResponseAndLoadState(data.subUrls.backend.adminLogout, selector.backend.logout, 302);
await this.page.hover(selector.backend.logout);
await this.clickAndWaitForResponseAndLoadState(data.subUrls.backend.adminLogout, selector.backend.logout);
await this.toContainText(selector.backend.logoutSuccessMessage, 'You are now logged out.');
const loggedInUser = await this.getCurrentUser();
expect(loggedInUser).toBeUndefined();
}
Expand Down
18 changes: 9 additions & 9 deletions tests/pw/pages/menuManagerPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class MenuManagerPage extends BasePage {
super(page);
}

// seave settings
// save settings
async saveSettings() {
await this.toContainText(settingsAdmin.dokanUpdateSuccessMessage, 'Setting has been saved successfully.');
}
Expand All @@ -23,9 +23,9 @@ export class MenuManagerPage extends BasePage {

switch (action) {
case 'activate':
await this.enableSwitcher(settingsAdmin.menuManager.menuSwithcher(menu));
await this.enableSwitcher(settingsAdmin.menuManager.menuSwitcher(menu));
await this.clickAndWaitForResponseAndLoadState(data.subUrls.ajax, settingsAdmin.menuManager.menuManagerSaveChanges);
await this.toHaveBackgroundColor(settingsAdmin.menuManager.menuSwithcher(menu) + '//span', 'rgb(0, 144, 255)');
await this.toHaveBackgroundColor(settingsAdmin.menuManager.menuSwitcher(menu) + '//span', 'rgb(0, 144, 255)');
//assertion
await this.goto(data.subUrls.frontend.vDashboard.dashboard);
await this.toBeVisible((selector.vendor.vDashboard.menus as any)[menuLink]);
Expand All @@ -34,9 +34,9 @@ export class MenuManagerPage extends BasePage {
break;

case 'deactivate':
await this.disableSwitcher(settingsAdmin.menuManager.menuSwithcher(menu));
await this.disableSwitcher(settingsAdmin.menuManager.menuSwitcher(menu));
await this.clickAndWaitForResponseAndLoadState(data.subUrls.ajax, settingsAdmin.menuManager.menuManagerSaveChanges);
await this.toHaveBackgroundColor(settingsAdmin.menuManager.menuSwithcher(menu) + '//span', 'rgb(215, 218, 221)');
await this.toHaveBackgroundColor(settingsAdmin.menuManager.menuSwitcher(menu) + '//span', 'rgb(215, 218, 221)');
//assertion
await this.goto(data.subUrls.frontend.vDashboard.dashboard);
await this.notToBeVisible((selector.vendor.vDashboard.menus as any)[menuLink]);
Expand Down Expand Up @@ -82,18 +82,18 @@ export class MenuManagerPage extends BasePage {
async cantRenameMenu(menu: string) {
await this.goIfNotThere(data.subUrls.backend.dokan.settings);
await this.click(settingsAdmin.menus.menuManager);
await this.disableSwitcher(settingsAdmin.menuManager.menuSwithcher(menu));
await this.disableSwitcher(settingsAdmin.menuManager.menuSwitcher(menu));
await this.notToBeVisible(settingsAdmin.menuManager.menuEdit(menu));
}

// dashboard cant be alterd
// dashboard cant be altered
async cantAlterMenu(menu: string, isSubmenu?: boolean) {
await this.goIfNotThere(data.subUrls.backend.dokan.settings);
await this.click(settingsAdmin.menus.menuManager);
isSubmenu && (await this.click(settingsAdmin.menuManager.settingsSubMenu));

await this.hasClass(settingsAdmin.menuManager.menuGrabber(menu), 'not-sortable');
await this.notToBeVisible(settingsAdmin.menuManager.menuSwithcher(menu));
await this.notToBeVisible(settingsAdmin.menuManager.menuSwitcher(menu));
}

// reorderMenu
Expand Down Expand Up @@ -130,6 +130,6 @@ export class MenuManagerPage extends BasePage {
await this.click(settingsAdmin.menuManager.confirmReset);
await this.clickAndWaitForResponseAndLoadState(data.subUrls.ajax, settingsAdmin.menuManager.menuManagerSaveChanges);

await this.toHaveBackgroundColor(settingsAdmin.menuManager.menuSwithcher(menu) + '//span', 'rgb(0, 144, 255)');
await this.toHaveBackgroundColor(settingsAdmin.menuManager.menuSwitcher(menu) + '//span', 'rgb(0, 144, 255)');
}
}
4 changes: 2 additions & 2 deletions tests/pw/pages/productAddonsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class ProductAddonsPage extends VendorPage {
await this.multipleElementVisible(addonsVendor.table);

await this.clickAndWaitForLoadState(addonsVendor.createNewAddon);
await this.click(addonsVendor.addon.addField);
await this.clickAndWaitForResponse(data.subUrls.ajax, addonsVendor.addon.addField);
await this.check(addonsVendor.addon.enableDescription);

// product addon fields elements are visible
Expand All @@ -53,7 +53,7 @@ export class ProductAddonsPage extends VendorPage {
await this.toContainText(addonsVendor.addon.result, addon.category);
await this.press(data.key.enter);

add ? await this.click(addonsVendor.addon.addField) : await this.click(addonsVendor.addon.addonFieldsRow('Add-on Title'));
add ? await this.clickAndWaitForResponse(data.subUrls.ajax, addonsVendor.addon.addField) : await this.click(addonsVendor.addon.addonFieldsRow('Add-on Title'));

await this.selectByValue(addonsVendor.addon.type, addon.type);
await this.selectByValue(addonsVendor.addon.displayAs, addon.displayAs);
Expand Down
5 changes: 1 addition & 4 deletions tests/pw/pages/productQAPage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Page, expect } from '@playwright/test';
import { AdminPage } from '@pages/adminPage';
// import { VendorPage } from '@pages/vendorPage';
import { selector } from '@pages/selectors';
import { data } from '@utils/testData';
import { helpers } from '@utils/helpers';
Expand Down Expand Up @@ -38,7 +36,7 @@ export class ProductQAPage extends BasePage {
await this.multipleElementVisible(bulkActions);

// filter elements are visible
const { filterInput, result, resetFilterByVensors, ...filters } = productQAAdmin.filters;
const { filterInput, result, resetFilterByVendors, ...filters } = productQAAdmin.filters;
await this.multipleElementVisible(filters);

// product question & answers table elements are visible
Expand Down Expand Up @@ -150,7 +148,6 @@ export class ProductQAPage extends BasePage {
await this.click(productQAAdmin.questionDetails.answer.deleteAnswer);
await this.clickAndWaitForResponse(data.subUrls.api.dokan.productAnswers, productQAAdmin.questionDetails.confirmAction, 204);
await this.toBeVisible(productQAAdmin.questionDetails.answerDeleteSuccessMessage);

}

// delete question
Expand Down
10 changes: 5 additions & 5 deletions tests/pw/pages/productsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export class ProductsPage extends AdminPage {
}
}

// vendor add downloadble product
// vendor add downloadable product
async vendorAddDownloadableProduct(product: product['downloadable'], productPopup = false): Promise<void> {
const productName = product.productName();
const productPrice = product.regularPrice();
Expand All @@ -350,7 +350,7 @@ export class ProductsPage extends AdminPage {
await this.toHaveValue(productsVendor.downloadableOptions.downloadExpiry, product.downloadableOptions.downloadExpiry);
}

// vendor add vitual product
// vendor add virtual product
async vendorAddVirtualProduct(product: product['simple'], productPopup = false): Promise<void> {
const productName = product.productName();
const productPrice = product.regularPrice();
Expand Down Expand Up @@ -408,7 +408,7 @@ export class ProductsPage extends AdminPage {
await this.clickAndWaitForResponseAndLoadState(data.subUrls.frontend.vDashboard.products, productsVendor.saveProduct, 302);
await this.toContainText(productsVendor.updatedSuccessMessage, product.saveSuccessMessage);
await this.toHaveValue(productsVendor.edit.title, productName);
//todo: add more assettions
//todo: add more assertions
}

// vendor add variable subscription product
Expand All @@ -434,7 +434,7 @@ export class ProductsPage extends AdminPage {
await this.clickAndWaitForResponseAndLoadState(data.subUrls.frontend.vDashboard.products, productsVendor.saveProduct, 302);
await this.toContainText(productsVendor.updatedSuccessMessage, product.saveSuccessMessage);
await this.toHaveValue(productsVendor.edit.title, productName);
//todo: add more assettions
//todo: add more assertions
}

// vendor add external product
Expand All @@ -449,7 +449,7 @@ export class ProductsPage extends AdminPage {
await this.clickAndWaitForResponseAndLoadState(data.subUrls.frontend.vDashboard.products, productsVendor.saveProduct, 302);
await this.toContainText(productsVendor.updatedSuccessMessage, product.saveSuccessMessage);
await this.toHaveValue(productsVendor.edit.title, productName);
//todo: add more assettions
//todo: add more assertions
}

// go to product edit
Expand Down
Loading
Loading