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

Custom asset field editor ux redesign #18577

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
cypress is breaking Vue renders
  • Loading branch information
cconard96 committed Jan 9, 2025
commit bc84fcff776ab0a1a1d33a16f3c69cb2623ef85a
26 changes: 13 additions & 13 deletions tests/cypress/e2e/Asset/custom_fields.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ describe("Custom Assets - Custom Fields", () => {
cy.findByLabelText('Status').closest('.form-field').should('be.visible').invoke('index').should('eq', 0);
});

it('Create custom fields', () => {
function createField(label, type, options = new Map()) {
// eslint-disable-next-line cypress/no-async-tests
it('Create custom fields', async () => {
async function createField(label, type, options = new Map()) {
cy.findByRole('button', {name: 'New field'}).click();
cy.findByRole('dialog').should('be.visible').within(() => {
cy.findByLabelText('Label').type(label);
Expand Down Expand Up @@ -154,7 +155,6 @@ describe("Custom Assets - Custom Fields", () => {
cy.waitForNetworkIdle('/front/asset/customfielddefinition.form.php', 100);
});
cy.findByRole('dialog').should('not.exist');
cy.waitForNetworkIdle('/ajax/asset/assetdefinition.php', 100);
cy.get(`.sortable-field[data-key="custom_${label.toLowerCase().replace(' ', '_')}"]`).should('be.visible');
}

Expand All @@ -168,16 +168,16 @@ describe("Custom Assets - Custom Fields", () => {

cy.findByRole('tab', {name: /^Fields/}).click();

cy.findByRole('button', {name: 'New field'}).parents('.tab-pane').should('have.class', 'active').first().within(() => {
createField('Test String', 'String');
createField('Test Text', 'Text');
createField('Test Number', 'Number', new Map([['min', '10'], ['max', '20'], ['step', '2']]));
createField('Test Date', 'Date');
createField('Test Datetime', 'Date and time');
createField('Test Dropdown', 'Dropdown', new Map([['item_type', 'Monitor']]));
createField('Test MultiDropdown', 'Dropdown', new Map([['item_type', 'Monitor'], ['multiple_values', true]]));
createField('Test URL', 'URL');
createField('Test YesNo', 'Yes/No');
cy.findByRole('button', {name: 'New field'}).parents('.tab-pane').should('have.class', 'active').first().within(async () => {
await createField('Test String', 'String');
await createField('Test Text', 'Text');
await createField('Test Number', 'Number', new Map([['min', '10'], ['max', '20'], ['step', '2']]));
await createField('Test Date', 'Date');
await createField('Test Datetime', 'Date and time');
await createField('Test Dropdown', 'Dropdown', new Map([['item_type', 'Monitor']]));
await createField('Test MultiDropdown', 'Dropdown', new Map([['item_type', 'Monitor'], ['multiple_values', true]]));
await createField('Test URL', 'URL');
await createField('Test YesNo', 'Yes/No');

// Intercept form submission to check the form display values sent
cy.intercept('POST', '/front/asset/assetdefinition.form.php').as('saveFieldsDisplay');
Expand Down
Loading