Skip to content

Commit

Permalink
rebase and requested change
Browse files Browse the repository at this point in the history
  • Loading branch information
tiyiprh committed Aug 22, 2024
1 parent 4127233 commit 616891a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 19 deletions.
8 changes: 4 additions & 4 deletions cypress/e2e/awx/access/credential-types/credentialTypes.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe('Credential Types', () => {
cy.navigateTo('awx', 'credential-types');
cy.filterTableByMultiSelect('name', [credType1.name]);
cy.getByDataCy('edit-credential-type').click();
cy.verifyPageTitle('Edit Credential Type');
cy.verifyPageTitle(`Edit ${credType1.name}`);
cy.url().should('contain', `/credential-types/${credType1.id}/edit`);
cy.getBy('[class*="view-lines monaco-mouse-cursor-text"]')
.eq(0)
Expand Down Expand Up @@ -137,7 +137,7 @@ describe('Credential Types', () => {

it('can create a new credential type with no configs', () => {
cy.createAndDeleteCustomAWXCredentialTypeUI(customCredentialTypeName);
cy.verifyPageTitle('Credential Types');
cy.verifyPageTitle('Create Types');
});

it('creates a custom credential type with input and injector configurations in JSON format in the Monaco editor', () => {
Expand Down Expand Up @@ -198,7 +198,7 @@ describe('Credential Types', () => {
const editedCredentialTypeName = (credType1.name ?? '') + ' edited';
cy.filterTableByMultiSelect('name', [credType1.name]);
cy.clickTableRowPinnedAction(credType1.name, 'edit-credential-type', false);
cy.verifyPageTitle('Edit Credential Type');
cy.verifyPageTitle(`Edit ${credType1.name}`);
cy.url().then((currentUrl) => {
expect(currentUrl.includes('edit')).to.be.true;
});
Expand Down Expand Up @@ -244,7 +244,7 @@ describe('Credential Types', () => {
cy.filterTableByMultiSelect('name', [credType1.name]);
cy.clickTableRowLink('name', credType1.name, { disableFilter: true });
cy.clickButton('Edit credential type');
cy.verifyPageTitle('Edit Credential Type');
cy.verifyPageTitle(`Edit ${credType1.name}`);
cy.get('[data-cy="name"]').clear().type(editedCredentialTypeName);
cy.get('[data-cy="description"]').clear().type('this is a new description after editing');
cy.intercept('PATCH', awxAPI`/credential_types/${credType1.id.toString()}/`).as(
Expand Down
10 changes: 5 additions & 5 deletions cypress/e2e/awx/access/credentials/credentials.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Credentials', () => {
cy.get(`[data-cy="row-id-${credential.id}"]`).within(() => {
cy.getByDataCy('edit-credential').click();
});
cy.verifyPageTitle('Edit Credential');
cy.verifyPageTitle(`Edit ${credential.name}`);
cy.getByDataCy('name').clear().type(`${credential.name} - edited`);
cy.clickButton(/^Save credential$/);
cy.clearAllFilters();
Expand Down Expand Up @@ -173,7 +173,7 @@ describe('Credentials', () => {
disableFilter: true,
});
cy.clickButton(/^Edit credential$/);
cy.verifyPageTitle('Edit Credential');
cy.verifyPageTitle(`Edit ${credential.name}`);
cy.getByDataCy('name')
.clear()
.type(credential.name + '-edited');
Expand Down Expand Up @@ -415,7 +415,7 @@ describe('Credentials: Credential Types Tests', () => {
cy.contains('Vault Password').should('be.visible');
cy.getByDataCy('vault-password').contains('Encrypted');
cy.getByDataCy('edit-credential').click();
cy.verifyPageTitle('Edit Credential');
cy.verifyPageTitle(`Edit ${credentialName}`);
cy.get('[data-cy="vault-password"]').then(($pwd) => {
cy.wrap($pwd).should('have.value', 'ENCRYPTED');
});
Expand Down Expand Up @@ -463,7 +463,7 @@ describe('Credentials: Credential Types Tests', () => {
cy.getByDataCy('label-description').contains('Description');
cy.getByDataCy('description').contains('description');
cy.getByDataCy('edit-credential').click();
cy.verifyPageTitle('Edit Credential');
cy.verifyPageTitle(`Edit ${credentialName}`);
const ModifiedCredentialName = credentialName + ' - edited';
cy.getByDataCy('name').type(ModifiedCredentialName);
cy.get('input[data-cy="username"]').then(($username) => {
Expand Down Expand Up @@ -521,7 +521,7 @@ describe('Credentials: Credential Types Tests', () => {
cy.contains('Password').should('be.visible');
cy.getByDataCy('password').contains('Prompt on launch');
cy.getByDataCy('edit-credential').click();
cy.verifyPageTitle('Edit Credential');
cy.verifyPageTitle(`Edit ${credentialName}`);
cy.getByDataCy('ask_password').uncheck();
cy.getByDataCy('password').type('password');
cy.clickButton(/^Save credential$/);
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/awx-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ Cypress.Commands.add(
const credentialTypeDesc = 'This is a custom credential type that is not managed';
cy.navigateTo('awx', 'credential-types');
cy.clickLink(/^Create credential type$/);
cy.verifyPageTitle('Create Credential Type');
cy.verifyPageTitle('Create credential type');
cy.url().then((currentUrl) => {
expect(currentUrl.includes('/credential-types/create')).to.be.true;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('CredentialTypeForm.cy.ts', () => {

it('should preload the form with current values', () => {
cy.mount(<EditCredentialType />);
cy.verifyPageTitle('Edit Credential Type');
cy.verifyPageTitle('Edit Mock Credential Type');
cy.get('[data-cy="name"]').should('have.value', 'Mock Credential Type');
cy.get('[data-cy="description"]').should('have.value', 'mock credential type description');
cy.dataEditorShouldContain('[data-cy="inputs"]', credentialType.inputs);
Expand Down
16 changes: 12 additions & 4 deletions frontend/awx/access/credential-types/CredentialTypeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export function CreateCredentialType() {
return (
<PageLayout>
<PageHeader
title={t('Create Credential Type')}
title={t('Create credential type')}
breadcrumbs={[
{ label: t('Credential Types'), to: getPageUrl(AwxRoute.CredentialTypes) },
{ label: t('Create Credential Type') },
{ label: t('Create credential type') },
]}
/>
<AwxPageForm<CredentialType>
Expand Down Expand Up @@ -79,10 +79,18 @@ export function EditCredentialType() {
return (
<PageLayout>
<PageHeader
title={t('Edit Credential Type')}
title={
credentialType?.name
? t('Edit {{credentialtypeName}}', { credentialtypeName: credentialType?.name })
: t('Credential Types')
}
breadcrumbs={[
{ label: t('Credential Types'), to: getPageUrl(AwxRoute.CredentialTypes) },
{ label: t('Edit Credential Type') },
{
label: credentialType?.name
? t('Edit {{credentialtypeName}}', { credentialtypeName: credentialType?.name })
: t('Credential Types'),
},
]}
/>
{hasCredentialType && (
Expand Down
16 changes: 12 additions & 4 deletions frontend/awx/access/credentials/CredentialForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ export function CreateCredential() {
return (
<PageLayout>
<PageHeader
title={t('Create Credential')}
title={t('Create credential')}
breadcrumbs={[
{ label: t('Credentials'), to: getPageUrl(AwxRoute.Credentials) },
{ label: t('Create Credential') },
{ label: t('Create credential') },
]}
/>
<AwxPageForm
Expand Down Expand Up @@ -429,10 +429,18 @@ export function EditCredential() {
return (
<PageLayout>
<PageHeader
title={t('Edit Credential')}
title={
credential?.name
? t('Edit {{credentialName}}', { credentialName: credential?.name })
: t('Credentials')
}
breadcrumbs={[
{ label: t('Credentials'), to: getPageUrl(AwxRoute.Credentials) },
{ label: t('Edit Credential') },
{
label: credential?.name
? t('Edit {{credentialName}}', { credentialName: credential?.name })
: t('Credentials'),
},
]}
/>
<AwxPageForm
Expand Down

0 comments on commit 616891a

Please sign in to comment.