1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

move login page test under pages and add tests for all pages stubs

This commit is contained in:
John Mitchell 2018-10-31 14:44:18 -04:00
parent b40c81cc3d
commit 8a3b8823ee
No known key found for this signature in database
GPG Key ID: FE6A9B5BD4EB5C94
23 changed files with 666 additions and 3 deletions

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import Applications from '../../../src/pages/Applications';
describe('<Applications />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<Applications />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import AuthSettings from '../../../src/pages/AuthSettings';
describe('<AuthSettings />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<AuthSettings />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import CredentialTypes from '../../../src/pages/CredentialTypes';
describe('<CredentialTypes />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<CredentialTypes />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import Credentials from '../../../src/pages/Credentials';
describe('<Credentials />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<Credentials />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import Dashboard from '../../../src/pages/Dashboard';
describe('<Dashboard />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<Dashboard />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import InstanceGroups from '../../../src/pages/InstanceGroups';
describe('<InstanceGroups />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<InstanceGroups />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import Inventories from '../../../src/pages/Inventories';
describe('<Inventories />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<Inventories />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import InventoryScripts from '../../../src/pages/InventoryScripts';
describe('<InventoryScripts />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<InventoryScripts />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import Jobs from '../../../src/pages/Jobs';
describe('<Jobs />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<Jobs />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import JobsSettings from '../../../src/pages/JobsSettings';
describe('<JobsSettings />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<JobsSettings />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import License from '../../../src/pages/License';
describe('<License />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<License />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -1,9 +1,9 @@
import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { mount, shallow } from 'enzyme';
import { asyncFlush } from '../../jest.setup';
import LoginPage from '../../src/pages/Login';
import api from '../../src/api';
import { asyncFlush } from '../../../jest.setup';
import LoginPage from '../../../src/pages/Login';
import api from '../../../src/api';
const LOGIN_ERROR_MESSAGE = 'Invalid username or password. Please try again.';

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import ManagementJobs from '../../../src/pages/ManagementJobs';
describe('<ManagementJobs />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<ManagementJobs />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import NotificationTemplates from '../../../src/pages/NotificationTemplates';
describe('<NotificationTemplates />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<NotificationTemplates />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,54 @@
import React from 'react';
import { mount } from 'enzyme';
import Organizations from '../../../src/pages/Organizations';
describe('<Organizations />', () => {
let pageWrapper;
let pageSections;
let title;
let gallery;
let galleryItems;
let orgCards;
const orgs = [
{ id: 1, name: 'org 1' },
{ id: 2, name: 'org 2' },
{ id: 3, name: 'org 3' }
];
const findOrgCards = () => {
galleryItems = pageWrapper.find('GalleryItem');
orgCards = pageWrapper.find('OrganizationCard');
};
beforeEach(() => {
pageWrapper = mount(<Organizations />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
gallery = pageWrapper.find('Gallery');
findOrgCards();
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
expect(gallery.length).toBe(1);
// by default, no galleryItems or orgCards
expect(galleryItems.length).toBe(0);
expect(orgCards.length).toBe(0);
// will render all orgCards if state is set
pageWrapper.setState({ organizations: orgs });
findOrgCards();
expect(galleryItems.length).toBe(3);
expect(orgCards.length).toBe(3);
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import Portal from '../../../src/pages/Portal';
describe('<Portal />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<Portal />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import Projects from '../../../src/pages/Projects';
describe('<Projects />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<Projects />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import Schedules from '../../../src/pages/Schedules';
describe('<Schedules />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<Schedules />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import SystemSettings from '../../../src/pages/SystemSettings';
describe('<SystemSettings />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<SystemSettings />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import Teams from '../../../src/pages/Teams';
describe('<Teams />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<Teams />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import Templates from '../../../src/pages/Templates';
describe('<Templates />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<Templates />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import UISettings from '../../../src/pages/UISettings';
describe('<UISettings />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<UISettings />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});

View File

@ -0,0 +1,29 @@
import React from 'react';
import { mount } from 'enzyme';
import Users from '../../../src/pages/Users';
describe('<Users />', () => {
let pageWrapper;
let pageSections;
let title;
beforeEach(() => {
pageWrapper = mount(<Users />);
pageSections = pageWrapper.find('PageSection');
title = pageWrapper.find('Title');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1);
expect(pageSections.length).toBe(2);
expect(title.length).toBe(1);
expect(title.props().size).toBe('2xl');
pageSections.forEach(section => {
expect(section.props().variant).toBeDefined();
});
});
});