-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
test: Skipping test becasuea of an open Issue[RestAPIDatasrouce spec] #37354
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,13 +13,24 @@ describe( | |
function () { | ||
it("1. Create a rest datasource + Bug 14566", function () { | ||
apiPage.CreateAndFillApi(testdata.baseUrl + testdata.methods); | ||
cy.get(".t--store-as-datasource").click(); | ||
agHelper.WaitUntilEleAppear(apiPage._saveAsDS); | ||
cy.get(apiPage._saveAsDS).click({ force: true }); | ||
//verifying there is no error toast, Bug 14566 | ||
agHelper.AssertElementAbsence( | ||
locators._specificToast("Duplicate key error"), | ||
); //verifying there is no error toast, Bug 14566 | ||
); | ||
cy.testSelfSignedCertificateSettingsInREST(false); | ||
cy.get("body").then((body) => { | ||
if ( | ||
body.find('[value="http://host.docker.internal:5001"]').length < 1 | ||
) { | ||
cy.get('[placeholder="https://example.com"]').type( | ||
"http://host.docker.internal:5001", | ||
); | ||
} | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Multiple violations of Cypress best practices
-cy.get("body").then((body) => {
- if (body.find('[value="http://host.docker.internal:5001"]').length < 1) {
- cy.get('[placeholder="https://example.com"]').type(
- "http://host.docker.internal:5001",
- );
- }
-});
+const TEST_URL = testdata.restApiUrl;
+cy.get(apiPage._urlInputField)
+ .should('exist')
+ .then(($el) => {
+ if ($el.val() !== TEST_URL) {
+ cy.get(apiPage._urlInputField).type(TEST_URL);
+ }
+ }); Also, update the testdata.json to include: {
"restApiUrl": "http://host.docker.internal:5001"
} |
||
cy.saveDatasource(); | ||
cy.contains(".datasource-highlight", "http://host.docker.internal:5001"); //failing here since Save as Datasource is broken | ||
cy.contains(".datasource-highlight", "http://host.docker.internal:5001"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Use data attributes and avoid hardcoded values Replace class selector with data attribute and use the URL from test data. -cy.contains(".datasource-highlight", "http://host.docker.internal:5001");
+cy.get(apiPage._datasourceURLHighlight)
+ .should('contain', testdata.restApiUrl);
|
||
cy.SaveAndRunAPI(); | ||
}); | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid using force: true in click operations
Replace the force click with proper element state verification:
📝 Committable suggestion