Skip to content

Commit

Permalink
cy.openHeaderKebab - and scroll to top first
Browse files Browse the repository at this point in the history
  • Loading branch information
himdel committed Nov 30, 2023
1 parent 0e53440 commit 0e32cf0
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 14 deletions.
8 changes: 4 additions & 4 deletions test/cypress/e2e/collections/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('collection tests', () => {

cy.visit(`${uiPrefix}repo/published/test_namespace/test_collection`);

cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.get('[data-cy=delete-collection]').click();
cy.get('input[id=delete_confirm]').click();
cy.get('button').contains('Delete').click();
Expand All @@ -41,7 +41,7 @@ describe('collection tests', () => {
cy.get(
`a[href*="${uiPrefix}repo/published/my_namespace/my_collection"]`,
).click();
cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.get('[data-cy=delete-collection-version]').click();
cy.get('input[id=delete_confirm]').click();
cy.get('button').contains('Delete').click();
Expand All @@ -62,7 +62,7 @@ describe('collection tests', () => {
cy.galaxykit('task wait all');
cy.visit(`${uiPrefix}repo/published/${namespace}/${collection}`);

cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.get(
'[data-cy="copy-collection-version-to-repository-dropdown"]',
).click();
Expand Down Expand Up @@ -156,7 +156,7 @@ describe('collection tests', () => {
`${uiPrefix}repo/repo2/test_namespace/test_repo_collection_version2/?version=1.0.0`,
);

cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.contains('Remove version 1.0.0 from repository').click();
cy.get('input[id=delete_confirm]').click();
cy.get('button').contains('Delete').click();
Expand Down
4 changes: 2 additions & 2 deletions test/cypress/e2e/collections/collection_detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ describe('Collection detail', () => {
const baseURL = `${uiPrefix}repo/published/collection_detail_test_namespace/collection_detail_test_collection`;

function deprecate() {
cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.contains('Deprecate').click();
cy.contains('This collection has been deprecated.', { timeout: 10000 });
}

function undeprecate() {
cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.contains('Undeprecate').click();
cy.contains('This collection has been deprecated.', {
timeout: 10000,
Expand Down
2 changes: 1 addition & 1 deletion test/cypress/e2e/collections/collection_upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('Collection Upload Tests', () => {
cy.login();
cy.visit(`${uiPrefix}repo/published/testspace/testcollection`);
cy.contains('testcollection');
cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.contains('Upload new version').click();
cy.contains('New version of testspace.testcollection');
});
Expand Down
2 changes: 1 addition & 1 deletion test/cypress/e2e/collections/collections_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Collections list Tests', () => {
function undeprecate() {
cy.visit(`${uiPrefix}repo/published/my_namespace/my_collection0`);
cy.contains('This collection has been deprecated.');
cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.contains('Undeprecate').click();
cy.contains('This collection has been deprecated.', {
timeout: 10000,
Expand Down
4 changes: 2 additions & 2 deletions test/cypress/e2e/insights_collections/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('collection tests', () => {

cy.visit(`${uiPrefix}repo/published/test_namespace/test_collection`);

cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.get('[data-cy=delete-collection]').click();
cy.get('input[id=delete_confirm]').click();
cy.get('button').contains('Delete').click();
Expand All @@ -36,7 +36,7 @@ describe('collection tests', () => {
cy.get(
`a[href*="${uiPrefix}repo/published/my_namespace/my_collection"]`,
).click();
cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.get('[data-cy=delete-collection-version]').click();
cy.get('input[id=delete_confirm]').click();
cy.get('button').contains('Delete').click();
Expand Down
4 changes: 2 additions & 2 deletions test/cypress/e2e/insights_collections/collection_detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ describe('Collection detail', () => {
const baseURL = `${uiPrefix}repo/published/collection_detail_test_namespace/collection_detail_test_collection`;

function deprecate() {
cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.contains('Deprecate').click();
cy.contains('This collection has been deprecated.', { timeout: 10000 });
}

function undeprecate() {
cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.contains('Undeprecate').click();
cy.contains('This collection has been deprecated.', {
timeout: 10000,
Expand Down
2 changes: 1 addition & 1 deletion test/cypress/e2e/insights_collections/collections_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Collections list Tests', () => {
function undeprecate() {
cy.visit(`${uiPrefix}repo/published/my_namespace/my_collection0`);
cy.contains('This collection has been deprecated.');
cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.contains('Undeprecate').click();
cy.contains('This collection has been deprecated.', {
timeout: 10000,
Expand Down
2 changes: 1 addition & 1 deletion test/cypress/e2e/misc/rbac.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ describe('RBAC test for user with permissions', () => {
cy.visit(`${uiPrefix}repo/published/testspace2/testcollection2`);

// can Delete collection
cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
cy.openHeaderKebab();
cy.contains('Delete collection from system');
});

Expand Down
5 changes: 5 additions & 0 deletions test/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ Cypress.Commands.add('assertTitle', {}, (title) => {
cy.contains('.pf-c-title', title);
});

Cypress.Commands.add('openHeaderKebab', {}, () => {
cy.scrollTo(0, 0);
cy.get('[data-cy="kebab-toggle"] [aria-label="Actions"]').click();
});

Cypress.Commands.add(
'createUser',
{},
Expand Down

0 comments on commit 0e32cf0

Please sign in to comment.