|
1 | | -import "cypress-keycloak-commands"; |
2 | | -import { formsettings } from "../support/login.js"; |
| 1 | +import 'cypress-keycloak-commands'; |
| 2 | +import { formsettings } from '../support/login.js'; |
3 | 3 |
|
4 | | -const depEnv = Cypress.env("depEnv"); |
| 4 | +const depEnv = Cypress.env('depEnv'); |
5 | 5 |
|
6 | | -Cypress.Commands.add("waitForLoad", () => { |
| 6 | +Cypress.Commands.add('waitForLoad', () => { |
7 | 7 | const loaderTimeout = 60000; |
8 | | - cy.get(".nprogress-busy", { timeout: loaderTimeout }).should("not.exist"); |
| 8 | + cy.get('.nprogress-busy', { timeout: loaderTimeout }).should('not.exist'); |
9 | 9 | }); |
10 | 10 |
|
11 | | -describe("Form Designer", () => { |
12 | | - beforeEach(() => { |
13 | | - cy.on("uncaught:exception", (err, runnable) => { |
| 11 | +describe('Form Designer', () => { |
| 12 | + |
| 13 | + beforeEach(()=>{ |
| 14 | + |
| 15 | + cy.on('uncaught:exception', (err, runnable) => { |
14 | 16 | // Form.io throws an uncaught exception for missing projectid |
15 | 17 | // Cypress catches it as undefined: undefined so we can't get the text |
16 | 18 | console.log(err); |
17 | 19 | return false; |
18 | 20 | }); |
19 | 21 | }); |
20 | | - it("Visits the form settings page", () => { |
| 22 | + it('Visits the form settings page', () => { |
| 23 | + |
21 | 24 | cy.viewport(1000, 1100); |
22 | 25 | cy.waitForLoad(); |
23 | 26 | formsettings(); |
24 | 27 | }); |
25 | | - it("checks Apikey Settings", () => { |
| 28 | + it('checks Apikey Settings', () => { |
26 | 29 | cy.viewport(1000, 1100); |
27 | 30 | cy.waitForLoad(); |
28 | | - |
29 | | - cy.get("button").contains("BC Government").click(); |
30 | | - cy.get("div.formio-builder-form").then(($el) => { |
| 31 | + |
| 32 | + cy.get('button').contains('BC Government').click(); |
| 33 | + cy.get('div.formio-builder-form').then($el => { |
31 | 34 | const coords = $el[0].getBoundingClientRect(); |
32 | 35 | cy.get('[data-key="simplebcaddress"]') |
33 | | - .trigger("mousedown", { which: 1 }, { force: true }) |
34 | | - .trigger("mousemove", coords.x, -550, { force: true }) |
| 36 | + .trigger('mousedown', { which: 1}, { force: true }) |
| 37 | + .trigger('mousemove', coords.x, -550, { force: true }) |
35 | 38 | //.trigger('mousemove', coords.y, +100, { force: true }) |
36 | | - .trigger("mouseup", { force: true }); |
37 | | - cy.wait(2000); |
38 | | - cy.get("button").contains("Save").click(); |
| 39 | + .trigger('mouseup', { force: true }); |
| 40 | + cy.wait(2000); |
| 41 | + cy.get('.btn-success').click(); |
39 | 42 | }); |
40 | 43 | // Form saving |
41 | | - cy.wait(2000); |
42 | | - let savedButton = cy.get("[data-cy=saveButton]"); |
| 44 | + cy.wait(2000); |
| 45 | + let savedButton = cy.get('[data-cy=saveButton]'); |
43 | 46 | expect(savedButton).to.not.be.null; |
44 | | - savedButton.trigger("click"); |
| 47 | + savedButton.trigger('click'); |
45 | 48 | cy.wait(3000); |
46 | 49 |
|
47 | 50 | // Verify Api key functionality |
48 | | - cy.get(".mdi-cog").click(); |
49 | | - cy.get( |
50 | | - ":nth-child(2) > .v-expansion-panel > .v-expansion-panel-title > .v-expansion-panel-title__overlay" |
51 | | - ).click(); |
52 | | - |
| 51 | + cy.get('.mdi-dots-vertical').click(); |
| 52 | + cy.get('[data-cy="settingsRouterLink"] > .v-btn > .v-btn__content').click(); |
| 53 | + cy.get(':nth-child(2) > .v-expansion-panel > .v-expansion-panel-title > .v-expansion-panel-title__overlay').click(); |
| 54 | + |
53 | 55 | cy.get('[data-test="canGenerateAPIKey"]').click(); |
54 | 56 | cy.get('[data-test="continue-btn-continue"]').click(); |
55 | | - cy.get('[data-test="continue-btn-cancel"]').should("be.enabled"); |
| 57 | + cy.get('[data-test="continue-btn-cancel"]').should('be.enabled'); |
56 | 58 | cy.get('[data-test="canAllowCopyAPIKey"]').click(); |
57 | 59 | //Verify checkbox checked for access submitted files |
58 | | - cy.contains("Allow this API key to access submitted files").click(); |
59 | | - cy.get( |
60 | | - 'input[aria-label="Allow this API key to access submitted files"]' |
61 | | - ).should("be.checked"); |
| 60 | + cy.contains('Allow this API key to access submitted files').click(); |
| 61 | + cy.get('input[aria-label="Allow this API key to access submitted files"]').should('be.checked'); |
62 | 62 | //Delete Apikey |
63 | | - cy.get('[data-test="canDeleteApiKey"]'); |
64 | | - }); |
65 | | - it("checks Cdogs Upload", () => { |
| 63 | + cy.get('[data-test="canDeleteApiKey"]') |
| 64 | + |
| 65 | + |
| 66 | + }) |
| 67 | + it('checks Cdogs Upload', () => { |
66 | 68 | cy.viewport(1000, 1100); |
67 | 69 | cy.waitForLoad(); |
68 | | - cy.get( |
69 | | - ":nth-child(3) > .v-expansion-panel > .v-expansion-panel-title > .v-expansion-panel-title__overlay" |
70 | | - ).click(); |
71 | | - let fileUploadInputField = cy.get("input[type=file]"); |
72 | | - cy.get("input[type=file]").should("not.to.be.null"); |
73 | | - fileUploadInputField.attachFile("add1.png"); |
| 70 | + cy.get(':nth-child(3) > .v-expansion-panel > .v-expansion-panel-title > .v-expansion-panel-title__overlay').click(); |
| 71 | + let fileUploadInputField = cy.get('input[type=file]'); |
| 72 | + cy.get('input[type=file]').should('not.to.be.null'); |
| 73 | + fileUploadInputField.attachFile('add1.png'); |
74 | 74 |
|
75 | 75 | // Checking file type functionality |
76 | | - cy.get("div") |
77 | | - .contains( |
78 | | - "The template must use one of the following extentions: .txt, .docx, .html, .odt, .pptx, .xlsx" |
79 | | - ) |
80 | | - .should("be.visible"); |
81 | | - cy.get(".mdi-close-circle").click(); |
82 | | - cy.get("input[type=file]").should("not.to.be.null"); |
83 | | - fileUploadInputField.attachFile("SamplePPTx.pptx"); |
84 | | - cy.get("div") |
85 | | - .contains( |
86 | | - "The template must use one of the following extentions: .txt, .docx, .html, .odt, .pptx, .xlsx" |
87 | | - ) |
88 | | - .should("not.exist"); |
89 | | - |
| 76 | + cy.get('div').contains('The template must use one of the following extentions: .txt, .docx, .html, .odt, .pptx, .xlsx').should('be.visible'); |
| 77 | + cy.get('.mdi-close-circle').click(); |
| 78 | + cy.get('input[type=file]').should('not.to.be.null'); |
| 79 | + fileUploadInputField.attachFile('SamplePPTx.pptx'); |
| 80 | + cy.get('div').contains('The template must use one of the following extentions: .txt, .docx, .html, .odt, .pptx, .xlsx').should('not.exist'); |
| 81 | + |
90 | 82 | cy.waitForLoad(); |
91 | 83 | cy.waitForLoad(); |
92 | 84 | cy.get('button[title="Upload"]').click(); |
93 | | - cy.wait(2000); |
94 | | - cy.get(".mdi-minus-circle").click(); |
95 | | - cy.get("input[type=file]").should("not.to.be.null"); |
96 | | - fileUploadInputField.attachFile("file_example_XLSX_50.xlsx"); |
| 85 | + cy.wait(2000); |
| 86 | + cy.get('.mdi-minus-circle').click(); |
| 87 | + cy.get('input[type=file]').should('not.to.be.null'); |
| 88 | + fileUploadInputField.attachFile('file_example_XLSX_50.xlsx'); |
97 | 89 | cy.waitForLoad(); |
98 | 90 | cy.get('button[title="Upload"]').click(); |
99 | | - cy.get(".mdi-minus-circle").click(); |
100 | | - cy.get("input[type=file]").should("not.to.be.null"); |
101 | | - fileUploadInputField.attachFile("Testing_files.txt"); |
| 91 | + cy.get('.mdi-minus-circle').click(); |
| 92 | + cy.get('input[type=file]').should('not.to.be.null'); |
| 93 | + fileUploadInputField.attachFile('Testing_files.txt'); |
102 | 94 | cy.get('button[title="Upload"]').click(); |
103 | | - cy.get(".mdi-minus-circle").click(); |
104 | | - cy.get("input[type=file]").should("not.to.be.null"); |
105 | | - fileUploadInputField.attachFile("test.docx"); |
106 | | - cy.contains("div", "test.docx (11.9 kB)").should("be.visible"); |
| 95 | + cy.get('.mdi-minus-circle').click(); |
| 96 | + cy.get('input[type=file]').should('not.to.be.null'); |
| 97 | + fileUploadInputField.attachFile('test.docx'); |
| 98 | + cy.contains('div','test.docx (11.9 kB)').should('be.visible'); |
107 | 99 | cy.get('button[title="Upload"]').click(); |
108 | | - cy.contains("span", "test.docx").should("be.visible"); |
109 | | - cy.contains("div", "test.docx (11.9 kB)").should("not.exist"); |
| 100 | + cy.contains('span','test.docx').should('be.visible'); |
| 101 | + cy.contains('div','test.docx (11.9 kB)').should('not.exist'); |
110 | 102 |
|
111 | 103 | // Verify cdogs template uplaod success message |
112 | | - cy.get(".v-alert__content") |
113 | | - .contains("div", "Template uploaded successfully.") |
114 | | - .should("be.visible"); |
| 104 | + cy.get('.v-alert__content').contains('div','Template uploaded successfully.').should('be.visible'); |
115 | 105 | //Delete form after test run |
116 | | - |
| 106 | + |
117 | 107 | cy.get('[data-test="canRemoveForm"]').click(); |
118 | 108 | cy.get('[data-test="continue-btn-continue"]').click(); |
119 | 109 | cy.wait(9000); |
120 | | - cy.get("#logoutButton > .v-btn__content > span").click(); |
121 | | - }); |
122 | | -}); |
| 110 | + cy.get('#logoutButton > .v-btn__content > span').click(); |
| 111 | + |
| 112 | + }) |
| 113 | + |
| 114 | +}) |
0 commit comments