-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: [M3-8440] - Cypress tests for OBJ Gen 2 bucket access tab chang…
…es (#10994) * skeleton tests * test for E0 endpoint * finish other tests, now time to cleanup * remove duplication * update description * Added changeset: Add cypress integration test for OBJ gen 2 bucket details tab changes * update test descriptions * cleanup: use contains instead of find by text * parameterize tests based on feedback @jdamore-linode * confirm testing AC and update tests/fix bug
- Loading branch information
1 parent
c981cf4
commit 1c6241d
Showing
4 changed files
with
172 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Tests | ||
--- | ||
|
||
Add cypress integration test for OBJ gen 2 bucket details tab changes ([#10994](https://github.com/linode/manager/pull/10994)) |
142 changes: 142 additions & 0 deletions
142
packages/manager/cypress/e2e/core/objectStorageGen2/bucket-details-gen2.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
import { mockGetAccount } from 'support/intercepts/account'; | ||
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags'; | ||
import { | ||
mockGetBucketsForRegion, | ||
mockGetObjectStorageEndpoints, | ||
mockGetBucketAccess, | ||
} from 'support/intercepts/object-storage'; | ||
import { | ||
accountFactory, | ||
objectStorageBucketFactoryGen2, | ||
objectStorageEndpointsFactory, | ||
regionFactory, | ||
} from 'src/factories'; | ||
import { ACLType, ObjectStorageEndpointTypes } from '@linode/api-v4'; | ||
|
||
describe('Object Storage Gen 2 bucket details Access and SSL/TLS tabs', () => { | ||
beforeEach(() => { | ||
mockAppendFeatureFlags({ | ||
objMultiCluster: true, | ||
objectStorageGen2: { enabled: true }, | ||
}).as('getFeatureFlags'); | ||
mockGetAccount( | ||
accountFactory.build({ | ||
capabilities: [ | ||
'Object Storage', | ||
'Object Storage Endpoint Types', | ||
'Object Storage Access Key Regions', | ||
], | ||
}) | ||
).as('getAccount'); | ||
}); | ||
|
||
const mockRegion = regionFactory.build({ | ||
capabilities: ['Object Storage'], | ||
}); | ||
|
||
const mockAccess = { | ||
acl: 'private' as ACLType, | ||
acl_xml: '', | ||
cors_enabled: true, | ||
cors_xml: '', | ||
}; | ||
|
||
const createMocksBasedOnEndpointType = ( | ||
endpointType: ObjectStorageEndpointTypes | ||
) => { | ||
const mockBucket = objectStorageBucketFactoryGen2.build({ | ||
endpoint_type: endpointType, | ||
region: mockRegion.id, | ||
}); | ||
const mockEndpoint = objectStorageEndpointsFactory.build({ | ||
endpoint_type: endpointType, | ||
region: mockRegion.id, | ||
}); | ||
|
||
return { mockBucket, mockEndpoint }; | ||
}; | ||
|
||
['E0', 'E1'].forEach((endpoint: ObjectStorageEndpointTypes) => { | ||
/** | ||
* Parameterized test for object storage endpoint types E0 and E1 | ||
* - Confirms the CORS toggle still appears | ||
* - Confirms the SSL/TLS tab appears | ||
*/ | ||
it(`does not hide the CORS toggle and SSL/TLS tab for buckets with an ${endpoint} endpoint`, () => { | ||
const { mockBucket, mockEndpoint } = createMocksBasedOnEndpointType( | ||
endpoint | ||
); | ||
const { cluster, label } = mockBucket; | ||
|
||
mockGetBucketAccess(label, cluster, mockAccess).as('getBucketAccess'); | ||
mockGetBucketsForRegion(mockRegion.id, [mockBucket]).as( | ||
'getBucketsForRegion' | ||
); | ||
mockGetObjectStorageEndpoints([mockEndpoint]).as( | ||
'getObjectStorageEndpoints' | ||
); | ||
|
||
cy.visitWithLogin(`/object-storage/buckets/${cluster}/${label}/access`); | ||
cy.wait([ | ||
'@getFeatureFlags', | ||
'@getAccount', | ||
'@getObjectStorageEndpoints', | ||
'@getBucketsForRegion', | ||
'@getBucketAccess', | ||
]); | ||
|
||
cy.findByText('Bucket Access').should('be.visible'); | ||
cy.findByLabelText('Access Control List (ACL)').should('be.visible'); | ||
// confirm CORS is visible | ||
cy.findByText('CORS Enabled').should('be.visible'); | ||
cy.contains( | ||
'Whether Cross-Origin Resource Sharing is enabled for all origins. For more fine-grained control of CORS, please use another S3-compatible tool.' | ||
).should('be.visible'); | ||
|
||
// Confirm SSL/TLS tab is not hidden and is clickable | ||
cy.findByText('SSL/TLS').should('be.visible').click(); | ||
cy.url().should('endWith', '/ssl'); | ||
}); | ||
}); | ||
|
||
['E2', 'E3'].forEach((endpoint: ObjectStorageEndpointTypes) => { | ||
/** | ||
* Parameterized test for object storage endpoint types E2 and E3 | ||
* - Confirms the CORS toggle is hidden | ||
* - Confirms the SSL/TLS tab is hidden | ||
*/ | ||
it(`hides the CORS toggle and SSL/TLS tab for for buckets with an ${endpoint} endpoint`, () => { | ||
const { mockBucket, mockEndpoint } = createMocksBasedOnEndpointType( | ||
endpoint | ||
); | ||
const { cluster, label } = mockBucket; | ||
|
||
mockGetBucketAccess(label, cluster, mockAccess).as('getBucketAccess'); | ||
mockGetBucketsForRegion(mockRegion.id, [mockBucket]).as( | ||
'getBucketsForRegion' | ||
); | ||
mockGetObjectStorageEndpoints([mockEndpoint]).as( | ||
'getObjectStorageEndpoints' | ||
); | ||
|
||
cy.visitWithLogin(`/object-storage/buckets/${cluster}/${label}/access`); | ||
cy.wait([ | ||
'@getFeatureFlags', | ||
'@getAccount', | ||
'@getObjectStorageEndpoints', | ||
'@getBucketsForRegion', | ||
'@getBucketAccess', | ||
]); | ||
|
||
cy.findByText('Bucket Access').should('be.visible'); | ||
cy.findByLabelText('Access Control List (ACL)').should('be.visible'); | ||
// confirm CORS is not visible | ||
cy.contains( | ||
'CORS (Cross Origin Sharing) is not available for endpoint types E2 and E3' | ||
).should('be.visible'); | ||
|
||
// confirms the SSL/TLS tab is not present | ||
cy.findByText('SSL/TLS').should('not.exist'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters