diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 6a7511c59..bb82ac669 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -12,6 +12,11 @@ jobs: uses: actions/setup-node@v3 with: node-version-file: .nvmrc + + - name: Install Mage + uses: magefile/mage-action@v3 + with: + install-only: true - name: Install yarn dependencies run: yarn install @@ -19,7 +24,7 @@ jobs: NODE_OPTIONS: '--max_old_space_size=4096' - name: Build - run: go build -v ./... + run: mage -v - name: Build Frontend run: yarn build diff --git a/.github/workflows/k6.yml b/.github/workflows/k6.yml index c13147dbc..34da6b46c 100644 --- a/.github/workflows/k6.yml +++ b/.github/workflows/k6.yml @@ -7,10 +7,15 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Use Node.js + - name: Setup Node.js environment uses: actions/setup-node@v3 with: node-version-file: .nvmrc + + - name: Install Mage + uses: magefile/mage-action@v3 + with: + install-only: true - name: Install yarn dependencies run: yarn install @@ -18,7 +23,7 @@ jobs: NODE_OPTIONS: '--max_old_space_size=4096' - name: Build - run: go build -v ./... + run: mage -v - name: Build Frontend run: yarn build diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index ce55746cc..94210a7ff 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -12,6 +12,11 @@ jobs: uses: actions/setup-node@v3 with: node-version-file: .nvmrc + + - name: Install Mage + uses: magefile/mage-action@v3 + with: + install-only: true - name: Install yarn dependencies run: yarn install @@ -19,7 +24,7 @@ jobs: NODE_OPTIONS: '--max_old_space_size=4096' - name: Build - run: go build -v ./... + run: mage -v - name: Build Frontend run: yarn build @@ -32,6 +37,9 @@ jobs: - name: Start Grafana run: docker run --rm -d -p 3000:3000 --name=grafana --env GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=grafana-azure-data-explorer-datasource --volume "$PWD/dist:/var/lib/grafana/plugins/grafana-azure-data-explorer-datasource" grafana/grafana; sleep 30 + - name: Display plugin directory + run: ls -la dist + - name: Run Playwright tests run: yarn playwright test env: @@ -46,3 +54,10 @@ jobs: name: playwright-report path: playwright-report/ retention-days: 30 + + - uses: actions/upload-artifact@v3 + if: always() + with: + name: screenshots + path: screenshots/ + retention-days: 1 diff --git a/e2e/k6/k6.spec.js b/e2e/k6/k6.spec.js index 154ae6d2a..3db377db7 100644 --- a/e2e/k6/k6.spec.js +++ b/e2e/k6/k6.spec.js @@ -93,7 +93,7 @@ export async function addDatasource(page) { // checks the page for the data source is working message check(page, { 'add datasource successful': - (await page.locator('div[data-testid="data-testid Alert success"]').textContent()) === 'Success', + (await page.locator('[aria-label="Data source settings page Alert"]').textContent()) === 'Success', }); } catch (e) { fail(`add datasource failed: ${e}`); diff --git a/e2e/playwright/playwright.spec.ts b/e2e/playwright/playwright.spec.ts index 1d8775252..624507c00 100644 --- a/e2e/playwright/playwright.spec.ts +++ b/e2e/playwright/playwright.spec.ts @@ -66,10 +66,10 @@ async function addDatasource(page: Page) { const saveBtn = page.locator(`button[data-testid="data-testid ${selectors.pages.DataSource.saveAndTest}"]`); await saveBtn.click(); + await page.screenshot({ path: `screenshots/${DATASOURCE_NAME}.png` }); + // checks the page for the data source is working message - await expect(page.locator(`[aria-label="Data source settings page Alert"]`)).toContainText( - 'Success' - ); + await expect(page.locator(`[aria-label="Data source settings page Alert"]`)).toContainText('Success'); } async function addDashboard(page: Page) { @@ -105,30 +105,30 @@ async function configurePanel(page: Page) { await addPanelButton.click(); // select data source for panel - const dsPanel = page.locator('input[placeholder="Select data source"]') + const dsPanel = page.locator('input[placeholder="Search data source"]'); await dsPanel.fill(`${DATASOURCE_NAME}`); await page.keyboard.down('Tab'); await page.keyboard.down('Enter'); // select database const database = page.locator(`[aria-label="Database"]`); - await database.click(); + await database.click({ force: true }); await database.fill('PerfTest'); - await page.keyboard.down('Enter'); // select table const table = page.locator(`[aria-label="Table"]`); - await table.click(); + await table.click({ force: true }); await table.fill('PerfTest'); - await page.keyboard.down('Enter'); // run query const runQueryBtn = page.locator(`[data-testid="data-testid run-query"]`); - await runQueryBtn.click(); + await runQueryBtn.click({ force: true }); // are there results? const columns = page.locator(`[aria-label="Columns"]`); - await columns.click(); + await columns.click({ force: true }); + + await page.waitForTimeout(6000); const html = await page.locator('[aria-label="Select options menu"]').innerHTML(); await expect(html).toContain('_val1_'); @@ -136,6 +136,8 @@ async function configurePanel(page: Page) { // save panel const savePanelBtn = page.locator(`button[title="Apply changes and save dashboard"]`); await savePanelBtn.click(); + + // save dashboard const saveDashButton = page.locator('button[aria-label="Save dashboard button"]'); await saveDashButton.click(); } diff --git a/yarn.lock b/yarn.lock index d75abcfcb..762d5d17a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5657,11 +5657,6 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -crypt@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" - integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow== - crypto-random-string@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-4.0.0.tgz#5a3cc53d7dd86183df5da0312816ceeeb5bb1fc2" @@ -7473,7 +7468,7 @@ form-data@~2.3.2: combined-stream "^1.0.6" mime-types "^2.1.12" -fs-extra@^10.0.0, fs-extra@^10.1.0: +fs-extra@^10.0.0: version "10.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== @@ -7502,11 +7497,16 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@2.3.2, fsevents@^2.3.2, fsevents@~2.3.2: +fsevents@2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== +fsevents@^2.3.2, fsevents@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -7714,6 +7714,16 @@ glob@^7.1.3, glob@^7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^9.2.0: + version "9.3.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-9.3.5.tgz#ca2ed8ca452781a3009685607fdf025a899dfe21" + integrity sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q== + dependencies: + fs.realpath "^1.0.0" + minimatch "^8.0.2" + minipass "^4.2.4" + path-scurry "^1.6.1" + global-dirs@^3.0.0, global-dirs@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-3.0.1.tgz#0c488971f066baceda21447aecb1a8b911d22485" @@ -9504,6 +9514,13 @@ minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: dependencies: brace-expansion "^1.1.7" +minimatch@^8.0.2: + version "8.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-8.0.4.tgz#847c1b25c014d4e9a7f68aaf63dedd668a626229" + integrity sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA== + dependencies: + brace-expansion "^2.0.1" + minimatch@^9.0.1: version "9.0.3" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825"