Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
32 changes: 32 additions & 0 deletions cypress/e2e/right-panel/new-parameter-setting.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
describe('add new parameter', () => {
it('should add a new parameter successfully', () => {

cy.landingEditor();

// Step 1: Click the add button
cy.get('div.src-web-app-views-beambox-Right-Panels-ConfigPanel-SaveConfigButton-module__btn--uh2Fr')
.find('img[src="img/icon-plus.svg"]')
.click();

// Step 2: Input value 'Test'
cy.get('input.ant-input.css-dev-only-do-not-override-1o1wjx9.text-input')
.type('Test');

// Step 3: Click the OK button
cy.get('button.ant-btn.css-dev-only-do-not-override-1o1wjx9.ant-btn-primary')
.contains('OK')
.click();

// Step 4: Click span.ant-select-selection-search
cy.get('div.ant-select-selector')
.click();

// Step 5: Check if 'Test' exists in the list
cy.get('div.ant-select-item-option-content')
.should('exist')
.then($elements => {
const texts = $elements.map((_, el) => Cypress.$(el).text()).get();
expect(texts).to.include('Test');
});
});
});
61 changes: 61 additions & 0 deletions cypress/e2e/right-panel/power-below-ten.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
describe('power input validation', () => {
beforeEach(() => {
cy.landingEditor();
});

it('should not show warning when power is 10 or above', () => {
cy.get('#power-input').clear().type('10');
cy.get('#power-input').type('{enter}');
cy.get('.src-web-app-views-beambox-Right-Panels-ConfigPanel-Block-module__warning--aboql')
.should('not.exist');

cy.get('#power-input').clear().type('11');
cy.get('#power-input').type('{enter}');
cy.get('.src-web-app-views-beambox-Right-Panels-ConfigPanel-Block-module__warning--aboql')
.should('not.exist');
});

it('should handle decimal values correctly', () => {
cy.get('#power-input').clear().type('9.9');
cy.get('#power-input').type('{enter}');
cy.get('.src-web-app-views-beambox-Right-Panels-ConfigPanel-Block-module__warning--aboql')
.should('be.visible');

cy.get('#power-input').clear().type('10.1');
cy.get('#power-input').type('{enter}');
cy.get('.src-web-app-views-beambox-Right-Panels-ConfigPanel-Block-module__warning--aboql')
.should('not.exist');
});

it('should handle extreme low values', () => {
cy.get('#power-input').clear().type('0');
cy.get('#power-input').type('{enter}');
// should have number 1 as the lowest value
cy.get('#power-input').should('have.value', '1');
cy.get('.src-web-app-views-beambox-Right-Panels-ConfigPanel-Block-module__warning--aboql')
.should('be.visible');

cy.get('#power-input').clear().type('-1');
cy.get('#power-input').type('{enter}');
cy.get('.src-web-app-views-beambox-Right-Panels-ConfigPanel-Block-module__warning--aboql')
.should('be.visible');
});

it('should handle extreme high values', () => {
cy.get('#power-input').clear().type('100');
cy.get('#power-input').type('{enter}');
cy.get('.src-web-app-views-beambox-Right-Panels-ConfigPanel-Block-module__warning--aboql')
.should('not.exist');

cy.get('#power-input').clear().type('1000');
cy.get('#power-input').type('{enter}');
cy.get('.src-web-app-views-beambox-Right-Panels-ConfigPanel-Block-module__warning--aboql')
.should('not.exist');
});

it('should handle non-numeric input', () => {
cy.get('#power-input').clear().type('abc');
cy.get('#power-input').type('{enter}');
cy.get('#power-input').should('have.value', '15.0');
});
});
57 changes: 57 additions & 0 deletions cypress/e2e/right-panel/toggle-color-layer.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
describe('machine selection and svg dimensions test', () => {
beforeEach(() => {
cy.landingEditor();
});

// 20W Diode LaserCustom
it('toggle-single-full-color-layer', () => {
// Click on the top bar menu container
cy.get('.src-web-app-components-beambox-top-bar-TopBar-module__menu--Oh39C').click();

// Click on the "Edit" submenu
cy.contains('li.rc-menu__submenu', 'Edit').click();

// Click on "Document Settings"
cy.contains('li[role="menuitem"]', 'Document Settings').click();

// Select the machine from the dropdown
cy.get('span.ant-select-selection-item').click({ multiple: true, force: true });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <cypress/no-force> reported by reviewdog 🐶
Do not use force on click and type calls

cy.contains('.ant-select-item-option-content', 'Ador').click();

// Click the confirm button
cy.contains('span', 'Save')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <cypress/no-force> reported by reviewdog 🐶
Do not use force on click and type calls

.should('be.visible')
.and('not.be.disabled')
.click({ force: true });

cy.contains('span.ant-select-selection-item', '20W Diode Laser')
.click(); // Perform the click action

// Ensure the element is visible before clicking
cy.contains('div.ant-select-item-option-content', 'Printing')
.should('be.visible') // Assert that the element is visible
.click(); // Perform the click action

// Ensure the button is visible before clicking
cy.contains('button.ant-btn', 'Confirm')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <cypress/no-force> reported by reviewdog 🐶
Do not use force on click and type calls

.should('be.visible')
.click({ force: true });

// right click
// 'div#toggle_fullcolor_layer'
// check exist or not : Switch to single color layer
cy.get('div#layerdoubleclick-0')
.rightclick();
cy.get('div#toggle_fullcolor_layer')
.should('exist', 'Switch to single color layer')
.click();

cy.wait(1500);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <cypress/no-unnecessary-waiting> reported by reviewdog 🐶
Do not wait for arbitrary time periods


cy.get('div#layerdoubleclick-0')
.rightclick();
cy.get('div#toggle_fullcolor_layer')
.should('exist', 'Switch to full color layer')
.click();
});
});
Loading