Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammisuli committed Aug 2, 2023
2 parents f27c83e + f5787a3 commit 5840054
Show file tree
Hide file tree
Showing 79 changed files with 3,455 additions and 1,802 deletions.
15 changes: 8 additions & 7 deletions apps/generate-ui-v2-e2e/src/e2e/autocomplete-field.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ const autocompleteSchema = {
'item4',
'item5',
'item6',
'item7',
'item8',
'item9',
'item10',
'item11',
'item12',
'object1',
'object2',
'object3',
'object4',
'object5',
'object6',
'object7',
],
aliases: [],
},
Expand All @@ -47,6 +48,6 @@ describe('autocomplete field', () => {

it('should correctly render all options when expanded', () => {
getFieldByName('option2').click();
cy.get('intellij-option').should('have.length', 12);
cy.get('intellij-option').should('have.length', 13);
});
});
37 changes: 32 additions & 5 deletions apps/generate-ui-v2-e2e/src/e2e/field-list.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,19 @@ describe('field list', () => {

it('should show only important fields by default', () => {
getFields().should('have.length', 2);
getFieldNavItems().should('have.length', 2);
});

it('should show and hide fields when button is clicked', () => {
clickShowMore();
getFields().should('have.length', 6);
getFieldNavItems().should('have.length', 6);
clickShowMore();
getFields().should('have.length', 2);
getFieldNavItems().should('have.length', 2);
});

it('should filter items based on the search bar', () => {
cy.get('[id="search-bar"]').type('option1');
getFields().should('have.length', 1);
getFieldNavItems().should('have.length', 1);
cy.get('[data-cy="show-more"]').should('not.be.visible');
cy.get('[data-cy="show-more"]').should('not.exist');
});

it('should render correct fields based on the schema', () => {
Expand Down Expand Up @@ -81,4 +77,35 @@ describe('field list', () => {
getFieldErrorByName(fieldName).should('have.length', 1);
getFieldNavItemByName(fieldName).should('have.class', errorClass);
});

describe('field nav', () => {
const greyedOutClass = 'text-gray-500';

it('should show all fields and some greyed out by default', () => {
getFieldNavItems().should('have.length', 6);
getFieldNavItems().filter(`.${greyedOutClass}`).should('have.length', 4);
});

it('should show all fields and none greyed when expanded', () => {
clickShowMore();
getFieldNavItems().should('have.length', 6);
getFieldNavItems().filter(`.${greyedOutClass}`).should('have.length', 0);
});

it('should filter nav items based on the search bar', () => {
cy.get('[id="search-bar"]').type('option1');
getFieldNavItems().should('have.length', 1);
cy.get('[data-cy="show-more"]').should('not.exist');
});

it('should expand items and scroll to them when clicked', () => {
getFieldNavItemByName('option2')
.should('be.visible')
.click({ force: true });
cy.clock().tick(100);
getFields().should('have.length', 6);
getFieldNavItems().filter(`.${greyedOutClass}`).should('have.length', 0);
getFieldByName('option2').should('be.visible');
});
});
});
2 changes: 0 additions & 2 deletions apps/generate-ui-v2-e2e/src/support/visit-generate-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { GeneratorSchema } from '@nx-console/shared/generate-ui-types';
export const visitGenerateUi = (schema: GeneratorSchema) =>
cy.visit('/', {
onBeforeLoad: (win: any) => {
console.log('win', win);
const postToWebviewCallbacks: any[] = [];
win.intellijApi = {
postToWebview(message: string) {
Expand All @@ -30,7 +29,6 @@ export const visitGenerateUi = (schema: GeneratorSchema) =>
}
},
registerPostToWebviewCallback(callback: any) {
console.log('registering post to webview callback', callback);
postToWebviewCallbacks.push(callback);
},
};
Expand Down
Loading

0 comments on commit 5840054

Please sign in to comment.