Skip to content

Commit

Permalink
chore: test fix (#214)
Browse files Browse the repository at this point in the history
* chore: test fix
  • Loading branch information
samuelOsborne authored Jun 8, 2023
1 parent 6c74717 commit 2a306c8
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/khaki-deers-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lottiefiles/lottie-player': patch
---

fixes tests
5 changes: 3 additions & 2 deletions cypress/component/autoplay.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe('Autoplay', () => {
`,
);

cy.wait(1000);
cy.get('[name="currentState"]').should('have.value', PlayerState.Playing);
});

Expand All @@ -39,7 +40,7 @@ describe('Autoplay', () => {
`,
);

cy.wait(1);
cy.wait(1000);
cy.get('[name="currentState"]').should('have.value', PlayerState.Ready);
cy.get('[name="currentState"]').should('not.have.value', PlayerState.Playing);
});
Expand All @@ -60,7 +61,7 @@ describe('Autoplay', () => {
`,
);

cy.wait(1);
cy.wait(1000);
cy.get('[name="currentState"]').should('have.value', PlayerState.Ready);
cy.get('[name="currentState"]').should('not.have.value', PlayerState.Playing);
});
Expand Down
1 change: 1 addition & 0 deletions cypress/component/background.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('Background', () => {
`,
);

cy.wait(1000);
cy.get('[data-testid="testPlayer"]')
.shadow()
.find('.animation')
Expand Down
3 changes: 3 additions & 0 deletions cypress/component/direction.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('Direction', () => {
`,
);

cy.wait(1000);
cy.get('[name="direction"]').should('have.value', 1);
});

Expand All @@ -40,6 +41,7 @@ describe('Direction', () => {
`,
);

cy.wait(1000);
cy.get('[name="direction"]').should('have.value', 1);
});

Expand All @@ -59,6 +61,7 @@ describe('Direction', () => {
`,
);

cy.wait(1000);
cy.get('[name="direction"]').should('have.value', '-1');
});
});
5 changes: 3 additions & 2 deletions cypress/component/hover.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('Hover', () => {
`,
);

cy.wait(1000);
cy.get('[name="hover"]').should('have.value', 'false');
});

Expand All @@ -41,7 +42,7 @@ describe('Hover', () => {
`,
);

cy.wait(3000);
cy.wait(1000);
cy.get('[name="hover"]').should('have.value', 'true');
cy.get('[name="currentState"]').should('have.value', PlayerState.Ready);
cy.get('[name="currentState"]').should('not.have.value', PlayerState.Playing);
Expand All @@ -63,7 +64,7 @@ describe('Hover', () => {
`,
);

cy.wait(1);
cy.wait(1000);
cy.get('[name="currentState"]').should('not.have.value', PlayerState.Playing);

cy.get('[data-testid="testPlayer"]').shadow().find('#animation > *').trigger('mouseenter');
Expand Down
2 changes: 2 additions & 0 deletions cypress/component/intermission.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('Intermission', () => {
`,
);

cy.wait(1000);
cy.get('[name="intermission"]').should('have.value', 0);
});

Expand All @@ -40,6 +41,7 @@ describe('Intermission', () => {
`,
);

cy.wait(1000);
cy.get('[name="intermission"]').should('have.value', 1000);
});
});
3 changes: 3 additions & 0 deletions cypress/component/loop.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe('Loop', () => {
`,
);

cy.wait(1000);
cy.get('[name="loop"]').should('have.value', 'false');
});

Expand All @@ -38,6 +39,7 @@ describe('Loop', () => {
`,
);

cy.wait(1000);
cy.get('[name="loop"]').should('have.value', 'true');
});

Expand All @@ -57,6 +59,7 @@ describe('Loop', () => {
`,
);

cy.wait(1000);
cy.get('[name="count"]').should('have.value', 3);
});
});
3 changes: 3 additions & 0 deletions cypress/component/mode.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('Mode', () => {
`,
);

cy.wait(1000);
cy.get('[name="playMode"]').should('have.value', PlayMode.Normal);
});

Expand All @@ -39,6 +40,7 @@ describe('Mode', () => {
`,
);

cy.wait(1000);
cy.get('[name="playMode"]').should('have.value', PlayMode.Bounce);
});

Expand All @@ -57,6 +59,7 @@ describe('Mode', () => {
`,
);

cy.wait(1000);
cy.get('[name="playMode"]').should('have.value', PlayMode.Normal);
});
});
7 changes: 6 additions & 1 deletion cypress/component/player-controls.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('Controls', () => {
`,
);

cy.wait(1000);
cy.get('[data-testid="testPlayer"]').shadow().find('[aria-label="lottie-animation-controls"]').should('not.exist');
});

Expand All @@ -39,6 +40,7 @@ describe('Controls', () => {
`,
);

cy.wait(1000);
cy.get('[data-testid="testPlayer"]').shadow().find('[aria-label="lottie-animation-controls"]').should('exist');
});

Expand All @@ -56,7 +58,7 @@ describe('Controls', () => {
`,
);

cy.wait(3000);
cy.wait(1000);
// Not playing initially
cy.get('[name="currentState"]').should('have.value', PlayerState.Ready);

Expand All @@ -79,6 +81,7 @@ describe('Controls', () => {
`,
);

cy.wait(1000);
// Playing initially
cy.get('[name="currentState"]').should('have.value', PlayerState.Playing);

Expand All @@ -101,6 +104,7 @@ describe('Controls', () => {
`,
);

cy.wait(1000);
// Playing initially
cy.get('[name="currentState"]').should('have.value', PlayerState.Playing);

Expand All @@ -123,6 +127,7 @@ describe('Controls', () => {
`,
);

cy.wait(1000);
cy.get('[name="currentState"]').should('have.value', PlayerState.Playing);

// Loop is true initially
Expand Down
6 changes: 4 additions & 2 deletions cypress/component/player.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('Player', () => {
`,
);

cy.wait(1000);
cy.get('[data-testid="testPlayer"]').shadow().find('#animation').should('exist');
});

Expand All @@ -40,7 +41,7 @@ describe('Player', () => {
`,
);

cy.wait(3000);
cy.wait(1000);
cy.get('[name="currentState"]').should('have.value', PlayerState.Playing);
});

Expand All @@ -53,7 +54,8 @@ describe('Player', () => {
`,
);

cy.get('[name="currentState"]').should('have.value', PlayerState.Error);
cy.wait(1000);
cy.get('[name="currentState"]').should('have.value', PlayerState.Error);
cy.get('[data-testid="testPlayer"]').shadow().find('.error').should('exist');
} catch (error) {

Expand Down
2 changes: 2 additions & 0 deletions cypress/component/speed.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('Speed', () => {
`,
);

cy.wait(1000);
cy.get('[name="speed"]').should('have.value', 1);
});

Expand All @@ -40,6 +41,7 @@ describe('Speed', () => {
`,
);

cy.wait(1000);
cy.get('[name="speed"]').should('have.value', 2);
});
});

0 comments on commit 2a306c8

Please sign in to comment.