Skip to content

Commit

Permalink
chore(cypress): add first Cypress real test
Browse files Browse the repository at this point in the history
Validate if primary forest loss on Indonesia dashboard is an image instead a real widget.
Reference #4593
  • Loading branch information
willian-viana committed Sep 22, 2023
1 parent a992318 commit 898cae4
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cypress/e2e/features/_example.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Feature: duckduckgo.com
Scenario: visiting the frontpage
When I visit duckduckgo.com
Then I should see a search bar
13 changes: 13 additions & 0 deletions cypress/e2e/features/_example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { When, Then } from '@badeball/cypress-cucumber-preprocessor';

When('I visit duckduckgo.com', () => {
cy.visit('https://www.duckduckgo.com');
});

Then('I should see a search bar', () => {
cy.get('input#searchbox_input').should(
'have.attr',
'placeholder',
'Search the web without being tracked'
);
});
5 changes: 5 additions & 0 deletions cypress/e2e/features/indonesia-tcl.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Feature: Indonesia TCL Image
Scenario: Indonesia Dashboard should show an image instead the real Primay Forest Loss Widget
When I visit Dashboard
And I select Indonesia
Then I should see an image of Indonesia Primary Forest Loss
17 changes: 17 additions & 0 deletions cypress/e2e/features/indonesia-tcl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { When, Then } from '@badeball/cypress-cucumber-preprocessor';
import {
goToDashboardFromHome,
selectCountryOnDashboard,
} from '../../api/navigation-api';

When('I visit Dashboard', () => {
goToDashboardFromHome();
});

When('I select Indonesia', () => {
selectCountryOnDashboard('Indonesia');
});

Then('I should see an image of Indonesia Primary Forest Loss', () => {
cy.get('[data-cy="indonesia-img"').should('exist');
});

0 comments on commit 898cae4

Please sign in to comment.