Skip to content

Commit

Permalink
fix(cli): Check if Agent API flag exists first (#3206)
Browse files Browse the repository at this point in the history
* fix(cli): Check if Agent API flag exists first

* fix(frontend): fix cypress tests

---------

Co-authored-by: Jorge Padilla <jorge.esteban.padilla@gmail.com>
  • Loading branch information
xoscar and jorgeepc committed Oct 3, 2023
1 parent c712071 commit e0e6390
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions cli/config/configurator.go
Expand Up @@ -99,16 +99,16 @@ func (c Configurator) Start(ctx context.Context, prev Config, flags ConfigFlags)
return Save(cfg)
}

if prev.Jwt != "" {
cfg.Jwt = prev.Jwt
cfg.Token = prev.Token

if flags.AgentApiKey != "" {
cfg.AgentApiKey = flags.AgentApiKey
c.ShowOrganizationSelector(ctx, cfg, flags)
return nil
}

if flags.AgentApiKey != "" {
cfg.AgentApiKey = flags.AgentApiKey
if prev.Jwt != "" {
cfg.Jwt = prev.Jwt
cfg.Token = prev.Token

c.ShowOrganizationSelector(ctx, cfg, flags)
return nil
}
Expand Down
5 changes: 3 additions & 2 deletions web/src/pages/Home/CreateButton.tsx
Expand Up @@ -4,11 +4,12 @@ import * as S from '../TestSuites/TestSuites.styled';
interface IProps {
onCreate(): void;
title?: string;
dataCy?: string;
}

const CreateButton = ({onCreate, title}: IProps) => (
const CreateButton = ({onCreate, title, dataCy}: IProps) => (
<S.ActionContainer>
<S.CreateTestButton operation={Operation.Edit} type="primary" data-cy="create-button" onClick={onCreate}>
<S.CreateTestButton operation={Operation.Edit} type="primary" data-cy={dataCy} onClick={onCreate}>
{title || 'Create'}
</S.CreateTestButton>
</S.ActionContainer>
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/Home/TestsList.tsx
Expand Up @@ -67,7 +67,7 @@ const Tests = () => {
onSortBy={(sortBy, sortDirection) => setParameters({sortBy, sortDirection})}
isEmpty={pagination.list?.length === 0}
/>
<CreateButton onCreate={() => setIsCreateTestOpen(true)} />
<CreateButton onCreate={() => setIsCreateTestOpen(true)} dataCy="create-button" />
</S.ActionsContainer>

<Pagination<Test>
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/TestSuites/TestSuitesList.tsx
Expand Up @@ -66,7 +66,7 @@ const Resources = () => {
onSortBy={(sortBy, sortDirection) => setParameters({sortBy, sortDirection})}
isEmpty={pagination.list?.length === 0}
/>
<CreateButton onCreate={() => setIsCreateTestSuiteOpen(true)} />
<CreateButton onCreate={() => setIsCreateTestSuiteOpen(true)} dataCy="create-button" />
</S.ActionsContainer>

<Pagination<TestSuite>
Expand Down

0 comments on commit e0e6390

Please sign in to comment.