-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1b29d1
commit cf17d1b
Showing
5 changed files
with
152 additions
and
50 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
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 |
---|---|---|
@@ -1,19 +1,25 @@ | ||
@logged_in | ||
@logged_in @has_list_with_reminders | ||
Feature: Reminders management | ||
Scenario: I can check reminder | ||
When I create a list called 'test list' | ||
Then I should see list 'test list' | ||
And I should see reminders for 'test list' | ||
Scenario: I can check a reminder | ||
Given I select the list with reminders | ||
When I check the reminder number 2 | ||
Then I should see the reminder number 2 checked | ||
|
||
Scenario: I can rename a list | ||
Given I have a list called 'test list' | ||
When I rename the list to 'test list with new name' | ||
Then I should see list 'test list with new name' | ||
And I should see reminders for 'test list with new name' | ||
And I should not see list 'test list' | ||
When I check the reminder number 3 | ||
Then I should see the reminder number 3 checked | ||
|
||
Scenario: I can delete a list | ||
Given I have a list called 'test list' | ||
When I delete the list 'test list' | ||
Then I should not see list 'test list' | ||
And I should not see reminders for 'test list' | ||
When I check the reminder number 2 | ||
Then I should see the reminder number 2 unchecked | ||
|
||
Scenario: I can create a reminder | ||
When I create a reminder called 'test list' | ||
Then I should see the reminder 'test list' | ||
|
||
Scenario: I can rename a reminder | ||
When I rename the reminder number 1 to 'test reminder with new name' | ||
Then I should see the reminder 'test reminder with new name' | ||
And I should not see reminder with old name | ||
|
||
Scenario: I can delete a reminder | ||
When I delete the reminder number 1 | ||
Then I should not see reminder number 1 |
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 |
---|---|---|
@@ -1,39 +1,49 @@ | ||
import { After, Before, Step } from '@badeball/cypress-cucumber-preprocessor'; | ||
|
||
Before({ tags: "@logged_in" }, function() { | ||
|
||
Before({ tags: '@logged_in'}, function() { | ||
Step(this, "I should be logged in as 'pythonista'"); | ||
}); | ||
|
||
Before({ tags: '@has_list_with_reminders' }, function() { | ||
Step(this, 'I have 1 lists with 3 reminders'); | ||
cy.then(() => this.listWithReminders = this.lists[0]); | ||
Step(this, 'I select the list number 1'); | ||
|
||
}); | ||
|
||
// Note: this is not working after failed scenarios | ||
// https://github.com/badeball/cypress-cucumber-preprocessor/issues/824#issuecomment-1561492281 | ||
After({ tags: "@logged_in" }, function() { | ||
const lists = []; | ||
After({ tags: '@logged_in' }, function() { | ||
const listsForDeletion = []; | ||
|
||
if(this.listName) { | ||
lists.push(this.listName); | ||
listsForDeletion.push(this.listName); | ||
} | ||
|
||
if(this.newListName) { | ||
lists.push(this.newListName); | ||
listsForDeletion.push(this.newListName); | ||
} | ||
|
||
if(this.oldListName) { | ||
lists.push(this.oldListName); | ||
listsForDeletion.push(this.oldListName); | ||
} | ||
|
||
if(this.lists) { | ||
lists.push(...this.lists.map(list => list.name)); | ||
listsForDeletion.push(...this.lists.map(list => list.name)); | ||
} | ||
|
||
cy.request('/api/reminders').then((response) => { | ||
expect(response.status).to.be.ok; | ||
return response.body | ||
.filter(list => lists.includes(list['name'])) | ||
.map(list => list['id']) | ||
}) | ||
.each((listId) => { | ||
cy.request('DELETE', `/api/reminders/${listId}`).then((response) => { | ||
if(listsForDeletion.length > 0) { | ||
cy.request('/api/reminders').then((response) => { | ||
expect(response.status).to.be.ok; | ||
return response.body | ||
.filter(list => listsForDeletion.includes(list['name'])) | ||
.map(list => list['id']) | ||
}) | ||
.each((listId) => { | ||
cy.request('DELETE', `/api/reminders/${listId}`).then((response) => { | ||
expect(response.status).to.be.ok; | ||
}); | ||
}); | ||
}); | ||
} | ||
}); |
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