Fix a few unit-tests warnings

Fix a few unit-test warnings
This commit is contained in:
nixocio
2021-04-28 08:56:10 -04:00
parent acb6e3e6e9
commit 1471945b9e
6 changed files with 25 additions and 25 deletions

View File

@@ -81,7 +81,8 @@
"gridColumns", "gridColumns",
"rows", "rows",
"href", "href",
"modifier" "modifier",
"data-cy"
], ],
"ignore": ["Ansible", "Tower", "JSON", "YAML", "lg"], "ignore": ["Ansible", "Tower", "JSON", "YAML", "lg"],
"ignoreComponent": [ "ignoreComponent": [

View File

@@ -136,7 +136,7 @@ describe('<ScheduleEdit />', () => {
resource={{ resource={{
id: 700, id: 700,
type: 'job_template', type: 'job_template',
iventory: 1, inventory: 1,
summary_fields: { summary_fields: {
credentials: [ credentials: [
{ name: 'job template credential', id: 75, kind: 'ssh' }, { name: 'job template credential', id: 75, kind: 'ssh' },

View File

@@ -157,7 +157,7 @@ function CredentialFormFields({ i18n, initialTypeId, credentialTypes }) {
<SelectOption <SelectOption
key={credType.value} key={credType.value}
value={credType.value} value={credType.value}
dataCy={`${credType.id}-credential-type-select-option`} data-cy={`${credType.id}-credential-type-select-option`}
> >
{credType.label} {credType.label}
</SelectOption> </SelectOption>

View File

@@ -90,14 +90,13 @@ describe('<InventoryDetail />', () => {
expectDetailToMatch(wrapper, 'Name', mockInventory.name); expectDetailToMatch(wrapper, 'Name', mockInventory.name);
expectDetailToMatch(wrapper, 'Description', mockInventory.description); expectDetailToMatch(wrapper, 'Description', mockInventory.description);
expectDetailToMatch(wrapper, 'Type', 'Inventory'); expectDetailToMatch(wrapper, 'Type', 'Inventory');
const link = wrapper.find('Detail[label="Organization"]').find('Link');
const org = wrapper.find('Detail[label="Organization"]'); const org = wrapper.find('Detail[label="Organization"]');
expect(org.prop('value')).toMatchInlineSnapshot(`
<Link expect(link.prop('to')).toEqual('/organizations/1/details');
to="/organizations/1/details" expect(org.length).toBe(1);
>
The Organization
</Link>
`);
const vars = wrapper.find('VariablesDetail'); const vars = wrapper.find('VariablesDetail');
expect(vars).toHaveLength(1); expect(vars).toHaveLength(1);
expect(vars.prop('value')).toEqual(mockInventory.variables); expect(vars.prop('value')).toEqual(mockInventory.variables);

View File

@@ -131,12 +131,12 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
} }
const HeaderBrand = ( const HeaderBrand = (
<Brand dataCy="brand-logo" src={logo} alt={alt || brandName} /> <Brand data-cy="brand-logo" src={logo} alt={alt || brandName} />
); );
const Header = <LoginHeader headerBrand={HeaderBrand} />; const Header = <LoginHeader headerBrand={HeaderBrand} />;
const Footer = ( const Footer = (
<LoginFooter <LoginFooter
dataCy="login-footer" data-cy="login-footer"
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{
__html: sanitizeHtml(loginInfo), __html: sanitizeHtml(loginInfo),
}} }}
@@ -146,7 +146,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
return ( return (
<Login header={Header} footer={Footer}> <Login header={Header} footer={Footer}>
<LoginMainHeader <LoginMainHeader
dataCy="login-header" data-cy="login-header"
title={ title={
brandName brandName
? i18n._(t`Welcome to Ansible ${brandName}! Please Sign In.`) ? i18n._(t`Welcome to Ansible ${brandName}! Please Sign In.`)
@@ -163,7 +163,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
> >
{formik => ( {formik => (
<LoginForm <LoginForm
dataCy="login-form" data-cy="login-form"
className={authError ? 'pf-m-error' : ''} className={authError ? 'pf-m-error' : ''}
helperText={helperText} helperText={helperText}
isLoginButtonDisabled={isAuthenticating} isLoginButtonDisabled={isAuthenticating}
@@ -193,7 +193,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
variant="error" variant="error"
title={i18n._(t`Error!`)} title={i18n._(t`Error!`)}
onClose={dismissLoginInfoError} onClose={dismissLoginInfoError}
dataCy="login-info-error" data-cy="login-info-error"
> >
{i18n._( {i18n._(
t`Failed to fetch custom login configuration settings. System defaults will be shown instead.` t`Failed to fetch custom login configuration settings. System defaults will be shown instead.`
@@ -211,7 +211,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
if (authKey === 'azuread-oauth2') { if (authKey === 'azuread-oauth2') {
return ( return (
<LoginMainFooterLinksItem <LoginMainFooterLinksItem
dataCy="social-auth-azure" data-cy="social-auth-azure"
href={loginUrl} href={loginUrl}
key={authKey} key={authKey}
> >
@@ -224,7 +224,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
if (authKey === 'github') { if (authKey === 'github') {
return ( return (
<LoginMainFooterLinksItem <LoginMainFooterLinksItem
dataCy="social-auth-github" data-cy="social-auth-github"
href={loginUrl} href={loginUrl}
key={authKey} key={authKey}
> >
@@ -237,7 +237,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
if (authKey === 'github-org') { if (authKey === 'github-org') {
return ( return (
<LoginMainFooterLinksItem <LoginMainFooterLinksItem
dataCy="social-auth-github-org" data-cy="social-auth-github-org"
href={loginUrl} href={loginUrl}
key={authKey} key={authKey}
> >
@@ -252,7 +252,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
if (authKey === 'github-team') { if (authKey === 'github-team') {
return ( return (
<LoginMainFooterLinksItem <LoginMainFooterLinksItem
dataCy="social-auth-github-team" data-cy="social-auth-github-team"
href={loginUrl} href={loginUrl}
key={authKey} key={authKey}
> >
@@ -265,7 +265,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
if (authKey === 'github-enterprise') { if (authKey === 'github-enterprise') {
return ( return (
<LoginMainFooterLinksItem <LoginMainFooterLinksItem
dataCy="social-auth-github-enterprise" data-cy="social-auth-github-enterprise"
href={loginUrl} href={loginUrl}
key={authKey} key={authKey}
> >
@@ -280,7 +280,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
if (authKey === 'github-enterprise-org') { if (authKey === 'github-enterprise-org') {
return ( return (
<LoginMainFooterLinksItem <LoginMainFooterLinksItem
dataCy="social-auth-github-enterprise-org" data-cy="social-auth-github-enterprise-org"
href={loginUrl} href={loginUrl}
key={authKey} key={authKey}
> >
@@ -297,7 +297,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
if (authKey === 'github-enterprise-team') { if (authKey === 'github-enterprise-team') {
return ( return (
<LoginMainFooterLinksItem <LoginMainFooterLinksItem
dataCy="social-auth-github-enterprise-team" data-cy="social-auth-github-enterprise-team"
href={loginUrl} href={loginUrl}
key={authKey} key={authKey}
> >
@@ -314,7 +314,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
if (authKey === 'google-oauth2') { if (authKey === 'google-oauth2') {
return ( return (
<LoginMainFooterLinksItem <LoginMainFooterLinksItem
dataCy="social-auth-google" data-cy="social-auth-google"
href={loginUrl} href={loginUrl}
key={authKey} key={authKey}
> >
@@ -328,7 +328,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) {
const samlIDP = authKey.split(':')[1] || null; const samlIDP = authKey.split(':')[1] || null;
return ( return (
<LoginMainFooterLinksItem <LoginMainFooterLinksItem
dataCy="social-auth-saml" data-cy="social-auth-saml"
href={loginUrl} href={loginUrl}
key={authKey} key={authKey}
> >

View File

@@ -53,7 +53,7 @@ describe('<Metrics/>', () => {
.prop('onClick')({}, 'instance 1'); .prop('onClick')({}, 'instance 1');
}); });
wrapper.update(); wrapper.update();
await act(() => { await act(async () => {
wrapper.find('Select[ouiaId="Metric-select"]').prop('onToggle')(true); wrapper.find('Select[ouiaId="Metric-select"]').prop('onToggle')(true);
}); });
wrapper.update(); wrapper.update();