Skip to content

Commit

Permalink
added tests for Main page on 3 OS
Browse files Browse the repository at this point in the history
  • Loading branch information
qlrd committed Aug 7, 2023
1 parent 63e7437 commit 5069ede
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 7 deletions.
21 changes: 16 additions & 5 deletions src/pages/Main.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<template>
<v-item-group>
<v-item-group id="main-page">
<v-container>
<v-row v-if="clickMessage !== ''">
<v-col>
<v-col
id="main-page-click-message-text"
>
{{ clickMessage }}
</v-col>
</v-row>
Expand All @@ -13,8 +15,11 @@
variant="outlined"
:class="selectedClass"
@click.prevent="selectDevice"
id="main-page-select-device-button"
>
<v-card-title>
<v-card-title
id="main-page-select-device-text"
>
{{ device }}
</v-card-title>
</v-card>
Expand All @@ -28,8 +33,11 @@
variant="outlined"
:class="selectedClass"
@click.prevent="selectVersion"
id="main-page-select-version-button"
>
<v-card-title>
<v-card-title
id="main-page-select-version-text"
>
{{ version }}
</v-card-title>
</v-card>
Expand All @@ -43,8 +51,11 @@
variant="outlined"
:class="selectedClass"
@click.prevent="flashDevice"
id="main-page-flash-button"
>
<v-card-title>
<v-card-title
id="main-page-flash-text"
>
{{ flash }}
</v-card-title>
</v-card>
Expand Down
10 changes: 8 additions & 2 deletions src/pages/SelectDevice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
variant="outlined"
:class="[selectedClass]"
@click.prevent="selectDevice(device)"
:id="`select-device-${device}-button`"
>
<v-card-title>
<v-card-title
:id="`select-device-${device}-title`"
>
{{ device }}
</v-card-title>
</v-card>
Expand All @@ -23,8 +26,11 @@
variant="outlined"
:class="[selectedClass]"
@click.prevent="back()"
id="select-device-back-button"
>
<v-card-title>
<v-card-title
id="select-device-back-title"
>
Back
</v-card-title>
</v-card>
Expand Down
48 changes: 48 additions & 0 deletions test/e2e/pageobjects/app.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ class App {
private __openssl_for_linux_found__: string;
private __openssl_for_darwin_found__: string;
private __openssl_for_win32_found__: string;
private __main_page__: string;
private __main_page_click_message_text__: string;
private __main_page_select_device_button__: string;
private __main_page_select_version_button__: string;
private __main_page_select_device_text__: string;
private __main_page_select_version_text__: string;
private __main_page_flash_button__: string;
private __main_page_flash_text__: string;

constructor () {
this.__app__ = '#app'
Expand All @@ -20,6 +28,15 @@ class App {
this.__openssl_for_linux_found__ = 'pre#openssl-for-linux-found'
this.__openssl_for_darwin_found__ = 'pre#openssl-for-darwin-found'
this.__openssl_for_win32_found__ = 'pre#openssl-for-win32-found'
this.__main_page__ = '#main-page'
this.__main_page_click_message_text__ = 'div#main-click-message-text'
this.__main_page_select_device_button__ = 'div#main-page-select-device-button'
this.__main_page_select_version_button__ = 'div#main-page-select-version-button'
this.__main_page_select_device_text__ = 'div#main-page-select-device-text'
this.__main_page_select_version_text__ = 'div#main-page-select-version-text'
this.__main_page_flash_button__ = 'div#main-page-flash-button'
this.__main_page_flash_text__ = 'div#main-page-flash-text'

}

get title () {
Expand Down Expand Up @@ -58,6 +75,37 @@ class App {
return $(this.__openssl_for_win32_found__)
}

get mainPage () {
return $(this.__main_page__)
}

get mainClickMessageText () {
return $(this.__main_page_click_message_text__)
}

get mainSelectDeviceButton () {
return $(this.__main_page_select_device_button__)
}

get mainSelectVersionButton () {
return $(this.__main_page_select_version_button__)
}

get mainSelectFlashButton () {
return $(this.__main_page_flash_button__)
}

get mainSelectDeviceText () {
return $(this.__main_page_select_device_text__)
}

get mainSelectVersionText () {
return $(this.__main_page_select_version_text__)
}

get mainSelectFlashText () {
return $(this.__main_page_flash_text__)
}
}

module.exports = App
65 changes: 65 additions & 0 deletions test/e2e/specs/005.main-menu.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
const expectChai = require('chai').expect
const expectWDIO = require('@wdio/globals').expect
const { describe, it } = require('mocha')

const App = require('../pageobjects/app.page')

const SELECT_DEVICE_TEXT = 'Select device'
const SELECT_VERSION_TEXT = 'Select version'
const PLEASE_SELECT_VERSION_MESSAGE = 'Please click \'Select version\' to download sources'

describe('KruxInstaller Main page', () => {

let instance: any;

before(async function () {
instance = new App()
await instance.app.waitForExist()
await instance.main.waitForExist()
await instance.logo.waitForExist()
await instance.logo.waitForExist({ reverse: true })
await instance.loadingDataMsg.waitForExist()
await instance.verifyingOpensslMsg.waitForExist()
if (process.platform === 'linux') {
await instance.opensslForLinuxFound.waitForExist()
} else if (process.platform === 'darwin') {
await instance.opensslForDarwinFound.waitForExist()
} else if (process.platform === 'win32') {
await instance.opensslForWin32Found.waitForExist()
}
await instance.loadingDataMsg.waitForExist({ reverse: true })
await instance.verifyingOpensslMsg.waitForExist({ reverse: true })
await instance.opensslForLinuxFound.waitForExist({ reverse: true })
await instance.mainPage.waitForExist()
await instance.mainSelectDeviceButton.waitForExist()
await instance.mainSelectVersionButton.waitForExist()
})

it('should main page appears', async () => {
await expectWDIO(instance.mainPage).toBeDisplayed()
})

it('should message text not appears', async () => {
await expectWDIO(instance.mainClickMessageText).not.toBeDisplayed()
})

it('should \'Select device\' button appears', async () => {
await expectWDIO(instance.mainSelectDeviceButton).toBeDisplayed()
})

it('should \'Select version\' button appears', async () => {
await expectWDIO(instance.mainSelectVersionButton).toBeDisplayed()
})

it('should \'Select device\' button have \'Select device\' text', async () => {
await expectWDIO(instance.mainSelectDeviceText).toHaveText(SELECT_DEVICE_TEXT)
})

it('should \'Select version\' button have \'Select version\' text', async () => {
await expectWDIO(instance.mainSelectVersionText).toHaveText(SELECT_VERSION_TEXT)
})

it('should \'Flash\' button not appears', async () => {
await expectWDIO(instance.mainSelectFlashButton).not.toBeDisplayed()
})
})

0 comments on commit 5069ede

Please sign in to comment.