Skip to content

Commit

Permalink
Fix ui tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LiamMorrow committed Jul 24, 2024
1 parent 9097bf6 commit 3f20c60
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions LiftLog.Cypress/cypress/e2e/completing-a-session.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ describe('Completing a session', () => {

cy.contains('Finish').click()

cy.getA('.itemlist .item').first('.item').first().should('contain.text', 'Workout B')
cy.getA('[data-cy=session-summary-title]').should('contain.text', 'Workout B')

cy.navigate('History')

cy.getA('.itemlist .item').first('.item').first('.card').should('contain.text', 'Workout A').click()
cy.getA('[data-cy=session-summary-title]').should('contain.text', 'Workout A').click()

cy.getA('md-filled-text-field[type=date]').get('input', { includeShadowDom: true }).first().click().type('2023-05-22')

Expand All @@ -84,7 +84,7 @@ describe('Completing a session', () => {
cy.getA('[data-cy=calendar-nav-previous-month]').first().click()
}, 200)

cy.getA('.itemlist .item').first('.item').first().should('contain.text', 'Workout A').should('contain.text', '22 May 2023')
cy.getA('[data-cy=session-summary-title]').should('contain.text', 'Workout A').should('contain.text', '22 May 2023')
})

it('can complete a workout while switching to per set weights with it progressing properly', () => {
Expand Down Expand Up @@ -126,10 +126,10 @@ describe('Completing a session', () => {
cy.getA('.snackbar').should('be.visible').should('contain.text', 'This session').should('contain.text', '650')
cy.contains('Finish').click()

cy.getA('.itemlist .item').eq(0).should('contain.text', 'Workout B')
cy.getA('.itemlist .item').eq(1).should('contain.text', 'Workout A').click()
cy.getA('[data-cy=session-summary-title]').eq(0).should('contain.text', 'Workout B')
cy.getA('[data-cy=session-summary-title]').eq(1).should('contain.text', 'Workout A').click()

cy.getA('.itemlist div').eq(0).should('contain.text', 'Squat')
cy.getA('[data-cy=weighted-exercise]').eq(0).should('contain.text', 'Squat')
// Since all sets were completed - with at least one of the sets having equal or higher weight than the top level, the weight should have increased
cy.getA('[data-cy=weight-display]').first().should('contain.text', '15kg')
})
Expand All @@ -147,7 +147,7 @@ describe('Completing a session', () => {

cy.navigate('History')

cy.getA('.itemlist .item').first('.item').should('contain.text', 'Workout A').click()
cy.getA('[data-cy=session-summary-title]').first().should('contain.text', 'Workout A').click()

cy.getA('[data-cy=more-exercise-btn]').first().click()
cy.getA('[data-cy=exercise-notes-btn]').first().click()
Expand Down
6 changes: 3 additions & 3 deletions LiftLog.Cypress/cypress/e2e/settings.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function assertShowsBodyweightOnAllPages(shouldShow) {
cy.getA('.card').eq(4).should(classify, 'Bodyweight')
cy.navigate('Workout')
cy.navigate('Workout')
cy.getA('.itemlist .item').first().click()
cy.getA('[data-cy=session-summary]').first().click()
if (shouldShow) {
cy.getA('.card').last().should(classify, 'Bodyweight')
} else {
Expand All @@ -70,14 +70,14 @@ function assertCorrectWeightUnitsOnAllPages(units) {
}
cy.getA('[data-cy=calendar-nav-previous-month]').first().click()
}, 200)
cy.getA('.itemlist .item').first().should('contain.text', units)
cy.getA('[data-cy=session-summary]').first().should('contain.text', units)
cy.navigate('Stats')
cy.getA('[data-cy=stats-time-selector]').click()
cy.containsA('All time').click()
cy.getA('.cardlist .card').first().should('contain.text', units)
cy.navigate('Workout')
cy.navigate('Workout')
cy.getA('.itemlist .item').first().should('contain.text', units).click()
cy.getA('[data-cy=session-summary]').first().should('contain.text', units).click()
cy.getA('[data-cy=weight-display]').first().should('contain.text', units).click()
cy.dialog().find('md-outlined-text-field').get('.suffix', { includeShadowDom: true }).should('contain.text', units)
cy.dialog().find('[slot=actions]').contains("Close").click()
Expand Down
2 changes: 1 addition & 1 deletion LiftLog.Ui/Shared/Presentation/SessionSummary.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

<div class="grid @GridRows gap-x-4 text-start">
<div class="grid @GridRows gap-x-4 text-start" data-cy="session-summary">
@foreach (var exercise in Session.RecordedExercises)
{
<span>@exercise.Blueprint.Name</span>
Expand Down
2 changes: 1 addition & 1 deletion LiftLog.Ui/Shared/Presentation/SessionSummaryTitle.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@using System.Globalization

<div class="flex flex-col flex-shrink items-start text-ellipsis overflow-hidden" >
<div class="flex flex-col flex-shrink items-start text-ellipsis overflow-hidden" data-cy="session-summary-title" >
<ItemTitle Title="@Session.Blueprint.Name" />
@if (IsFilled)
{
Expand Down
2 changes: 1 addition & 1 deletion LiftLog.Ui/Shared/Presentation/WeightedExercise.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var thisNotes = RecordedExercise.Notes ?? "";
var blueprintNotes = RecordedExercise.Blueprint.Notes;
}
<div class="flex flex-col gap-4 py-4 pl-7 pr-2 w-full">
<div class="flex flex-col gap-4 py-4 pl-7 pr-2 w-full" data-cy="weighted-exercise">
<div class="flex flex-col">
<div class="flex justify-between">
<ItemTitle Title="@RecordedExercise.Blueprint.Name" />
Expand Down

0 comments on commit 3f20c60

Please sign in to comment.