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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class BackendConfigurationPropertiesPage extends PageWithNavbarPage {
this.backendConfigurationPnPropertiesButton().then(($ele) => {
if (!$ele.is(':visible')) {
this.backendConfigurationPnButton().click();

}
});
this.backendConfigurationPnPropertiesButton().click();
Expand Down Expand Up @@ -227,6 +228,10 @@ class BackendConfigurationPropertiesPage extends PageWithNavbarPage {
cy.get('app-properties-table .mat-mdc-row').then(rows => {
const rowNum = rows.length;
cy.log(rowNum.toString());
if (rowNum === 0) {
cy.log('No properties to delete.');
return;
}

for (let i = rowNum; i > 0; i--) {
cy.intercept('POST', '**/api/backend-configuration-pn/properties/index').as('getProperties');
Expand Down Expand Up @@ -269,28 +274,79 @@ export class PropertyRowObject {
editPropertyBtn: () => Cypress.Chainable<JQuery<HTMLElement>>;
deleteBtn: () => Cypress.Chainable<JQuery<HTMLElement>>;


getRow(rowNum: number) {
const row = () => cy.get('.mat-mdc-row').eq(rowNum - 1);
const row = () => cy.get('.mat-mdc-row').should('exist').eq(rowNum - 1);
this.row = row();
this.viewAreasBtn = () => row().find('[id^=showPropertyAreasBtn]').should('be.visible').should('be.enabled');
this.editPropertyBtn = () => row().find('[id^=editPropertyBtn]').should('be.visible').should('be.enabled');
this.deleteBtn = () => row().find('[id^=deletePropertyBtn]').should('be.visible').should('be.enabled');

row()
.should('exist')
.then($r => {
if ($r.length === 0) {
cy.log(`No row found at index ${rowNum} — skipping action menu click.`);
return;
}

const $actionCell = $r.find('[id^="action-items"]').filter(':visible').first();

if ($actionCell.length > 0) {
cy.wrap($actionCell)
.find('#actionMenu', { timeout: 500 })
.filter(':visible')
.first()
.should('be.visible')
.click({ force: true });
} else {
cy.log(`Row ${rowNum} has no [id^="action-items"], skipping click.`);
return;
}
});

this.viewAreasBtn = () => cy.get('[id^=showPropertyAreasBtn]').should('be.visible').should('be.enabled');
this.editPropertyBtn = () => cy.get('[id^=editPropertyBtn]').should('be.visible').should('be.enabled');
this.deleteBtn = () => cy.get('[id^=deletePropertyBtn]').should('be.visible').should('be.enabled');
return this;
}


// find first row with text
getRowByPropertyName(propertyName: string) {
const row = () => cy.get('.mat-mdc-row')
.contains(propertyName) // div
.parent() // met-mdc-cell
.parent(); // mat-mdc-row
this.row = row();
this.viewAreasBtn = () => row().find('[id^=showPropertyAreasBtn]').should('be.visible').should('be.enabled');
this.editPropertyBtn = () => row().find('[id^=editPropertyBtn]').should('be.visible').should('be.enabled');
this.deleteBtn = () => row().find('[id^=deletePropertyBtn]').should('be.visible').should('be.enabled');


row()
.should('exist')
.then($r => {
if ($r.length === 0) {
cy.log(`No row found for property name: ${propertyName}`);
return;
}

const $actionCell = $r.find('[id^="action-items"]');

if ($actionCell.length > 0) {
cy.wrap($actionCell)
.find('#actionMenu', { timeout: 500 })
.filter(':visible')
.should('be.visible')
.click({ force: true });
} else {
cy.log(`No action-items found in row for: ${propertyName}, skipping menu click.`);
return;
}
});

this.viewAreasBtn = () => cy.get('[id^=showPropertyAreasBtn]').should('be.visible').should('be.enabled');
this.editPropertyBtn = () => cy.get('[id^=editPropertyBtn]').should('be.visible').should('be.enabled');
this.deleteBtn = () => cy.get('[id^=deletePropertyBtn]').should('be.visible').should('be.enabled');
return this;
}


goToAreas() {
this.viewAreasBtn().click();
backendConfigurationPropertiesPage.configurePropertyAreasBtn().should('be.visible');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,34 @@ export class WorkerRowObject {
deleteBtn: Cypress.Chainable<JQuery<HTMLElement>>;

getRow(rowNum: number) {
const row = () => cy.get('.mat-mdc-row').eq(rowNum - 1);
const row = () => cy.get('.mat-mdc-row').should('exist').eq(rowNum - 1);
this.row = row();
this.editAssignmentsBtn = row().find('[id^=editAssignmentsBtn]').should('be.visible').should('be.enabled');
this.editDeviceUserBtn = row().find('[id^=editDeviceUserBtn]').should('be.visible').should('be.enabled');
this.deleteBtn = row().find('[id^=deleteDeviceUserBtn]').should('be.visible').should('be.enabled');
row()
.should('exist')
.then($r => {
if ($r.length === 0) {
cy.log(`No row found at index ${rowNum} — skipping action menu click.`);
return;
}

const $actionCell = $r.find('[id^="action-items"]').first();

if ($actionCell.length > 0) {
cy.wrap($actionCell)
.find('#actionMenu', { timeout: 500 })
.filter(':visible')
.first()
.should('be.visible')
.click({ force: true });
} else {
cy.log(`Row ${rowNum} has no [id^="action-items"], skipping click.`);
return;
}
});

this.editAssignmentsBtn = cy.get('[id^=editAssignmentsBtn]').should('be.visible').should('be.enabled');
this.editDeviceUserBtn = cy.get('[id^=editDeviceUserBtn]').should('be.visible').should('be.enabled');
this.deleteBtn = cy.get('[id^=deleteDeviceUserBtn]').should('be.visible').should('be.enabled');
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('Area rules type 1', () => {
backendConfigurationPropertyWorkersPage.create(workerForCreate);
backendConfigurationPropertiesPage.goToProperties();
const propertyInTable = backendConfigurationPropertiesPage.getRowObjectByName(property.name);
cy.wait(1000);
propertyInTable.goToAreas();
propertyInTable.bindAreasByName([nameArea]);
cy.wait(500);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,20 @@ describe('Area rules type 1', () => {
.invoke('text').should('eq', `${workerForCreate.name} ${workerForCreate.surname}`);

// Copy task
cy.get('.cdk-row .cdk-column-actions .copyBtn').first().click();
// cy.get('.cdk-row .cdk-column-actions .copyBtn').first().click();
cy.get('.task-actions')
.first()
.find('#actionMenu')
.should('be.visible')
.click({ force: true });

// Now click the Copy Task button inside the opened menu
cy.get('.cdk-overlay-container')
.find('[id^=copyTaskBtn]')
.should('be.visible')
.first()
.click({ force: true });

cy.intercept('POST', '**/api/backend-configuration-pn/task-wizard').as('createTask');
cy.get('#createTaskBtn').click();
cy.wait('@createTask', { timeout: 60000 });
Expand Down Expand Up @@ -178,7 +191,19 @@ describe('Area rules type 1', () => {

// Copy and set new eform
cy.intercept('GET', '**/api/backend-configuration-pn/properties/get-folder-dtos?**').as('getFolders');
cy.get('.cdk-row .cdk-column-actions .copyBtn').first().click();
// cy.get('.cdk-row .cdk-column-actions .copyBtn').first().click();
cy.get('.task-actions')
.first()
.find('#actionMenu')
.should('be.visible')
.click({ force: true });

// Now click the Copy Task button inside the opened menu
cy.get('.cdk-overlay-container')
.find('[id^=copyTaskBtn]')
.should('be.visible')
.first()
.click({ force: true });
cy.intercept('POST', '**/api/backend-configuration-pn/task-wizard').as('createTask');
selectValueInNgSelector('#createTemplateSelector', editedTask.eformName, true);
cy.get('#createTaskBtn').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,19 @@ describe('Area rules type 1', () => {
cy.get('#backend-configuration-pn-task-wizard').click();
cy.intercept('GET', '**/api/backend-configuration-pn/properties/get-folder-dtos?**').as('getFolders');
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
cy.get('.editBtn').click();
// cy.get('.editBtn').click();
cy.get('[id^=action-items]')
.first()
.find('#actionMenu')
.should('be.visible')
.click({ force: true });

// Now click the Copy Task button inside the opened menu
cy.get('.cdk-overlay-container')
.find('[id^=editTaskBtn]')
.should('be.visible')
.first()
.click({ force: true });
cy.wait('@getFolders', { timeout: 60000 });
cy.wait('@getTemplates', { timeout: 60000 });
//cy.get('.editBtn > .mat-mdc-button-touch-target').click();
Expand All @@ -174,7 +186,19 @@ describe('Area rules type 1', () => {
cy.get('#backend-configuration-pn-task-wizard').click();
cy.intercept('GET', '**/api/backend-configuration-pn/properties/get-folder-dtos?**').as('getFolders');
cy.intercept('POST', '**/api/templates/index').as('getTemplates');
cy.get('.editBtn').click();
// cy.get('.editBtn').click();
cy.get('[id^=action-items]')
.first()
.find('#actionMenu')
.should('be.visible')
.click({ force: true });

// Now click the Copy Task button inside the opened menu
cy.get('.cdk-overlay-container')
.find('[id^=editTaskBtn]')
.should('be.visible')
.first()
.click({ force: true });
cy.wait('@getFolders', { timeout: 60000 });
cy.wait('@getTemplates', { timeout: 60000 });
//cy.get('.editBtn > .mat-mdc-button-touch-target').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,19 @@ describe('Area rules type 1', () => {
cy.wait('@createFolder', { timeout: 60000 });
cy.wait(1000);
cy.get('#backend-configuration-pn-task-wizard').scrollIntoView().click();
cy.get('.cdk-row .cdk-column-actions .editBtn').first().click();
// cy.get('.cdk-row .cdk-column-actions .editBtn').first().click();
cy.get('[id^=action-items]')
.first()
.find('#actionMenu')
.should('be.visible')
.click({ force: true });

// Now click the Copy Task button inside the opened menu
cy.get('.cdk-overlay-container')
.find('[id^=editTaskBtn]')
.should('be.visible')
.first()
.click({ force: true });
// // change task
cy.get('#updateTaskStatusToggle').click();
cy.get('#updateTaskBtn').click();
Expand All @@ -181,7 +193,19 @@ describe('Area rules type 1', () => {
.invoke('text')
.should('eq', `${workerForCreate.name} ${workerForCreate.surname}`);

cy.get('.cdk-row .cdk-column-actions .editBtn').first().click();
// cy.get('.cdk-row .cdk-column-actions .editBtn').first().click();
cy.get('[id^=action-items]')
.first()
.find('#actionMenu')
.should('be.visible')
.click({ force: true });

// Now click the Copy Task button inside the opened menu
cy.get('.cdk-overlay-container')
.find('[id^=editTaskBtn]')
.should('be.visible')
.first()
.click({ force: true });
cy.intercept('GET', '**/api/backend-configuration-pn/properties/get-folder-dtos?**').as('getFolders');
// cy.get('#updateProperty').click();
// //selectValueInNgSelectorNoSelector(`${property2.cvrNumber} - ${property2.chrNumber} - ${property2.name}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,19 @@ describe('Area rules type 1', () => {
cy.get('#folderSaveBtn').click();
cy.wait(1000);
cy.get('#backend-configuration-pn-task-wizard').scrollIntoView().click();
cy.get('.cdk-row .cdk-column-actions .editBtn').first().click();
// cy.get('.cdk-row .cdk-column-actions .editBtn').first().click();
cy.get('.task-actions')
.first()
.find('#actionMenu')
.should('be.visible')
.click({ force: true });

// Now click the Edit Task button inside the opened menu
cy.get('.cdk-overlay-container')
.find('[id^=editTaskBtn]')
.should('be.visible')
.first()
.click({ force: true });
// // change task
cy.get('#updateTaskStatusToggle').click();
cy.get('#updateTaskBtn').click();
Expand All @@ -179,7 +191,19 @@ describe('Area rules type 1', () => {
.invoke('text')
.should('eq', `${workerForCreate.name} ${workerForCreate.surname}`);

cy.get('.cdk-row .cdk-column-actions .editBtn').first().click();
// cy.get('.cdk-row .cdk-column-actions .editBtn').first().click();
cy.get('.task-actions')
.first()
.find('#actionMenu')
.should('be.visible')
.click({ force: true });

// Now click the Edit Task button inside the opened menu
cy.get('.cdk-overlay-container')
.find('[id^=editTaskBtn]')
.should('be.visible')
.first()
.click({ force: true });
cy.intercept('GET', '**/api/backend-configuration-pn/properties/get-folder-dtos?**').as('getFolders');
// cy.get('#updateProperty').click();
// //selectValueInNgSelectorNoSelector(`${property2.cvrNumber} - ${property2.chrNumber} - ${property2.name}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import {
taskWizardReducer,
taskWorkerAssignmentReducer,
} from './state';
import {MatMenu, MatMenuItem, MatMenuTrigger} from "@angular/material/menu";


@NgModule({
Expand Down Expand Up @@ -103,6 +104,9 @@ import {
taskWizardState: taskWizardReducer,
taskWorkerAssignmentState: taskWorkerAssignmentReducer,
},),
MatMenu,
MatMenuTrigger,
MatMenuItem,
],
declarations: [
BackendConfigurationPnLayoutComponent,
Expand Down
Loading
Loading