Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ USER_MANAGER_USERNAME=manager
USER_MANAGER_PASSWORD=password
USER_IMPERSONATOR_USERNAME=impersonator
USER_IMPERSONATOR_PASSWORD=password
USER_ASSISTANT_USERNAME=assistant
USER_ASSISTANT_PASSWORD=password
LOCATION_MAIN=locationId
LOCATION_NO_MANAGE_INVENOTRY_DEPOT=locationId
LOCATION_SUPPLIER=locationId
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ jobs:
USER_MANAGER_PASSWORD: ${{ secrets.USER_MANAGER_PASSWORD }}
USER_IMPERSONATOR_USERNAME: ${{ secrets.USER_IMPERSONATOR_USERNAME }}
USER_IMPERSONATOR_PASSWORD: ${{ secrets.USER_IMPERSONATOR_PASSWORD }}
USER_ASSISTANT_USERNAME: ${{ secrets.USER_ASSISTANT_USERNAME }}
USER_ASSISTANT_PASSWORD: ${{ secrets.USER_ASSISTANT_PASSWORD }}
LOCATION_MAIN: ${{ secrets.LOCATION_MAIN }}
LOCATION_NO_MANAGE_INVENOTRY_DEPOT: ${{ secrets.LOCATION_NO_MANAGE_INVENOTRY_DEPOT }}
LOCATION_SUPPLIER: ${{ secrets.LOCATION_SUPPLIER }}
Expand Down
30 changes: 24 additions & 6 deletions src/config/AppConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export enum USER_KEY {
ALTERNATIVE = 'alternative',
MANAGER = 'manager',
IMPERSONATOR = 'impersonator',
ASSISTANT = 'assistant',
}

export enum LOCATION_KEY {
Expand Down Expand Up @@ -55,11 +56,20 @@ class AppConfig {

public static TEST_DATA_FILE_PATH = path.join(process.cwd(), '.data.json');

public static DATA_IMPORT_DIRECTORY_PATH = path.join(process.cwd(), 'src/setup/dataImport');
public static DATA_IMPORT_DIRECTORY_PATH = path.join(
process.cwd(),
'src/setup/dataImport'
);

public static PRODUCTS_IMPORT_FILE_PATH = path.join(AppConfig.DATA_IMPORT_DIRECTORY_PATH, '/products.csv');
public static PRODUCTS_IMPORT_FILE_PATH = path.join(
AppConfig.DATA_IMPORT_DIRECTORY_PATH,
'/products.csv'
);

public static INVENTORY_IMPORT_FILE_PATH = path.join(AppConfig.DATA_IMPORT_DIRECTORY_PATH, '/inventory.csv');
public static INVENTORY_IMPORT_FILE_PATH = path.join(
AppConfig.DATA_IMPORT_DIRECTORY_PATH,
'/inventory.csv'
);

// Base URL to use in actions like `await page.goto('./dashboard')`.
public appURL!: string;
Expand Down Expand Up @@ -132,7 +142,7 @@ class AppConfig {
password: env.get('USER_ALT_PASSWORD').required().asString(),
storageFileName: '.auth-storage-ALT-USER.json',
requiredRoles: new Set([
RoleType.ROLE_SUPERUSER,
RoleType.ROLE_ADMIN,
RoleType.ROLE_FINANCE,
RoleType.ROLE_PRODUCT_MANAGER,
RoleType.ROLE_INVOICE,
Expand All @@ -146,6 +156,14 @@ class AppConfig {
storageFileName: '.auth-storage-MANAGER-USER.json',
requiredRoles: new Set([RoleType.ROLE_MANAGER]),
}),

assistant: new TestUserConfig({
key: USER_KEY.ASSISTANT,
Comment thread
kkrawczyk123 marked this conversation as resolved.
username: env.get('USER_ASSISTANT_USERNAME').required().asString(),
password: env.get('USER_ASSISTANT_PASSWORD').required().asString(),
storageFileName: '.auth-storage-ASSISTANT-USER.json',
requiredRoles: new Set([RoleType.ROLE_ASSISTANT]),
}),
};

this.locations = {
Expand Down Expand Up @@ -301,8 +319,8 @@ class AppConfig {
name: productData['Name'],
quantity: parseInt(productData['Quantity']),
required: false,
})
})
});
});

this.receivingBinPrefix = env
.get('RECEIVING_BIN_PREFIX')
Expand Down
14 changes: 14 additions & 0 deletions src/fixtures/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ type Fixtures = {
mainUserService: UserData;
altUserService: UserData;
managerUserService: UserData;
assistantUserService: UserData;
// USER CONTEXT
mainUserContext: BrowserContext;
altUserContext: BrowserContext;
emptyUserContext: BrowserContext;
managerUserContext: BrowserContext;
assistantUserContext: BrowserContext;
};

export const test = baseTest.extend<Fixtures>({
Expand Down Expand Up @@ -191,6 +193,8 @@ export const test = baseTest.extend<Fixtures>({
use(new UserData(USER_KEY.ALTERNATIVE, page.request)),
managerUserService: async ({ page }, use) =>
use(new UserData(USER_KEY.MANAGER, page.request)),
assistantUserService: async ({ page }, use) =>
use(new UserData(USER_KEY.ASSISTANT, page.request)),
// NEW USER CONTEXTS
mainUserContext: async ({ browser }, use) => {
const newCtx = await browser.newContext({
Expand Down Expand Up @@ -229,6 +233,16 @@ export const test = baseTest.extend<Fixtures>({

await newCtx.close();
},

assistantUserContext: async ({ browser }, use) => {
const newCtx = await browser.newContext({
storageState: AppConfig.instance.users.assistant.storagePath,
});

await use(newCtx);

await newCtx.close();
},
});

export { expect } from '@playwright/test';
5 changes: 5 additions & 0 deletions src/pages/putaway/putawayDetails/PutawayDetailsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ class PutawayDetailsPage extends BasePageModel {
});
await this.editButton.click();
}

async clickDeleteOrderButton() {
this.page.once('dialog', (dialog) => dialog.accept());
await this.actionsDeleteButton.click();
}
}

export default PutawayDetailsPage;
Loading
Loading