-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from UdL-EPS-SoftArch/33-create-cypress-coordi…
…nate cypress coordinate
- Loading branch information
Showing
9 changed files
with
162 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Feature: Create Coordinate | ||
In order to use the app | ||
As admin | ||
I want to create a coordinate | ||
|
||
Scenario: Create a new coordinate | ||
Given I'm in the homepage logged in as an admin | ||
When I go to the coordinate list page | ||
And I click on add coordinte button | ||
And I fill the form with | ||
| FIELD | VALUE | | ||
| coordinate | 41.40338,2.17403 | | ||
And I click the "Create" button | ||
Then I am redirected to the coordinate detail page | ||
|
||
|
||
Scenario: Create a new incorrect coordinate | ||
Given I'm in the homepage logged in as an admin | ||
When I go to the coordinate list page | ||
And I click on add coordinte button | ||
And I fill the form with | ||
| FIELD | VALUE | | ||
| coordinate | 300.40338,2.17403 | | ||
Then Create button should be disabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Feature: Delete Coordinate | ||
In order to use the app | ||
As admin | ||
I want to delete a coordinate | ||
|
||
Scenario: Delete a new coordinate | ||
Given I'm in the homepage logged in as an admin | ||
And I go to the coordinate list page | ||
And I click on add coordinte button | ||
And I fill the form with | ||
| FIELD | VALUE | | ||
| coordinate | 41.40338,2.17403 | | ||
And I click the "Create" button | ||
And I am redirected to the coordinate detail page | ||
When I click the "Delete" button | ||
Then I am redirected to the coordinate delete page | ||
And I click the "Delete" button | ||
Then I am redirected to the coordinate list page | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Feature: Modify Coordinate | ||
In order to use the app | ||
As admin | ||
I want to modify a coordinate | ||
|
||
Scenario: Modify a new coordinate | ||
Given I'm in the homepage logged in as an admin | ||
And I go to the coordinate list page | ||
And I click on add coordinte button | ||
And I fill the form with | ||
| FIELD | VALUE | | ||
| coordinate | 41.40338,2.17403 | | ||
And I click the "Create" button | ||
And I am redirected to the coordinate detail page | ||
And I click the "Edit" button | ||
And I am redirected to the coordinate edit page | ||
When I clear and fill the form with | ||
| FIELD | VALUE | | ||
| coordinate | 42.40338,3.17403 | | ||
And I click the "Update" button | ||
Then I am redirected to the coordinate detail page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Feature: Read Coordinate | ||
In order to use the app | ||
As admin | ||
I want to read a coordinate | ||
|
||
Scenario: Modify a new coordinate | ||
Given I'm in the homepage logged in as an admin | ||
And I go to the coordinate list page | ||
And I click on add coordinte button | ||
And I fill the form with | ||
| FIELD | VALUE | | ||
| coordinate | 41.40338,2.17403 | | ||
And I click the "Create" button | ||
And I am redirected to the coordinate detail page | ||
And I go to the coordinate list page | ||
When I click the "View" button | ||
Then I am redirected to the coordinate detail page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import {DataTable} from '@cucumber/cucumber'; | ||
import {Given, Then, When} from 'cypress-cucumber-preprocessor/steps'; | ||
|
||
Given(/^I'm in the homepage logged in as an admin$/, function () { | ||
cy.visit('http://localhost:4200'); | ||
cy.get('.nav-link').contains('Login').click(); | ||
cy.get('#username').type('root').blur(); | ||
cy.get('#password').type('password').blur(); | ||
cy.get('button').contains('Submit').click(); | ||
}); | ||
When(/^I go to the coordinate detail page$/, function () { | ||
cy.get('.nav-link').contains('Coordinate').click(); | ||
cy.get('.dropdown-item.coordinateListNavbar').click(); | ||
}); | ||
When(/^I click on add coordinte button$/, function () { | ||
cy.get('.createCoordinateBtn').click(); | ||
}); | ||
Then(/^Create button should be disabled$/, function () { | ||
cy.get('button').contains('Create').should('be.disabled'); | ||
}); | ||
Given(/^I'm in the homepage logged in as an user$/, function () { | ||
cy.visit('http://localhost:4200'); | ||
cy.get('.nav-link').contains('Login').click(); | ||
cy.get('#username').type('demo').blur(); | ||
cy.get('#password').type('password').blur(); | ||
cy.get('button').contains('Submit').click(); | ||
}); | ||
Then(/^I should not see the seed create button$/, function () { | ||
cy.get('#createSeed').should('not.exist'); | ||
}); | ||
When(/^I fill the form with$/, function (table: DataTable) { | ||
table.rows().forEach((pair: string[]) => | ||
cy | ||
.get('#' + pair[0]) | ||
.type(pair[1]) | ||
.blur() | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {Given, Then, When} from 'cypress-cucumber-preprocessor/steps'; | ||
|
||
Given(/^I'm in the homepage logged in as an admin$/, function () { | ||
cy.visit('http://localhost:4200'); | ||
cy.get('.nav-link').contains('Login').click(); | ||
cy.get('#username').type('root').blur(); | ||
cy.get('#password').type('password').blur(); | ||
cy.get('button').contains('Submit').click(); | ||
}); | ||
Given(/^I go to the coordinate list page$/, function () { | ||
cy.get('.nav-link').contains('Coordinate').click(); | ||
cy.get('.dropdown-item.coordinateListNavbar').click(); | ||
}); | ||
Given(/^I click on add coordinte button$/, function () { | ||
cy.get('.createCoordinateBtn').click(); | ||
}); | ||
Given(/^I am redirected to the coordinate detail page$/, function () { | ||
cy.url().should('match', /\/coordinates\/\d+/); | ||
}); | ||
When(/^I am redirected to the coordinate delete page$/, function () { | ||
cy.url().should('match', /\/coordinates\/\d+\/delete/); | ||
}); | ||
|
||
Then(/^I am redirected to the coordinate list page$/, function () { | ||
cy.url().should('match', /\/coordinates/); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {Given, When} from 'cypress-cucumber-preprocessor/steps'; | ||
import {DataTable} from "@cucumber/cucumber"; | ||
|
||
Given(/^I am redirected to the coordinate edit page$/, function () { | ||
cy.url().should('match', /\/coordinates\/\d+\/edit/); | ||
|
||
}); | ||
|
||
When('I clear and fill the form with', (table: DataTable) => { | ||
cy.wait(1000); | ||
table.rows().forEach(function (pair: string[]) { | ||
cy.get('#' + pair[0]).clear(); | ||
cy.get('#' + pair[0]).type(pair[1]).blur(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters