Skip to content

Instantly share code, notes, and snippets.

@paulbjensen
Created June 18, 2018 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulbjensen/45f4ca38da313262ffb80af490e71974 to your computer and use it in GitHub Desktop.
Save paulbjensen/45f4ca38da313262ffb80af490e71974 to your computer and use it in GitHub Desktop.
selectors.js, part of an article on Medium
/*
NOTE - at some point these selectors will need to be scoped based on the page
that the user is accessing in the cucumber step
*/
const selectors = {
links: {
Signup: 'a[href="/signup"]',
Login: 'a[href="/login"]',
Logout: 'a.logout',
'I have forgotten my password': 'a[href="/forgot-password"]',
'Your account': 'a[href="/account"]',
'Change your email': 'a[href="/account/email"]',
'Change your password': 'a[href="/account/password"]',
'Close your account': 'a[href="/account/close"]',
Dashku: 'a[id="logo"]',
'Create a dashboard': 'a[href="/dashboards/new"]',
'Your organisations': 'a[href="/account/organisations"]',
'Create an organisation': 'a[href="/account/organisations/new"]'
},
hover: {
paulbjensen: 'div#username' /* NOTE - Brittle, but will correct later */
},
dashboardLinks: {
view: id => `a[href="/dashboards/${id}"]`,
manage: id => `a[href="/dashboards/${id}/manage"]`,
access: id => `a[href="/dashboards/${id}/members"]`,
edit: id => `a[href="/dashboards/${id}/edit"]`,
delete: id => `a[href="/dashboards/${id}/delete"]`,
'Add a member': id => `a[href="/dashboards/${id}/members/new"]`
},
organisationLinks: {
view: id => `a[href="/account/organisations/${id}"]`,
edit: id => `a[href="/account/organisations/${id}/edit"]`,
delete: id => `a[href="/account/organisations/${id}/delete"]`,
'Add a member': id => `a[href="/account/organisations/${id}/members/new"]`
},
buttons: {
Signup: 'button',
Login: 'button',
'Send email': 'button',
'Reset password': 'button',
'Change email': 'button',
'Change password': 'button#change-password-button',
'Close account': 'button',
Create: 'button[type="submit"]',
Save: 'button[type="submit"]',
Delete: 'button[type="submit"]',
Add: 'button[type="submit"]'
},
organisationUserButtons: {
Remove: id => `button[id="remove-user-role-${id}"]`,
Leave: id => `button[id="remove-user-role-${id}"]`,
'Make a member': id => `button[id="update-user-role-${id}"]`,
'Make an admin': id => `button[id="update-user-role-${id}"]`
},
dashboardUserButtons: {
Remove: id => `button[id="remove-user-role-${id}"]`,
Leave: id => `button[id="remove-user-role-${id}"]`,
'Make a viewer': id => `button[id="update-user-role-${id}"]`,
'Make an admin': id => `button[id="update-user-role-${id}"]`
},
checkboxes: {
accepted_terms: 'input[name="accepted_terms"]'
}
};
module.exports = selectors;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment