2022-12-15 07:39:59 -08:00
|
|
|
import { BasePage } from './base';
|
2022-11-22 01:37:26 -08:00
|
|
|
|
|
|
|
export class CredentialsPage extends BasePage {
|
2024-05-17 01:53:15 -07:00
|
|
|
url = '/home/credentials';
|
2024-06-10 06:49:50 -07:00
|
|
|
|
2022-11-22 01:37:26 -08:00
|
|
|
getters = {
|
|
|
|
emptyListCreateCredentialButton: () => cy.getByTestId('empty-resources-list').find('button'),
|
2024-11-13 07:21:49 -08:00
|
|
|
createCredentialButton: () => {
|
|
|
|
cy.getByTestId('resource-add').should('be.visible').click();
|
2024-11-14 01:28:55 -08:00
|
|
|
cy.getByTestId('resource-add')
|
|
|
|
.find('.el-sub-menu__title')
|
|
|
|
.invoke('attr', 'aria-describedby')
|
|
|
|
.then((el) => cy.get(`[id="${el}"]`))
|
|
|
|
.as('submenu');
|
2024-11-13 07:21:49 -08:00
|
|
|
|
2024-11-14 01:28:55 -08:00
|
|
|
cy.get('@submenu').within((submenu) => {
|
|
|
|
cy.wrap(submenu)
|
|
|
|
.find('[data-test-id="navigation-submenu"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.filter(':contains("Credential")')
|
|
|
|
.as('child')
|
|
|
|
.click();
|
2024-11-13 07:21:49 -08:00
|
|
|
|
2024-11-14 01:28:55 -08:00
|
|
|
cy.get('@child')
|
|
|
|
.find('[data-test-id="navigation-submenu-item"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.filter(':contains("Personal")')
|
|
|
|
.as('button');
|
|
|
|
});
|
2024-11-13 07:21:49 -08:00
|
|
|
|
2024-11-14 01:28:55 -08:00
|
|
|
return cy.get('@button');
|
2024-11-13 07:21:49 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
// cy.getByTestId('resources-list-add'),
|
2023-07-28 00:51:07 -07:00
|
|
|
searchInput: () => cy.getByTestId('resources-list-search'),
|
2022-11-28 02:11:39 -08:00
|
|
|
emptyList: () => cy.getByTestId('resources-list-empty'),
|
|
|
|
credentialCards: () => cy.getByTestId('resources-list-item'),
|
2022-12-15 07:39:59 -08:00
|
|
|
credentialCard: (credentialName: string) =>
|
|
|
|
this.getters
|
|
|
|
.credentialCards()
|
|
|
|
.contains(credentialName)
|
|
|
|
.parents('[data-test-id="resources-list-item"]'),
|
|
|
|
credentialCardActions: (credentialName: string) =>
|
|
|
|
this.getters.credentialCard(credentialName).findChildByTestId('credential-card-actions'),
|
|
|
|
credentialDeleteButton: () =>
|
|
|
|
cy.getByTestId('action-toggle-dropdown').filter(':visible').contains('Delete'),
|
2024-06-11 05:21:16 -07:00
|
|
|
credentialMoveButton: () =>
|
|
|
|
cy.getByTestId('action-toggle-dropdown').filter(':visible').contains('Move'),
|
2023-07-28 00:51:07 -07:00
|
|
|
sort: () => cy.getByTestId('resources-list-sort').first(),
|
2023-08-16 08:13:57 -07:00
|
|
|
sortOption: (label: string) =>
|
|
|
|
cy.getByTestId('resources-list-sort-item').contains(label).first(),
|
2022-11-28 02:11:39 -08:00
|
|
|
filtersTrigger: () => cy.getByTestId('resources-list-filters-trigger'),
|
|
|
|
filtersDropdown: () => cy.getByTestId('resources-list-filters-dropdown'),
|
|
|
|
};
|
2024-06-10 06:49:50 -07:00
|
|
|
|
2022-11-28 02:11:39 -08:00
|
|
|
actions = {
|
|
|
|
search: (searchString: string) => {
|
|
|
|
const searchInput = this.getters.searchInput();
|
|
|
|
searchInput.clear();
|
|
|
|
|
|
|
|
if (searchString) {
|
|
|
|
searchInput.type(searchString);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
sortBy: (type: 'nameAsc' | 'nameDesc' | 'lastUpdated' | 'lastCreated') => {
|
|
|
|
const sortTypes = {
|
|
|
|
nameAsc: 'Sort by name (A-Z)',
|
|
|
|
nameDesc: 'Sort by name (Z-A)',
|
|
|
|
lastUpdated: 'Sort by last updated',
|
|
|
|
lastCreated: 'Sort by last created',
|
|
|
|
};
|
|
|
|
|
|
|
|
this.getters.sort().click();
|
|
|
|
this.getters.sortOption(sortTypes[type]).click();
|
|
|
|
},
|
2022-11-22 01:37:26 -08:00
|
|
|
};
|
|
|
|
}
|