process.env.SELECTED_CLI = 'angular'; import { checkFilesExist, isNotWindows, killPorts, newProject, readFile, removeProject, runCLI, runCypressTests, tmpProjPath, uniq, } from '@nrwl/e2e/utils'; import { writeFileSync } from 'fs'; describe('Angular Package', () => { // TODO(juristr): Re-enable these when storybook supports Angular 13 xdescribe('storybook schematics', () => { let proj: string; beforeEach(() => (proj = newProject())); afterAll(() => removeProject({ onlyOnCI: true })); it('should not overwrite global storybook config files', () => { const angularStorybookLib = uniq('test-ui-lib-angular'); runCLI( `generate @nrwl/angular:lib ${angularStorybookLib} --no-interactive` ); runCLI( `generate @nrwl/angular:storybook-configuration ${angularStorybookLib} --generateStories --no-interactive` ); checkFilesExist(`.storybook/main.js`); writeFileSync( tmpProjPath(`.storybook/main.js`), ` module.exports = { stories: [], addons: ['@storybook/addon-essentials'], }; console.log('hi there'); ` ); // generate another lib with storybook config const anotherAngularStorybookLib = uniq('test-ui-lib-angular2'); runCLI( `generate @nrwl/angular:lib ${anotherAngularStorybookLib} --no-interactive` ); runCLI( `generate @nrwl/angular:storybook-configuration ${anotherAngularStorybookLib} --generateStories --no-interactive` ); expect(readFile(`.storybook/main.js`)).toContain( `console.log('hi there');` ); }); describe('build storybook', () => { it('should execute e2e tests using Cypress running against Storybook', async () => { if (isNotWindows()) { const myapp = uniq('myapp'); runCLI(`generate @nrwl/angular:app ${myapp} --no-interactive`); const myAngularLib = uniq('test-ui-lib'); createTestUILib(myAngularLib); const myReactLib = uniq('test-ui-lib-react'); runCLI(`generate @nrwl/react:lib ${myReactLib} --no-interactive`); runCLI( `generate @nrwl/react:component Button --project=${myReactLib} --no-interactive` ); writeFileSync( tmpProjPath(`libs/${myReactLib}/src/lib/button.tsx`), ` import React from 'react'; import './button.css'; export type ButtonStyle = 'default' | 'primary' | 'warning'; /* eslint-disable-next-line */ export interface ButtonProps { text?: string; style?: ButtonStyle; padding?: number; } export const Button = (props: ButtonProps) => { return ( ); }; export default Button; ` ); writeFileSync( tmpProjPath(`libs/${myReactLib}/src/lib/button.stories.tsx`), ` import { Story, Meta } from '@storybook/react'; import { Button, ButtonProps } from './button'; export default { component: Button, title: 'Button', } as Meta; const Template: Story = (args) =>

You are {{age}} years old.

` ); runCLI( `g @nrwl/angular:component test-other --project=${libName} --no-interactive` ); }