1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { ThemeProvider, StyledEngineProvider } from '@mui/material';
7 import { CustomTheme } from 'common/custom-theme';
8 import { WebDavS3InfoDialog } from './webdav-s3-dialog';
9 import { COLLECTION_WEBDAV_S3_DIALOG_NAME } from 'store/collections/collection-info-actions';
10 import { Provider } from "react-redux";
11 import { createStore, combineReducers } from 'redux';
13 describe('WebDavS3InfoDialog', () => {
18 const initialDialogState = {
19 [COLLECTION_WEBDAV_S3_DIALOG_NAME]: {
22 uuid: "zzzzz-4zz18-b1f8tbldjrm8885",
23 token: "v2/zzzzb-jjjjj-123123/xxxtokenxxx",
24 downloadUrl: "https://download.example.com",
25 collectionsUrl: "https://collections.example.com",
26 localCluster: "zzzzz",
29 setActiveTab: (event, tabNr) => { }
33 const initialAuthState = {
34 localCluster: "zzzzz",
35 remoteHostsConfig: {},
38 store = createStore(combineReducers({
39 dialog: (state = initialDialogState, action) => state,
40 auth: (state = initialAuthState, action) => state,
50 it('render cyberduck tab', () => {
51 store.getState().dialog[COLLECTION_WEBDAV_S3_DIALOG_NAME].data.activeTab = 0;
54 <StyledEngineProvider injectFirst>
55 <ThemeProvider theme={CustomTheme}>
56 <Provider store={store}>
57 <WebDavS3InfoDialog {...props} />
60 </StyledEngineProvider>
64 cy.contains("davs://bobby@download.example.com/c=zzzzz-4zz18-b1f8tbldjrm8885").should('exist');
67 it('render win/mac tab', () => {
68 store.getState().dialog[COLLECTION_WEBDAV_S3_DIALOG_NAME].data.activeTab = 1;
71 <StyledEngineProvider injectFirst>
72 <ThemeProvider theme={CustomTheme}>
73 <Provider store={store}>
74 <WebDavS3InfoDialog {...props} />
77 </StyledEngineProvider>
81 cy.contains("https://download.example.com/c=zzzzz-4zz18-b1f8tbldjrm8885").should('exist');
84 it('render s3 tab with federated token', () => {
85 store.getState().dialog[COLLECTION_WEBDAV_S3_DIALOG_NAME].data.activeTab = 2;
88 <StyledEngineProvider injectFirst>
89 <ThemeProvider theme={CustomTheme}>
90 <Provider store={store}>
91 <WebDavS3InfoDialog {...props} />
94 </StyledEngineProvider>
98 cy.contains("Secret Keyv2_zzzzb-jjjjj-123123_xxxtokenxxx").should('exist');
101 it('render s3 tab with local token', () => {
102 store.getState().dialog[COLLECTION_WEBDAV_S3_DIALOG_NAME].data.activeTab = 2;
103 store.getState().dialog[COLLECTION_WEBDAV_S3_DIALOG_NAME].data.token = "v2/zzzzz-jjjjj-123123/xxxtokenxxx";
106 <StyledEngineProvider injectFirst>
107 <ThemeProvider theme={CustomTheme}>
108 <Provider store={store}>
109 <WebDavS3InfoDialog {...props} />
112 </StyledEngineProvider>
116 cy.contains("Access Keyzzzzz-jjjjj-123123Secret Keyxxxtokenxxx").should('exist');
119 it('render cyberduck tab with wildcard DNS', () => {
120 store.getState().dialog[COLLECTION_WEBDAV_S3_DIALOG_NAME].data.activeTab = 0;
121 store.getState().dialog[COLLECTION_WEBDAV_S3_DIALOG_NAME].data.collectionsUrl = "https://*.collections.example.com";
124 <StyledEngineProvider injectFirst>
125 <ThemeProvider theme={CustomTheme}>
126 <Provider store={store}>
127 <WebDavS3InfoDialog {...props} />
130 </StyledEngineProvider>
134 cy.contains("davs://bobby@zzzzz-4zz18-b1f8tbldjrm8885.collections.example.com").should('exist');