Created
April 17, 2014 18:08
-
-
Save fabiocerqueira/11002019 to your computer and use it in GitHub Desktop.
Login Admin Functional Test
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
Feature: Log in django admin | |
Scenario: Log in django admin with correct user and password | |
Given I have the user admin and password admin | |
When I fill the form and submit | |
Then I see the text "Encerrar sessão" | |
Scenario: Log in django admin with incorrect user and password | |
Given I have the user invald_admin and password invalid_password | |
When I fill the form and submit | |
Then I see the text "insira um nome de usuário e senha corretos para uma conta de equipe" |
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
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
from lettuce import * | |
from splinter import Browser | |
@step('I have the user (\w+) and password (\w+)') | |
def have_user_and_password(step, user, password): | |
world.browser = Browser('phantomjs') | |
world.browser.visit('http://localhost:8000/admin/') | |
world.user = user | |
world.password = password | |
@step('I fill the form and submit') | |
def fill_and_submit_form(step): | |
world.browser.fill('username', world.user) | |
world.browser.fill('password', world.password) | |
button = world.browser.find_by_value('Acessar') | |
button.click() | |
@step('Then I see the text "([^"]*)"') | |
def check_text(step, text): | |
is_ok = world.browser.is_text_present(text) | |
world.browser.quit() | |
assert is_ok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment