forked from hedyorg/hedy
-
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.
[TESTING, CYPRESS] 3692 front-end test for the run code button and pr…
…ogrammers mode switch (hedyorg#3702) [CYPRESS, TESTING] **Description** With these front-end tests the 'Run code' and programmers mode switch on the `/hedy` page are tested. I created id's in the HTML file to select the buttons and I implemented a function which navigates to the `/hedy` page that can be used for these tests but also for future tests. **Fixes _issue or discussion number_** Fixes hedyorg#3692 **How to test** Run `export ADMIN_USER=admin_user; python app.py` in your virtual environment. This ensures that there is an active admin_user and Hedy is running. Then you can go to the /tests folder and run: `npx cypress run --spec cypress/e2e/hedy_page/`
- Loading branch information
Showing
4 changed files
with
36 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
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,13 @@ | ||
import {goToHedyPage} from "../tools/navigation/nav"; | ||
|
||
describe('Is able to switch programmers mode on and of', () => { | ||
it('Passes', () => { | ||
goToHedyPage(); | ||
|
||
cy.get('#toggle_circle').click(); // Programmers mode is switched on | ||
cy.get('#adventures-tab').should('not.be.visible'); | ||
|
||
cy.get('#toggle_circle').click(); // Programmers mode is switched off | ||
cy.get('#adventures-tab').should('be.visible'); | ||
}) | ||
}) |
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,16 @@ | ||
import {goToHedyPage} from "../tools/navigation/nav"; | ||
|
||
describe('Is able to run code', () => { | ||
it('Passes', () => { | ||
goToHedyPage(); | ||
|
||
// Run with correct code | ||
cy.get('#runit').click(); | ||
cy.get('#okbox').should('be.visible'); | ||
|
||
// Run with incorrect code | ||
cy.get('#editor').type('\np'); | ||
cy.get('#runit').click(); | ||
cy.get('#errorbox').should('be.visible'); | ||
}) | ||
}) |
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