Skip to content

Commit

Permalink
Fix cypress test after UI change (#96)
Browse files Browse the repository at this point in the history
* fix test

* upgrade cypress
  • Loading branch information
itailiors committed May 17, 2024
1 parent a8bb6e2 commit 4486df3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"js-base64": "^3.7.7"
},
"devDependencies": {
"cypress": "^13.8.1"
"cypress": "^13.9.0"
}
}
6 changes: 3 additions & 3 deletions src/Angor/Client/Pages/Browse.razor
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ else

@if (isGridView)
{
<div class="row row-cols-1 row-cols-sm-1 row-cols-md-2 row-cols-lg-3 project-wrapper">
<div class="row row-cols-1 row-cols-sm-1 row-cols-md-2 row-cols-lg-3 project-wrapper" data-cy="project-grid">
@foreach (var indexerData in projects.OrderByDescending(project => project.CreatedOnBlock))
{
<div class="col d-flex align-items-stretch">
Expand Down Expand Up @@ -101,8 +101,8 @@ else
var project = SessionStorage.GetProjectById(indexerData.ProjectIdentifier);
if (project?.Metadata != null)
{
<h5 role="button" @onclick="() => ViewProjectDetails(indexerData.ProjectIdentifier)">@project.Metadata.Name</h5>
<p class="mb-0 line-clamp-3">@((MarkupString)project.Metadata.About)</p>
<h5 role="button" data-cy="searchedTitle" @onclick="() => ViewProjectDetails(indexerData.ProjectIdentifier)">@project.Metadata.Name</h5>
<p class="mb-0 line-clamp-3" data-cy="searchedSubTitle"> @((MarkupString)project.Metadata.About)</p>
}
}
else
Expand Down
11 changes: 4 additions & 7 deletions src/Testing/e2e/browse.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ describe("browseProjectsSpec", { retries: 3 }, () => {
"npub1upnev99qsx4haf0yq8jtkny8yr45c94yw42g7rkdgr4ewgv3sh2shmuxnk";
it("browseBasic", () => {
cy.clickOnNavBar(Navbar.BROWSE);
cy.get(`[data-cy=${BROWSE_DATA_CY.PROJECT_GRID}]`).contains(
ERROR_MESSAGES.NO_PROJECTS_FOUND
);
cy.clickElementWithDataCy(BROWSE_DATA_CY.FIND_BUTTON);
cy.searchProject({ msg: "This project does not exist" });
cy.get(`[data-cy=${BROWSE_DATA_CY.SEARCHED_PROJECT}]`).should("not.exist");
// cy.get(`[data-cy=${BROWSE_DATA_CY.SEARCHED_PROJECT}]`).should("not.exist"); 'project-grid'
cy.get(`[data-cy=project-grid]`).should("not.exist");
cy.searchProject({ msg: testId, clear: true });

cy.waitForLoader();
const searchedProject = cy.get(
`[data-cy=${BROWSE_DATA_CY.SEARCHED_PROJECT}]`
`[data-cy=project-grid]`
);
// Verify project title
cy.verifyTextInDataCyWithExistElement(
Expand All @@ -37,7 +35,6 @@ describe("browseProjectsSpec", { retries: 3 }, () => {
"This project is dedicated to testing various functionalities and features."
);
// Verify Project MetaData
cy.verifyTextInDataCy(BROWSE_DATA_CY.PROJECT_INFO, testId);
cy.verifyTextInDataCy(BROWSE_DATA_CY.PROJECT_INFO, testNostrId);
cy.clickElementWithDataCy(BROWSE_DATA_CY.SEARCHED_TITLE)
});
});
2 changes: 1 addition & 1 deletion src/Testing/support/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const BROWSE_DATA_CY = {
SEARCHED_PROJECT: "searchedProject",
SEARCHED_TITLE: "searchedTitle",
SEARCHED_SUB_TITLE: "searchedSubTitle",
PROJECT_INFO: "project-info",
// PROJECT_INFO: "project-info", removed for now
PROJECT_GRID: "projectsGrid",
};

Expand Down

0 comments on commit 4486df3

Please sign in to comment.