Skip to content
/ selenx Public

Write selenium tests using XML (includes Page Object pattern)

Notifications You must be signed in to change notification settings

stasha/selenx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SelenX

Write selenium tests using XML

Examples

Layout example

<layouts>
    <layout id="siteLayout">
        
        <po id="footer" css="#footer">
            <el id="cookiePolicy" css="a['/cookie/policy']" />
            <el id="privacy" css="a['/privacy']" />
            <el id="terms" css="a['/terms']" />
        </po>
    </layout>
    
    <layout id="notLoggedInLayout" extends="siteLayout">
        <po id="header" css="#header">
            <el id="logo" css="a" />
            <el id="search" css="name['query']" />
            <el id="home" css="ul a[href='/']" />
            <el id="login" css="ul a[href='/login']" />
            <el id="createAccount" css="ul a[href='/create/account']" />
        </po>
    </layout>

    <layout id="loggedInLayout" extends="siteLayout">
        <po id="header" css="#header">
            <el id="profile" css="ul a[href='/my/profile']" />
            <el id="logout" css="ul a[href='/logout']" />
        </po>
    </layout>
</layouts>

Page example

<pages>
    <page id="homePage" layout="notLoggedInLayout">
        <po id="content">
            <el id="forgotPassword" css="a[href='/forgot/password']" />
            
            <po id="login" css="#login">
                <el id="email" css="[name='email']" />
                <el id="password" css="[name='password']" />
                <el id="rememberme" css="[name='rememberme']" />
                <el id="submit" css="[type='submit']" />
            </po>
            
            <po id="register" css="#register">
                <el id="email" css="[name='email']" />
                <el id="password" css="[name='password']" />
                <el id="reTypePassword" css="[name='reTypePassword']" />
                <el id="agreeWithTerms" css="[name='agreeWithTerms']" />
                <el id="submit" css="[type='submit']" />
            </po>
        </po>
    </page>
    
    <page id="logedInHomePage" layout="loggedInLayout">
        
    </page>
</pages>

Test templates example

<?xml version="1.0" encoding="UTF-8"?>
<templates>
    <template id="loginTemplate">
        <type el="login email" value="[email protected]" />
        <type el="login password" value="password" />
        <select el="login rememberme" value="false" />
        <mouse el="login submit" />
        <assert type="text" css="title">Admastic - Latest ads</assert>
    </template>
</templates>

Site example

<site baseUri="http://localhost:8080/">
    <import file="core/layout.xml" />
    <import file="pages/home.xml" />
    <import file="core/templates.xml" />
</site>

Test examples

<tests>
    <test id="loginTest">
        <navigate url="/" return="homePage" />
        <mouse type="click" el="header home" />
        <assert type="text" css="title">Admastic</assert>
        
        <import template="loginTemplate" />

        <wait el="header home" until="isVisible" timeout="200" />
    </test>
    
    
    <test id="logoutTest">
        <navigate url="/" return="logedInHomePage" />
        <mouse el="header logout" return="homePage" />
        <assert type="text" css="title">Admastic</assert>
    </test>
</tests>

About

Write selenium tests using XML (includes Page Object pattern)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published