test: Add getPalette() tets

This commit is contained in:
Lokesh Dhakar
2019-05-02 09:04:23 -07:00
parent eef8742c0b
commit 7a4e672b8c
2 changed files with 24 additions and 3 deletions

View File

@@ -50,3 +50,24 @@ describe('getColor()', function() {
// });
// })
})
function testPaletteCount(num) {
it(`returns ${num} color when colorCount set to ${num}`, function() {
cy.get(`[data-image="rainbow-horizontal.png"] .palette[data-count="${num}"] .output-palette`).should(($el) => {
const count = rgbCount($el.text())
expect(count).to.equal(num);
});
})
}
describe('getPalette()', function() {
beforeEach(function() {
cy.visit('http://localhost:8080');
})
// FULL TEST LIST = [1, 2, 3, 5, 7, 10, 20];
// Non-breaking tests
let testCounts = [5, 7];
testCounts.forEach((count) => testPaletteCount(count))
})