Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tests to remote registries form #1112

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/repositories/remote-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ export class RemoteForm extends React.Component<IProps, IState> {
onClear={() => this.updateIsSet('client_key', false)}
>
<FileUpload
data-cy='client_key'
validated={this.toError(!('client_key' in errorMessages))}
isRequired={requiredFields.includes('client_key')}
id='yaml'
Expand Down Expand Up @@ -529,6 +530,7 @@ export class RemoteForm extends React.Component<IProps, IState> {
</FlexItem>
<FlexItem>
<Button
data-cy='client_cert'
isDisabled={!this.props.remote.client_cert}
onClick={() => {
FileSaver.saveAs(
Expand Down Expand Up @@ -578,6 +580,7 @@ export class RemoteForm extends React.Component<IProps, IState> {
</FlexItem>
<FlexItem>
<Button
data-cy='ca_cert'
isDisabled={!this.props.remote.ca_cert}
onClick={() => {
FileSaver.saveAs(
Expand Down
10 changes: 9 additions & 1 deletion test/cypress/integration/remote_registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ describe('Remote Registry Tests', () => {
it('admin can add new remote registry', () => {
cy.menuGo('Execution Enviroments > Remote Registries');
cy.addRemoteRegistry('New remote registry1', 'some url1');
cy.addRemoteRegistry('New remote registry2', 'some url2');
cy.addRemoteRegistry('New remote registry2', 'some url2', {
username: 'some username2',
password: 'some password2',
proxy_url: 'some proxy_url2',
proxy_username: 'some proxy_username2',
proxy_password: 'some proxy_password2',
download_concurrency: 5,
rate_limit: 5,
});
});

it('admin can view data', () => {
Expand Down
31 changes: 28 additions & 3 deletions test/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,38 @@ Cypress.Commands.add('settings', {}, (newSettings) => {
});
});

Cypress.Commands.add('addRemoteRegistry', {}, (name, url) => {
Cypress.Commands.add('addRemoteRegistry', {}, (name, url, extra = null) => {
cy.menuGo('Execution Enviroments > Remote Registries');
cy.contains('button', 'Add remote registry').click();

// add registry
cy.get('input[id = "name"]').type(name);
cy.get('input[id = "url"]').type(url);
cy.get('input[id="name"]').type(name);
cy.get('input[id="url"]').type(url);

if (extra) {
const {
username,
password,
proxy_url,
proxy_username,
proxy_password,
download_concurrency,
rate_limit,
} = extra;

cy.get('input[id="username"]').type(username);
cy.get('input[id="password"]').type(password);
//advanced options
cy.get('.pf-c-expandable-section__toggle-text').click();
cy.get('input[id="proxy_url"]').type(proxy_url);
cy.get('input[id="proxy_username"]').type(proxy_username);
cy.get('input[id="proxy_password"]').type(proxy_password);
cy.get('[data-cy=client_key]');
cy.get('button[data-cy=client_cert]');
cy.get('button[data-cy=ca_cert]');
cy.get('input[id="download_concurrency"]').type(download_concurrency);
cy.get('input[id="rate_limit"]').type(rate_limit);
}

cy.intercept(
'POST',
Expand Down