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

VACMS-15903: Wait for alert type dropdown to appear. #15904

Merged
merged 2 commits into from
Oct 30, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
Feature: Content Type: VAMC Operating Status

Scenario: Log in and confirm that System-wide alerts can be created and edited
When I am logged in as a user with the "content_admin" role
Given I am logged in as a user with the "content_admin" role
And I unlock node 1010

# Create our initial draft
# We need to target an existing node
# ("Operating status - VA Pittsburgh health care")
# to prevent unique validation failure.
Then I am at "node/1010/edit"
When I am at "node/1010/edit"
And I click the "Add new banner alert" button
And I wait for an element with the selector 'select[data-drupal-selector^="edit-field-banner-alert-form"]' to exist
When I scroll to element 'select[data-drupal-selector^="edit-field-banner-alert-form"]'
And I select option "Information" from dropdown "Alert type"
And I fill in "Title" with "[Test Data] Alert Title"
And I fill in ckeditor "field-body-0-value" with "[Test Data] Alert Body"
Expand Down
19 changes: 19 additions & 0 deletions tests/cypress/integration/step_definitions/common/should_exist.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("an element with the selector {string} should exist", (selector) =>
cy.get(selector).should("exist")
);

Then("I wait for an element with the selector {string} to exist", (selector) =>
cy
.get(selector, {
timeout: 30000,
})
.should("exist")
);

Then(
"I wait for an element with the selector {string} to not exist",
(selector) =>
cy
.get(selector, {
timeout: 30000,
})
.should("not.exist")
);

Then("an element with the selector {string} should not exist", (selector) =>
cy.get(selector).should("not.exist")
);
Expand Down
4 changes: 3 additions & 1 deletion tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ Cypress.Commands.add("scrollToSelector", (selector) => {
if (htmlElement) {
htmlElement.style.scrollBehavior = "inherit";
}
cy.get(selector).scrollIntoView({ offset: { top: 0 } });
cy.get(selector)
.first()
.scrollIntoView({ offset: { top: 0 } });
return cy.get(selector);
});
});
Expand Down
Loading