|
| 1 | +import {FixedRowHeightPage} from "../pages/fixed-row-height.po"; |
| 2 | + |
| 3 | +describe('Drag and drop columns [ Name, Company, Gender ]', () => { |
| 4 | + |
| 5 | + let page; |
| 6 | + |
| 7 | + let NAME = 0, |
| 8 | + COMPANY = 1, |
| 9 | + GENDER = 2; |
| 10 | + |
| 11 | + beforeEach(() => { |
| 12 | + page = new FixedRowHeightPage(); |
| 13 | + |
| 14 | + page.navigateTo(); |
| 15 | + }); |
| 16 | + |
| 17 | + // columns are [ Name, Company, Gender ] |
| 18 | + describe('when the first column is dragged to the second ', () => { |
| 19 | + |
| 20 | + beforeEach(() => { |
| 21 | + expect(page.table.columnText(NAME)).toBe('Name'); |
| 22 | + expect(page.table.columnText(COMPANY)).toBe('Company'); |
| 23 | + }); |
| 24 | + |
| 25 | + it('then it should swap the columns [ Company, Name, Gender ]', () => { |
| 26 | + page.table.drag(NAME, COMPANY) |
| 27 | + .then(() => { |
| 28 | + expect(page.table.columnText(NAME)).toBe('Company'); |
| 29 | + expect(page.table.columnText(COMPANY)).toBe('Name'); |
| 30 | + }); |
| 31 | + }); |
| 32 | + }); |
| 33 | + |
| 34 | + // columns are [ Name, Company, Gender ] |
| 35 | + describe('when the first column is dragged to the third', () => { |
| 36 | + |
| 37 | + beforeEach(() => { |
| 38 | + // page.printColumns(); |
| 39 | + expect(page.table.columnText(NAME)).toBe('Name'); |
| 40 | + expect(page.table.columnText(GENDER)).toBe('Gender'); |
| 41 | + }); |
| 42 | + |
| 43 | + it('then it should swap the columns [ Gender, Company, Name ]', () => { |
| 44 | + page.table.drag(NAME, GENDER) |
| 45 | + .then(() => { |
| 46 | + // page.printColumns(); |
| 47 | + expect(page.table.columnText(NAME)).toBe('Gender'); |
| 48 | + expect(page.table.columnText(GENDER)).toBe('Name'); |
| 49 | + }); |
| 50 | + }); |
| 51 | + }); |
| 52 | + |
| 53 | + // columns are [ Name, Company, Gender ] |
| 54 | + describe('when the second column is dragged to the third', () => { |
| 55 | + beforeEach(() => { |
| 56 | + expect(page.table.columnText(COMPANY)).toBe('Company'); |
| 57 | + expect(page.table.columnText(GENDER)).toBe('Gender'); |
| 58 | + }); |
| 59 | + |
| 60 | + it('then it should swap the columns [ Name, Gender, Company ]', () => { |
| 61 | + page.table.drag(COMPANY, GENDER) |
| 62 | + .then(() => { |
| 63 | + expect(page.table.columnText(COMPANY)).toBe('Gender'); |
| 64 | + expect(page.table.columnText(GENDER)).toBe('Company'); |
| 65 | + }); |
| 66 | + }); |
| 67 | + }); |
| 68 | + |
| 69 | + // columns are [ Name, Company, Gender ] |
| 70 | + describe('when the third column is dragged to the second', () => { |
| 71 | + beforeEach(() => { |
| 72 | + expect(page.table.columnText(GENDER)).toBe('Gender'); |
| 73 | + expect(page.table.columnText(COMPANY)).toBe('Company'); |
| 74 | + }); |
| 75 | + |
| 76 | + it('then it should swap the columns [ Name, Gender, Company ]', () => { |
| 77 | + page.table.drag(GENDER, COMPANY) |
| 78 | + .then(() => { |
| 79 | + expect(page.table.columnText(GENDER)).toBe('Company'); |
| 80 | + expect(page.table.columnText(COMPANY)).toBe('Gender'); |
| 81 | + }); |
| 82 | + }); |
| 83 | + }); |
| 84 | + |
| 85 | + // columns are [ Name, Company, Gender ] |
| 86 | + describe('when the third column is dragged to the first', () => { |
| 87 | + beforeEach(() => { |
| 88 | + expect(page.table.columnText(GENDER)).toBe('Gender'); |
| 89 | + expect(page.table.columnText(NAME)).toBe('Name'); |
| 90 | + }); |
| 91 | + |
| 92 | + it('then it should swap the columns [ Gender, Company, Name ]', () => { |
| 93 | + page.table.drag(GENDER, NAME) |
| 94 | + .then(() => { |
| 95 | + expect(page.table.columnText(GENDER)).toBe('Name'); |
| 96 | + expect(page.table.columnText(NAME)).toBe('Gender'); |
| 97 | + }); |
| 98 | + }); |
| 99 | + }); |
| 100 | + |
| 101 | +}); |
0 commit comments