Skip to content

Commit

Permalink
cleanup unnecessary command
Browse files Browse the repository at this point in the history
  • Loading branch information
Šimon Macek committed Jun 27, 2024
1 parent 4c17941 commit 4969dce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 29 deletions.
3 changes: 2 additions & 1 deletion src/components/homepage/BannerRoutes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ export default defineComponent({
>
<!-- Plus icon -->
<q-icon
name="add"
name="mdi-plus"
size="24px"
color="white"
class="q-mr-sm"
style="flex-shrink: 0"
data-cy="banner-routes-button-icon"
/>
<!-- Button text -->
Expand Down
45 changes: 17 additions & 28 deletions test/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,6 @@ Cypress.Commands.add('setDPR', (dpr) => {
});
});

/**
* Custom waitForFonts command that waits for all fonts to be loaded.
* Used in combination with `waitForStylesheets` in `testIcon` command.
*/
Cypress.Commands.add('waitForFonts', () => {
cy.document().then((document) => {
document.fonts.ready.then(() => {
cy.log('All fonts loaded');
});
});
});

/**
* Custom waitForStylesheets command that waits for all stylesheets to be loaded
* Used in combination with `waitForFonts` in `testIcon` command.
Expand Down Expand Up @@ -175,22 +163,23 @@ Cypress.Commands.add('testIcon', ({ element, name, size }) => {
cy.clock(now);
// set DPR and wait for resources (to avoid empty snapshot)
cy.setDPR(1);
cy.waitForFonts();
cy.waitForStylesheets();
// remove scrollbar
cy.wrap(element[0]).invoke('attr', 'style', 'overflow: hidden');
// size
cy.wrap(element[0]).invoke('width').should('eq', size);
cy.wrap(element[0]).invoke('height').should('eq', size);
// snapshot
cy.wrap(element[0]).matchImageSnapshot(name, {
failureThreshold: 0.1,
failureThresholdType: 'percent',
timeout: 1000,
customDiffConfig: { threshold: 0.4 },
screenshotsFolder: 'test/cypress/snapshots',
retries: 2,
});

cy.document()
.then(() => cy.waitForStylesheets())
.then(() => {
// size
cy.wrap(element[0]).invoke('width').should('eq', size);
cy.wrap(element[0]).invoke('height').should('eq', size);
// snapshot
cy.wrap(element[0]).matchImageSnapshot(name, {
failureThreshold: 0.1,
failureThresholdType: 'percent',
timeout: 1000,
customDiffConfig: { threshold: 0.4 },
screenshotsFolder: 'test/cypress/snapshots',
retries: 2,
});
});
});

Cypress.Commands.add('testMessageLanguageSelect', (i18n) => {
Expand Down

0 comments on commit 4969dce

Please sign in to comment.