Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct consecutive get() in cypress instruction #2712 #2713

Merged
merged 3 commits into from
Jan 3, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cypress/infinitStart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const cypress = require('cypress');
const server = require('./server');

server.start();
22 changes: 11 additions & 11 deletions cypress/integration/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ describe('List Page', () => {
cy.viewport(1280, 500);

cy.scrollTo(0, 200);
cy.get(ListPagePosts.elements.headroom).should('not.be.visible');
cy.get(ListPagePosts.elements.headroomUnpinned).should('not.be.visible');

cy.scrollTo(0, -100);
cy.get(ListPagePosts.elements.headroom).should('be.visible');
cy.get(ListPagePosts.elements.headroomUnfixed).should('be.visible');
});
});

Expand Down Expand Up @@ -171,25 +171,25 @@ describe('List Page', () => {
describe("Sorting", () => {
it('should display a sort arrow when clicking on a sortable column header', () => {
ListPagePosts.toggleColumnSort('id');
cy.get(ListPagePosts.elements.sortBy('id')).get("svg").should('be.visible');
cy.get(ListPagePosts.elements.svg('id')).should('be.visible');

ListPagePosts.toggleColumnSort('"tags.name"');
cy.get(ListPagePosts.elements.sortBy('"tags.name"')).get("svg").should('be.visible');
ListPagePosts.toggleColumnSort('tags.name');
cy.get(ListPagePosts.elements.svg('tags.name')).should('be.visible');
});

it('should hide the sort arrow when clicking on another sortable column header', () => {
ListPagePosts.toggleColumnSort('published_at');
cy.get(ListPagePosts.elements.sortBy('id')).get("svg").should('be.hidden');
cy.get(ListPagePosts.elements.sortBy('"tags.name"')).get("svg").should('be.hidden');
cy.get(ListPagePosts.elements.svg('id')).should('be.hidden');
cy.get(ListPagePosts.elements.svg('tags.name')).should('be.hidden');
});

it('should reverse the sort arrow when clicking on an already sorted column header', () => {
ListPagePosts.toggleColumnSort('published_at');
ListPagePosts.toggleColumnSort('"tags.name"');
cy.get(ListPagePosts.elements.sortBy('"tags.name"')).get("[class*=iconDirectionAsc]").should('exist');
ListPagePosts.toggleColumnSort('tags.name');
cy.get(ListPagePosts.elements.svg('tags.name', '[class*=iconDirectionAsc]')).should('exist');

ListPagePosts.toggleColumnSort('"tags.name"');
cy.get(ListPagePosts.elements.sortBy('"tags.name"')).get("[class*=iconDirectionDesc]").should('exist');
ListPagePosts.toggleColumnSort('tags.name');
cy.get(ListPagePosts.elements.svg('tags.name', '[class*=iconDirectionDesc]')).should('exist');
});
})
});
1 change: 1 addition & 0 deletions cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"name": "e2e",
"version": "0.1.0",
"scripts": {
"serve": "node ./infinitStart.js",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed ? Looks irrelevant to this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It permits to test simple application interactively. Under cypress, launch a terminal and start
:> yarn serve
launch another terminal and start:
:> yarn start

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes its quite irrelevant to this PR. I agrea.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference with:

launch a terminal and start make run-simple

launch another terminal and start make test-e2e-local

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My solution permits just to launch cypress tests from cypress directory, like the overall test.
Its not important, you can remove it if you like.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you aware of the npm commands inside the root package.json. If you can't use make, you can:

launch a terminal and start yarn run-simple

launch another terminal and start yarn test-e2e-local

Can you remove the new ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

"start": "./node_modules/.bin/cypress open",
"test": "node ./start.js"
},
Expand Down
6 changes: 4 additions & 2 deletions cypress/support/ListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export default url => ({
recordRows: '.datagrid-body tr',
viewsColumn: '.datagrid-body tr td:nth-child(6)',
datagridHeaders: 'th',
sortBy: name => `th span[data-sort=${name}]`,
sortBy: name => `th span[data-sort=\"${name}\"]`,
svg: (name, criteria = '') => `th span[data-sort=\"${name}\"] svg${criteria}`,
logout: '.logout',
bulkActionsToolbar: '[data-test=bulk-actions-toolbar]',
customBulkActionsButton:
Expand All @@ -27,7 +28,8 @@ export default url => ({
selectItem: '.select-item input',
userMenu: 'button[title="Profile"]',
title: '#react-admin-title',
headroom: '.headroom',
headroomUnfixed: '.headroom--unfixed',
headroomUnpinned: '.headroom--unpinned',
},

navigate() {
Expand Down